mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add vyos_interface default description (#27029)
* Add default description string to vyos_interface * If `state=up` it should remove the `disable` configuration for interface. However, if no other interface parameter is configured this ends up deleting the interface itself which is not the desired behaviour. Hence adding a default description field to avoid such scenario's. * Minor changes * Add default description to aggregate
This commit is contained in:
parent
f682d9bf49
commit
abb4361990
2 changed files with 7 additions and 4 deletions
|
@ -123,6 +123,8 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.vyos import load_config, get_config
|
||||
from ansible.module_utils.vyos import vyos_argument_spec, check_args
|
||||
|
||||
DEFAULT_DESCRIPTION = "'configured by vyos_interface'"
|
||||
|
||||
|
||||
def search_obj_in_list(name, lst):
|
||||
for o in lst:
|
||||
|
@ -232,6 +234,7 @@ def map_params_to_obj(module):
|
|||
if item not in d:
|
||||
d[item] = None
|
||||
|
||||
d['description'] = DEFAULT_DESCRIPTION
|
||||
if not d.get('state'):
|
||||
d['state'] = module.params['state']
|
||||
|
||||
|
@ -269,7 +272,7 @@ def main():
|
|||
"""
|
||||
argument_spec = dict(
|
||||
name=dict(),
|
||||
description=dict(),
|
||||
description=dict(default=DEFAULT_DESCRIPTION),
|
||||
speed=dict(),
|
||||
mtu=dict(type='int'),
|
||||
duplex=dict(choices=['full', 'half', 'auto']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue