-
Notifications
You must be signed in to change notification settings - Fork 45
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
VPS Display Name Module - Supports Changed/Ok/Error #77
Conversation
Ansible module for setting the Display Name of OVH VPS system. - Take the Service Name and Display Name as parameters. - Check the current value of Display Name for Service Name via GET. - Set Display Name for Service Name if given value is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change the camelcase, thanks
plugins/modules/vps_display_name.py
Outdated
'displayName': display_name | ||
} | ||
|
||
# Retrieve the current values for displayName, keymap and netbootMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you retrieving those three parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all 3. comment is based on the OVH doc. Changed to only mention the displayName.
plugins/modules/vps_display_name.py
Outdated
module.exit_json( | ||
msg="displayName succesfully set to {} for {} !".format(display_name, service_name), | ||
changed=True) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if the putResult
fails it will be catched in the try/except in the module_utils part 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of this. It does, but the error it throws is not clear (looks like an authentication issue, instead of the real problem). Yet, I changed my code to use it.
plugins/modules/vps_display_name.py
Outdated
|
||
# Retrieve the current values for displayName, keymap and netbootMode | ||
|
||
getResult=client.wrap_call( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use snakecase instead of camelcase: get_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did that.
plugins/modules/vps_display_name.py
Outdated
# Now check if the value is different and if necessary set it | ||
|
||
if getResult['displayName'] != display_name: | ||
putResult=client.wrap_call( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snakecase too: put_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took the variable out, as it is no longer needed.
Sorry for reacting this late. Got occupied by other things and as I am pretty new to git, github and the project code, I needed a bit of time to dive in. Please let me know if you need further changes. If not, I will try to find time to write modules for other VPS endpoints, as I need them for my VPSes. |
Hi,
First code for an Ansible module for setting the Display Name of OVH VPS system.
It was started as a "copy from" the dedicated_server_display_name.py but as that code failed to do anything for my VPS-es I created my own logic. In order to be able to report Changed/Ok/Error it has to do a GET first and then, if necessary do the PUT.
Not sure if the if/then/else catches all possible errors (esp. from the GET).
Regards,
Paul Tap (armorica)