Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a397208
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
df3af9d
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
998ddc7
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
0f4b720
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
fc03b28
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
f75af23
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
e187611
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
98210ca
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
f3aed59
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
4561ca5
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
2952c0f
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
6153890
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
8d10756
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
976fd44
Remove ansible.utils dependency from action plugins beginning with th…
s-hertel Jun 16, 2025
b09d452
Add ActionModule base class
s-hertel Jun 16, 2025
28fbabc
Remove 'ansible.utils' as a dependency
s-hertel Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ tags:
- collection
- networking
- sdn
dependencies:
ansible.utils: ">=2.0.0,<6.0"
dependencies: {}
repository: https://github.com/CiscoISE/ansible-ise
documentation: https://ciscoise.github.io/ansible-ise/
homepage: https://github.com/CiscoISE/ansible-ise
Expand Down
57 changes: 14 additions & 43 deletions plugins/action/aci_bindings_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
from __future__ import absolute_import, division, print_function

__metaclass__ = type
from ansible.plugins.action import ActionBase

try:
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
AnsibleArgSpecValidator,
)
except ImportError:
ANSIBLE_UTILS_IS_INSTALLED = False
else:
ANSIBLE_UTILS_IS_INSTALLED = True
from ansible.errors import AnsibleActionFail
from ansible_collections.cisco.ise.plugins.plugin_utils.action import ActionModule as ActionBase
from ansible_collections.cisco.ise.plugins.plugin_utils.ise import (
ISESDK,
ise_argument_spec,
Expand All @@ -44,33 +34,7 @@


class ActionModule(ActionBase):
def __init__(self, *args, **kwargs):
if not ANSIBLE_UTILS_IS_INSTALLED:
raise AnsibleActionFail(
"ansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'"
)
super(ActionModule, self).__init__(*args, **kwargs)
self._supports_async = False
self._supports_check_mode = True
self._result = None

# Checks the supplied parameters against the argument spec for this module
def _check_argspec(self):
aav = AnsibleArgSpecValidator(
data=self._task.args,
schema=dict(argument_spec=argument_spec),
schema_format="argspec",
schema_conditionals=dict(
required_if=required_if,
required_one_of=required_one_of,
mutually_exclusive=mutually_exclusive,
required_together=required_together,
),
name=self._task.action,
)
valid, errors, self._task.args = aav.validate()
if not valid:
raise AnsibleActionFail(errors)
_supports_check_mode = True

def get_object(self, params):
new_object = dict(
Expand All @@ -87,20 +51,27 @@ def run(self, tmp=None, task_vars=None):
self._task.diff = False
self._result = super(ActionModule, self).run(tmp, task_vars)
self._result["changed"] = False
self._check_argspec()
_, validated_arguments = self.validate_argument_spec(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_if=required_if,
required_one_of=required_one_of,
required_together=required_together,
)
params = {k: v, for k, v in validated_arguments if k in self._task.args}

self._result.update(dict(ise_response=[]))

ise = ISESDK(params=self._task.args)
ise = ISESDK(params=params)

id = self._task.args.get("id")
name = self._task.args.get("name")
id = params.get("id")
name = params.get("name")
if not name and not id:
responses = []
generator = ise.exec(
family="aci_bindings",
function="get_aci_bindings_generator",
params=self.get_object(self._task.args),
params=self.get_object(params),
)
try:
for item in generator:
Expand Down
55 changes: 13 additions & 42 deletions plugins/action/aci_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
from __future__ import absolute_import, division, print_function

__metaclass__ = type
from ansible.plugins.action import ActionBase

try:
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
AnsibleArgSpecValidator,
)
except ImportError:
ANSIBLE_UTILS_IS_INSTALLED = False
else:
ANSIBLE_UTILS_IS_INSTALLED = True
from ansible.errors import AnsibleActionFail
from ansible_collections.cisco.ise.plugins.plugin_utils.action import ActionModule as ActionBase
from ansible_collections.cisco.ise.plugins.plugin_utils.ise import (
ISESDK,
ise_argument_spec,
Expand Down Expand Up @@ -193,44 +183,25 @@ def update(self):


class ActionModule(ActionBase):
def __init__(self, *args, **kwargs):
if not ANSIBLE_UTILS_IS_INSTALLED:
raise AnsibleActionFail(
"ansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'"
)
super(ActionModule, self).__init__(*args, **kwargs)
self._supports_async = False
self._supports_check_mode = False
self._result = None

# Checks the supplied parameters against the argument spec for this module
def _check_argspec(self):
aav = AnsibleArgSpecValidator(
data=self._task.args,
schema=dict(argument_spec=argument_spec),
schema_format="argspec",
schema_conditionals=dict(
required_if=required_if,
required_one_of=required_one_of,
mutually_exclusive=mutually_exclusive,
required_together=required_together,
),
name=self._task.action,
)
valid, errors, self._task.args = aav.validate()
if not valid:
raise AnsibleActionFail(errors)
_supports_check_mode = False

def run(self, tmp=None, task_vars=None):
self._task.diff = False
self._result = super(ActionModule, self).run(tmp, task_vars)
self._result["changed"] = False
self._check_argspec()
_, validated_arguments = self.validate_argument_spec(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_if=required_if,
required_one_of=required_one_of,
required_together=required_together,
)
params = {k: v, for k, v in validated_arguments if k in self._task.args}

ise = ISESDK(params=self._task.args)
obj = AciSettings(self._task.args, ise)
ise = ISESDK(params=params)
obj = AciSettings(params, ise)

state = self._task.args.get("state")
state = params.get("state")

response = None
if state == "present":
Expand Down
57 changes: 14 additions & 43 deletions plugins/action/aci_settings_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
from __future__ import absolute_import, division, print_function

__metaclass__ = type
from ansible.plugins.action import ActionBase

try:
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
AnsibleArgSpecValidator,
)
except ImportError:
ANSIBLE_UTILS_IS_INSTALLED = False
else:
ANSIBLE_UTILS_IS_INSTALLED = True
from ansible.errors import AnsibleActionFail
from ansible_collections.cisco.ise.plugins.plugin_utils.action import ActionModule as ActionBase
from ansible_collections.cisco.ise.plugins.plugin_utils.ise import (
ISESDK,
ise_argument_spec,
Expand All @@ -35,33 +25,7 @@


class ActionModule(ActionBase):
def __init__(self, *args, **kwargs):
if not ANSIBLE_UTILS_IS_INSTALLED:
raise AnsibleActionFail(
"ansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'"
)
super(ActionModule, self).__init__(*args, **kwargs)
self._supports_async = False
self._supports_check_mode = True
self._result = None

# Checks the supplied parameters against the argument spec for this module
def _check_argspec(self):
aav = AnsibleArgSpecValidator(
data=self._task.args,
schema=dict(argument_spec=argument_spec),
schema_format="argspec",
schema_conditionals=dict(
required_if=required_if,
required_one_of=required_one_of,
mutually_exclusive=mutually_exclusive,
required_together=required_together,
),
name=self._task.action,
)
valid, errors, self._task.args = aav.validate()
if not valid:
raise AnsibleActionFail(errors)
_supports_check_mode = True

def get_object(self, params):
new_object = dict()
Expand All @@ -71,19 +35,26 @@ def run(self, tmp=None, task_vars=None):
self._task.diff = False
self._result = super(ActionModule, self).run(tmp, task_vars)
self._result["changed"] = False
self._check_argspec()
_, validated_arguments = self.validate_argument_spec(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_if=required_if,
required_one_of=required_one_of,
required_together=required_together,
)
params = {k: v, for k, v in validated_arguments if k in self._task.args}

self._result.update(dict(ise_response={}))

ise = ISESDK(params=self._task.args)
ise = ISESDK(params=params)

id = self._task.args.get("id")
name = self._task.args.get("name")
id = params.get("id")
name = params.get("name")
if not name and not id:
response = ise.exec(
family="aci_settings",
function="get_aci_settings",
params=self.get_object(self._task.args),
params=self.get_object(params),
).response["AciSettings"]
self._result.update(dict(ise_response=response))
self._result.update(ise.exit_json())
Expand Down
53 changes: 12 additions & 41 deletions plugins/action/aci_test_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
from __future__ import absolute_import, division, print_function

__metaclass__ = type
from ansible.plugins.action import ActionBase

try:
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
AnsibleArgSpecValidator,
)
except ImportError:
ANSIBLE_UTILS_IS_INSTALLED = False
else:
ANSIBLE_UTILS_IS_INSTALLED = True
from ansible.errors import AnsibleActionFail
from ansible_collections.cisco.ise.plugins.plugin_utils.action import ActionModule as ActionBase
from ansible_collections.cisco.ise.plugins.plugin_utils.ise import (
ISESDK,
ise_argument_spec,
Expand All @@ -35,33 +25,7 @@


class ActionModule(ActionBase):
def __init__(self, *args, **kwargs):
if not ANSIBLE_UTILS_IS_INSTALLED:
raise AnsibleActionFail(
"ansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'"
)
super(ActionModule, self).__init__(*args, **kwargs)
self._supports_async = False
self._supports_check_mode = False
self._result = None

# Checks the supplied parameters against the argument spec for this module
def _check_argspec(self):
aav = AnsibleArgSpecValidator(
data=self._task.args,
schema=dict(argument_spec=argument_spec),
schema_format="argspec",
schema_conditionals=dict(
required_if=required_if,
required_one_of=required_one_of,
mutually_exclusive=mutually_exclusive,
required_together=required_together,
),
name=self._task.action,
)
valid, errors, self._task.args = aav.validate()
if not valid:
raise AnsibleActionFail(errors)
_supports_check_mode = False

def get_object(self, params):
new_object = dict()
Expand All @@ -71,14 +35,21 @@ def run(self, tmp=None, task_vars=None):
self._task.diff = False
self._result = super(ActionModule, self).run(tmp, task_vars)
self._result["changed"] = False
self._check_argspec()
_, validated_arguments = self.validate_argument_spec(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_if=required_if,
required_one_of=required_one_of,
required_together=required_together,
)
params = {k: v, for k, v in validated_arguments if k in self._task.args}

ise = ISESDK(params=self._task.args)
ise = ISESDK(params=params)

response = ise.exec(
family="aci_settings",
function="test_aci_connectivity",
params=self.get_object(self._task.args),
params=self.get_object(params),
).response

self._result.update(dict(ise_response=response))
Expand Down
Loading