Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 18, 2023
1 parent e3bcdbe commit 9c5fb26
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import absolute_import, division, print_function


__metaclass__ = type

#############################################
Expand All @@ -29,8 +30,7 @@


class User_globalArgs(object): # pylint: disable=R0903
"""The arg spec for the ios_user_global module
"""
"""The arg spec for the ios_user_global module"""

argument_spec = {
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def _compare_list_complex_parsers(self, want, have):
or h_command == "old"
and self.state in ["overridden", "replaced"]
):
self.addcmd(haveing, h_parser + ".name" if h_command == "new" else h_parser, negate=True)
self.addcmd(
haveing, h_parser + ".name" if h_command == "new" else h_parser, negate=True
)
if wanting["command"] == "new":
self.addcmd(wanting, w_parser + ".name")
for k in wanting["parameters"].keys():
Expand Down Expand Up @@ -151,7 +153,7 @@ def _compare_list_complex_parsers(self, want, have):
self.addcmd(
haveing,
h_parser + ".name" if h_command == "new" else h_parser,
negate=True
negate=True,
)

def _users_list_to_dict(self, data):
Expand Down
9 changes: 7 additions & 2 deletions plugins/module_utils/network/ios/rm_templates/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
class IosNetworkTemplate(NetworkTemplate):
def __init__(self, lines=None, tmplt=None, prefix=None, module=None):
super(IosNetworkTemplate, self).__init__(
lines=lines, tmplt=tmplt, prefix=prefix, module=module
lines=lines,
tmplt=tmplt,
prefix=prefix,
module=module,
)

def _render(self, tmplt, data, negate):
Expand All @@ -36,7 +39,9 @@ def _render(self, tmplt, data, negate):
res["command"] = res["command"](data)
else:
res["command"] = self._template(
value=res["command"], variables=data, fail_on_undefined=False
value=res["command"],
variables=data,
fail_on_undefined=False,
)
except KeyError:
return None
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/ios_user_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from __future__ import absolute_import, division, print_function


__metaclass__ = type

DOCUMENTATION = """
Expand Down Expand Up @@ -459,6 +460,7 @@
"""

from ansible.module_utils.basic import AnsibleModule

from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.user_global.user_global import (
User_globalArgs,
)
Expand Down
24 changes: 12 additions & 12 deletions tests/unit/modules/network/ios/test_ios_user_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ def test_ios_user_global_merged(self):
list(
map(
lambda x: x["command"] if isinstance(x, dict) and "command" in x else x,
result["commands"]
)
)
result["commands"],
),
),
),
sorted(merged)
sorted(merged),
)

def test_ios_user_global_deleted(self):
Expand All @@ -181,11 +181,11 @@ def test_ios_user_global_deleted(self):
list(
map(
lambda x: x["command"] if isinstance(x, dict) and "command" in x else x,
result["commands"]
)
)
result["commands"],
),
),
),
sorted(deleted)
sorted(deleted),
)

def test_ios_user_global_overridden(self):
Expand Down Expand Up @@ -252,11 +252,11 @@ def test_ios_user_global_overridden(self):
list(
map(
lambda x: x["command"] if isinstance(x, dict) and "command" in x else x,
result["commands"]
)
)
result["commands"],
),
),
),
sorted(overridden)
sorted(overridden),
)

def test_ios_user_global_overridden_idempotent(self):
Expand Down

0 comments on commit 9c5fb26

Please sign in to comment.