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

Site enhancement module #451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sonalideepthi777
Copy link

@sonalideepthi777 sonalideepthi777 commented Oct 28, 2024

Description

Update the Site module to support for replacement of membership APIs, and implement bulk site creation and upload floor map, update and delete site APIs for improved functionality with version-based routing.

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

@@ -410,7 +410,7 @@
"""

floor_plan = {
'101101': 'Cubes And Walled Offices',
'107107': 'Cubes And Walled Offices',
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need to change this?

- If the response is empty, a warning is logged.
- Any exceptions during the API call are caught, logged as errors, and the function returns None.
"""

Copy link
Owner

Choose a reason for hiding this comment

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

self.log("Fetching site details for site hierarchy: '{0}'".format(site_name_hierarchy), "INFO")

Copy link
Author

Choose a reason for hiding this comment

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

Added this log

)

if not response:
self.log("The response from 'get_sites' is empty.", "WARNING")
Copy link
Owner

Choose a reason for hiding this comment

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

Always print with site_name.. Otherwise how do we know it?
self.log("Empty response received for site: {0}".format(site_name_hierarchy), "WARNING")

Copy link
Author

Choose a reason for hiding this comment

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

Added this log

self.log("The response from 'get_sites' is empty.", "WARNING")
return None

self.log("Received API response from 'get_sites': {0}".format(str(response)), "DEBUG")
Copy link
Owner

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 for site '{0}' from 'get_sites': {1}".format(site_name_hierarchy, response), "DEBUG")

Copy link
Author

Choose a reason for hiding this comment

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

Added this log

return response

except Exception as e:
self.log("An error occurred in 'get_sites':{0}".format(e), "ERROR")
Copy link
Owner

Choose a reason for hiding this comment

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

print site_name_hierarchy

Copy link
Author

Choose a reason for hiding this comment

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

Added


return (site_exists, current_site)
try:
bulk_operation = self.config[0].get('site', {}).get('bulk_operation', False)
Copy link
Owner

Choose a reason for hiding this comment

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

Do we support bulk operation for the CatC version below 2.3.5.3?

Copy link
Author

@sonalideepthi777 sonalideepthi777 Oct 29, 2024

Choose a reason for hiding this comment

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

No, Added else condition now above try block

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