Skip to content

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