Skip to content

feat(public cloud disk utils): Volume extend and info modules #115

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

james-willdooit
Copy link

Adding the ability to extend/resize volumes and obtain volume info

Copy link
Collaborator

@tortuegenialez tortuegenialez left a comment

Choose a reason for hiding this comment

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

Thanks for your PR

changed=True,
**result)

except APIError as api_error:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Exceptions are catched in the OVH class

region = module.params['region']
size = module.params['size']
name = module.params['name']

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should add a check_mode option before running for real

try:
result = client.wrap_call(
"POST",
'/cloud/project/%s/volume/%s/upsize' % (service_name, volume_id),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use fstring

result = [volume for volume in result if volume['name'] == module.params['name']][0]
module.exit_json(changed=False, **result)

except APIError as api_error:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, exceptions are handled in the OVH class


module = AnsibleModule(
argument_spec=module_args,
supports_check_mode=True
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is only returning informations, the check mode could be set to false.
Otherwise you should add a check mode

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