Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swim bug fixed - image activation for all the child sites devices - V2.3.7.6 #67

Conversation

syed-khadeerahmed
Copy link
Collaborator

@syed-khadeerahmed syed-khadeerahmed commented Dec 16, 2024

Description

image activation for all the child sites devices - V2.3.7.6

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • All the sanity checks have been completed and the sanity test cases have been executed

Ansible Best Practices

  • Tasks are idempotent (can be run multiple times without changing state)
  • Variables and secrets are handled securely (e.g., using ansible-vault or environment variables)
  • Playbooks are modular and reusable
  • Handlers are used for actions that need to run on change

Documentation

  • All options and parameters are documented clearly.
  • Examples are provided and tested.
  • Notes and limitations are clearly stated.

Screenshots (if applicable)

Notes to Reviewers

response = response.get('response')
site_names = site_name + ".*"
get_site_names = self.get_site(site_names)
self.log(get_site_names)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.log("Fetched site names: {0}".format(str(get_site_names)), "DEBUG")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the code

plugins/modules/swim_workflow_manager.py Show resolved Hide resolved
response = self.dnac._exec(
family="site_design",
function='get_site_assigned_network_devices',
op_modifies=True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True or False?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have removed the op_modifies as it is not required for get

params={"site_id": site_id},
)
self.log("Received API response from 'get_site_assigned_network_devices': {0}".format(str(response)), "DEBUG")
response = response.get('response')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead:

        devices = response.get('response')
        if not devices:
            self.log("No devices found for site - '{0}'.".format(site_name), "WARNING")
            continue

Copy link
Collaborator Author

@syed-khadeerahmed syed-khadeerahmed Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the code

except Exception as e:
self.log("Unable to fetch the device(s) associated to the site '{0}' due to '{1}'".format(site_name, str(e)), "WARNING")
return device_uuid_list
for device_id in response:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    for device in devices:
        device_id_list.append(device.get("deviceId"))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the code

offset = offset + 1
self.log("Received API response from 'device_list_response': {0}".format(str(device_list_response)), "DEBUG")
device_response = device_list_response.get('response')
self.log("Received API response: {0}".format(str(device_list_response)), "DEBUG")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    self.log("Received API response from 'get_device_list': {0}".format(str(device_list_response)), "DEBUG")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the code

@madhansansel madhansansel merged commit 8573416 into cisco-en-programmability:main Dec 17, 2024
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants