Skip to content

cs_project.py: pass cleanup=true in deleteProject API #122

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jun 7, 2023

Conversation

rohityadavcloud
Copy link
Contributor

Pass cleanup=true in the delete project module, refer:
https://cloudstack.apache.org/api/apidocs-4.18/apis/deleteProject.html

@rohityadavcloud
Copy link
Contributor Author

cc @resmo

Copy link

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

the new flag was introduced in cloudstack 4.16, which breaks backwards compatibility somehow.
apache/cloudstack#4617

@resmo
Copy link
Member

resmo commented Jun 5, 2023

@weizhouapache well, didn't test it yet but in the past, cloudstack just ignored unknown flags? So for earlier versions, this shouldn't break backwards compatibility right?

@weizhouapache
Copy link

@weizhouapache well, didn't test it yet but in the past, cloudstack just ignored unknown flags? So for earlier versions, this shouldn't break backwards compatibility right?

@resmo
this PR also works with the earlier cloudstack versions which do not support the cleanup flag.

There will be a warning message in log (just a warning) like

Received unknown parameters for command deleteProject. Unknown parameters : cleanup

@@ -222,7 +222,8 @@ def absent_project(self):
self.result['changed'] = True

args = {
'id': project['id']
'id': project['id'],
'cleanup': 'true'
Copy link
Member

Choose a reason for hiding this comment

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

This should actually be a bool like so 'cleanup': True

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure @resmo I can fix that. Does ansible/module, convert boolen True to 'true' string when pass the args in the API call?

@rohityadavcloud rohityadavcloud requested a review from resmo June 5, 2023 12:50
@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (dc89b6d) 83.77% compared to head (ac35926) 83.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #122   +/-   ##
=======================================
  Coverage   83.77%   83.77%           
=======================================
  Files          56       56           
  Lines        5645     5645           
  Branches     1271     1271           
=======================================
  Hits         4729     4729           
  Misses        472      472           
  Partials      444      444           
Impacted Files Coverage Δ
plugins/modules/cs_project.py 83.72% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants