mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 02:30:22 -07:00
nmcli: add autoconnect priority and retries (#10134)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
* Add autoconnect priority and retries * Add changelog fragment * remove trailing whitespace, fix autoconnect_retries typo in doc * Remove defaults, reformatting Co-authored-by: Felix Fontein <felix@fontein.de> * remove defaults from everywhere * add new params in bond connection test * Change version_added to 11.0.0 Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
35d736f78b
commit
0355a5f4a1
3 changed files with 23 additions and 0 deletions
2
changelogs/fragments/10134-add-autoconnect-options.yml
Normal file
2
changelogs/fragments/10134-add-autoconnect-options.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- nmcli - adds ``autoconnect_priority`` and ``autoconnect_retries`` options to support autoconnect logic (https://github.com/ansible-collections/community.general/pull/10134).
|
|
@ -46,6 +46,16 @@ options:
|
|||
- Whether the connection profile can be automatically activated.
|
||||
type: bool
|
||||
default: true
|
||||
autoconnect_priority:
|
||||
description:
|
||||
- The priority of the connection profile for autoconnect. If set, connection profiles with higher priority will be preferred.
|
||||
type: int
|
||||
version_added: 11.0.0
|
||||
autoconnect_retries:
|
||||
description:
|
||||
- The number of times to retry autoconnecting.
|
||||
type: int
|
||||
version_added: 11.0.0
|
||||
conn_name:
|
||||
description:
|
||||
- The name used to call the connection. Pattern is V(<type>[-<ifname>][-<num>]).
|
||||
|
@ -1688,6 +1698,8 @@ class Nmcli(object):
|
|||
self.state = module.params['state']
|
||||
self.ignore_unsupported_suboptions = module.params['ignore_unsupported_suboptions']
|
||||
self.autoconnect = module.params['autoconnect']
|
||||
self.autoconnect_priority = module.params['autoconnect_priority']
|
||||
self.autoconnect_retries = module.params['autoconnect_retries']
|
||||
self.conn_name = module.params['conn_name']
|
||||
self.conn_reload = module.params['conn_reload']
|
||||
self.slave_type = module.params['slave_type']
|
||||
|
@ -1819,6 +1831,8 @@ class Nmcli(object):
|
|||
# Options common to multiple connection types.
|
||||
options = {
|
||||
'connection.autoconnect': self.autoconnect,
|
||||
'connection.autoconnect-priority': self.autoconnect_priority,
|
||||
'connection.autoconnect-retries': self.autoconnect_retries,
|
||||
'connection.zone': self.zone,
|
||||
}
|
||||
|
||||
|
@ -2262,6 +2276,9 @@ class Nmcli(object):
|
|||
'802-11-wireless-security.wep-key-flags',
|
||||
'802-11-wireless.mac-address-blacklist'):
|
||||
return list
|
||||
elif setting in ('connection.autoconnect-priority',
|
||||
'connection.autoconnect-retries'):
|
||||
return int
|
||||
return str
|
||||
|
||||
def get_route_params(self, raw_values):
|
||||
|
@ -2571,6 +2588,8 @@ def main():
|
|||
argument_spec=dict(
|
||||
ignore_unsupported_suboptions=dict(type='bool', default=False),
|
||||
autoconnect=dict(type='bool', default=True),
|
||||
autoconnect_priority=dict(type='int'),
|
||||
autoconnect_retries=dict(type='int'),
|
||||
state=dict(type='str', required=True, choices=['absent', 'present', 'up', 'down']),
|
||||
conn_name=dict(type='str', required=True),
|
||||
conn_reload=dict(type='bool', default=False),
|
||||
|
|
|
@ -4350,6 +4350,8 @@ def test_bond_connection_unchanged(mocked_generic_connection_diff_check, capfd):
|
|||
argument_spec=dict(
|
||||
ignore_unsupported_suboptions=dict(type='bool', default=False),
|
||||
autoconnect=dict(type='bool', default=True),
|
||||
autoconnect_priority=dict(type='int'),
|
||||
autoconnect_retries=dict(type='int'),
|
||||
state=dict(type='str', required=True, choices=['absent', 'present']),
|
||||
conn_name=dict(type='str', required=True),
|
||||
conn_reload=dict(type='bool', required=False, default=False),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue