diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
commit | 38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch) | |
tree | 356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/cisco/dnac/plugins/action | |
parent | Adding upstream version 7.7.0+dfsg. (diff) | |
download | ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip |
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/dnac/plugins/action')
15 files changed, 40 insertions, 27 deletions
diff --git a/ansible_collections/cisco/dnac/plugins/action/cli_credential.py b/ansible_collections/cisco/dnac/plugins/action/cli_credential.py index d10c90049..2b42190fa 100644 --- a/ansible_collections/cisco/dnac/plugins/action/cli_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/cli_credential.py @@ -127,7 +127,7 @@ class CliCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/http_read_credential.py b/ansible_collections/cisco/dnac/plugins/action/http_read_credential.py index 1d1ac0acd..c73050be8 100644 --- a/ansible_collections/cisco/dnac/plugins/action/http_read_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/http_read_credential.py @@ -130,7 +130,7 @@ class HttpReadCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/http_write_credential.py b/ansible_collections/cisco/dnac/plugins/action/http_write_credential.py index 5a63c0d5e..7ae396a1b 100644 --- a/ansible_collections/cisco/dnac/plugins/action/http_write_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/http_write_credential.py @@ -130,7 +130,7 @@ class HttpWriteCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/netconf_credential.py b/ansible_collections/cisco/dnac/plugins/action/netconf_credential.py index 08aa9d19c..5ea30373d 100644 --- a/ansible_collections/cisco/dnac/plugins/action/netconf_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/netconf_credential.py @@ -121,7 +121,7 @@ class NetconfCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/pnp_device_claim_to_site.py b/ansible_collections/cisco/dnac/plugins/action/pnp_device_claim_to_site.py index 1ec73115c..6bceab4a1 100644 --- a/ansible_collections/cisco/dnac/plugins/action/pnp_device_claim_to_site.py +++ b/ansible_collections/cisco/dnac/plugins/action/pnp_device_claim_to_site.py @@ -29,7 +29,7 @@ argument_spec.update(dict( siteId=dict(type="str"), type=dict(type="str"), imageInfo=dict(type="dict"), - configInfo=dict(type="list"), + configInfo=dict(type="dict"), rfProfile=dict(type="str"), staticIP=dict(type="str"), subnetMask=dict(type="str"), diff --git a/ansible_collections/cisco/dnac/plugins/action/role_permissions_info.py b/ansible_collections/cisco/dnac/plugins/action/role_permissions_info.py index 39728ba46..a1b758c74 100644 --- a/ansible_collections/cisco/dnac/plugins/action/role_permissions_info.py +++ b/ansible_collections/cisco/dnac/plugins/action/role_permissions_info.py @@ -78,8 +78,8 @@ class ActionModule(ActionBase): dnac = DNACSDK(params=self._task.args) response = dnac.exec( - family="userand_roles", - function='get_permissions_ap_i', + family="user_and_roles", + function='get_permissions_api', params=self.get_object(self._task.args), ) self._result.update(dict(dnac_response=response)) diff --git a/ansible_collections/cisco/dnac/plugins/action/roles_info.py b/ansible_collections/cisco/dnac/plugins/action/roles_info.py index 380c9c687..4283de11b 100644 --- a/ansible_collections/cisco/dnac/plugins/action/roles_info.py +++ b/ansible_collections/cisco/dnac/plugins/action/roles_info.py @@ -78,8 +78,8 @@ class ActionModule(ActionBase): dnac = DNACSDK(params=self._task.args) response = dnac.exec( - family="userand_roles", - function='get_roles_ap_i', + family="user_and_roles", + function='get_roles_api', params=self.get_object(self._task.args), ) self._result.update(dict(dnac_response=response)) diff --git a/ansible_collections/cisco/dnac/plugins/action/snmpv2_read_community_credential.py b/ansible_collections/cisco/dnac/plugins/action/snmpv2_read_community_credential.py index 60edf5c83..cda2e0c06 100644 --- a/ansible_collections/cisco/dnac/plugins/action/snmpv2_read_community_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/snmpv2_read_community_credential.py @@ -115,7 +115,7 @@ class Snmpv2ReadCommunityCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/snmpv2_write_community_credential.py b/ansible_collections/cisco/dnac/plugins/action/snmpv2_write_community_credential.py index 97982d2c7..2ff190d75 100644 --- a/ansible_collections/cisco/dnac/plugins/action/snmpv2_write_community_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/snmpv2_write_community_credential.py @@ -115,7 +115,7 @@ class Snmpv2WriteCommunityCredential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/ansible_collections/cisco/dnac/plugins/action/snmpv3_credential.py b/ansible_collections/cisco/dnac/plugins/action/snmpv3_credential.py index 480c82e66..313087715 100644 --- a/ansible_collections/cisco/dnac/plugins/action/snmpv3_credential.py +++ b/ansible_collections/cisco/dnac/plugins/action/snmpv3_credential.py @@ -137,7 +137,7 @@ class Snmpv3Credential(object): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) @@ -167,6 +167,9 @@ class Snmpv3Credential(object): ("snmpMode", "snmpMode"), ("username", "username"), ] + + print("requested_obj: ", requested_obj) + print("current_obj: ", current_obj) # Method 1. Params present in request (Ansible) obj are the same as the current (ISE) params # If any does not have eq params, it requires update return any(not dnac_compare_equality(current_obj.get(dnac_param), diff --git a/ansible_collections/cisco/dnac/plugins/action/swim_import_local.py b/ansible_collections/cisco/dnac/plugins/action/swim_import_local.py index 57946e44e..b5e3b8a6c 100644 --- a/ansible_collections/cisco/dnac/plugins/action/swim_import_local.py +++ b/ansible_collections/cisco/dnac/plugins/action/swim_import_local.py @@ -20,6 +20,7 @@ from ansible_collections.cisco.dnac.plugins.plugin_utils.dnac import ( DNACSDK, dnac_argument_spec, ) +import os # Get common arguements specification argument_spec = dnac_argument_spec() @@ -41,7 +42,8 @@ required_together = [] 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'") + 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 @@ -70,8 +72,12 @@ class ActionModule(ActionBase): is_third_party=params.get("isThirdParty"), third_party_vendor=params.get("thirdPartyVendor"), third_party_image_family=params.get("thirdPartyImageFamily"), - third_party_application_type=params.get("thirdPartyApplicationType"), + third_party_application_type=params.get( + "thirdPartyApplicationType"), file_path=params.get("filePath"), + multipart_fields={'file': (os.path.basename(params.get( + "filePath")), open(params.get("filePath"), 'rb'))}, + multipart_monitor_callback=None ) return new_object diff --git a/ansible_collections/cisco/dnac/plugins/action/tag_member.py b/ansible_collections/cisco/dnac/plugins/action/tag_member.py index e92fdf505..54ae99e17 100644 --- a/ansible_collections/cisco/dnac/plugins/action/tag_member.py +++ b/ansible_collections/cisco/dnac/plugins/action/tag_member.py @@ -54,6 +54,7 @@ class TagMember(object): object=params.get("object"), id=params.get("id"), member_id=params.get("memberId"), + member_type=params.get("memberType"), ) def create_params(self): @@ -81,7 +82,8 @@ class TagMember(object): items = self.dnac.exec( family="tag", function="get_tag_members_by_id", - params={"id": id} + params={"id": id, "memberType": self.new_object.get( + 'member_type'), } ) if isinstance(items, dict): if 'response' in items: @@ -108,7 +110,8 @@ class TagMember(object): _id = prev_obj.get("id") _id = _id or prev_obj.get("memberId") if id_exists and name_exists and o_id != _id: - raise InconsistentParameters("The 'id' and 'name' params don't refer to the same object") + raise InconsistentParameters( + "The 'id' and 'name' params don't refer to the same object") if _id: self.new_object.update(dict(id=_id)) self.new_object.update(dict(member_id=_id)) @@ -164,7 +167,8 @@ class TagMember(object): 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'") + 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 diff --git a/ansible_collections/cisco/dnac/plugins/action/user.py b/ansible_collections/cisco/dnac/plugins/action/user.py index b9c8d5c4e..1896e57ff 100644 --- a/ansible_collections/cisco/dnac/plugins/action/user.py +++ b/ansible_collections/cisco/dnac/plugins/action/user.py @@ -91,8 +91,8 @@ class User(object): # NOTE: Does not have a get by name method, using get all try: items = self.dnac.exec( - family="userand_roles", - function="get_users_ap_i", + family="user_and_roles", + function="get_users_api", params=self.get_all_params(name=name), ) if isinstance(items, dict): @@ -148,8 +148,8 @@ class User(object): def create(self): result = self.dnac.exec( - family="userand_roles", - function="add_user_ap_i", + family="user_and_roles", + function="add_user_api", params=self.create_params(), op_modifies=True, ) @@ -160,8 +160,8 @@ class User(object): name = self.new_object.get("name") result = None result = self.dnac.exec( - family="userand_roles", - function="update_user_ap_i", + family="user_and_roles", + function="update_user_api", params=self.update_all_params(), op_modifies=True, ) diff --git a/ansible_collections/cisco/dnac/plugins/action/user_info.py b/ansible_collections/cisco/dnac/plugins/action/user_info.py index eb9ccc38e..7a5906fcc 100644 --- a/ansible_collections/cisco/dnac/plugins/action/user_info.py +++ b/ansible_collections/cisco/dnac/plugins/action/user_info.py @@ -80,8 +80,8 @@ class ActionModule(ActionBase): dnac = DNACSDK(params=self._task.args) response = dnac.exec( - family="userand_roles", - function='get_users_ap_i', + family="user_and_roles", + function='get_users_api', params=self.get_object(self._task.args), ) self._result.update(dict(dnac_response=response)) diff --git a/ansible_collections/cisco/dnac/plugins/action/users_external_servers_info.py b/ansible_collections/cisco/dnac/plugins/action/users_external_servers_info.py index 1436338cc..b29ce6bb2 100644 --- a/ansible_collections/cisco/dnac/plugins/action/users_external_servers_info.py +++ b/ansible_collections/cisco/dnac/plugins/action/users_external_servers_info.py @@ -80,8 +80,8 @@ class ActionModule(ActionBase): dnac = DNACSDK(params=self._task.args) response = dnac.exec( - family="userand_roles", - function='get_external_authentication_servers_ap_i', + family="user_and_roles", + function='get_external_authentication_servers_api', params=self.get_object(self._task.args), ) self._result.update(dict(dnac_response=response)) |