-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Add cloudscale.ch API inventory plugin #53517
Add cloudscale.ch API inventory plugin #53517
Conversation
97dcab5
to
b04c60e
Compare
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.
good job. only minor doc issues. ready for merge i would say
b04c60e
to
2f075c2
Compare
ready_for_review |
2f075c2
to
bfe1090
Compare
ready_for_review |
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.
shipit
# Two servers with the same name exist, create a group | ||
# with this name and add the servers by UUID | ||
if name not in self.inventory.groups: | ||
self.inventory.add_group(name) |
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.
add_group creates and returns a 'sanitized' group name, to avoid warnings you might want to use self._sanitize_group_name(name)
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.
ah, I thought this would already made by add_group().
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'll do that although I really don't like the fact that this will convert dashes (-) to underscores (_). But this is not specific to this module and if Ansible is really going this way we should probably not allow legacy group names on a new inventory plugin.
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.
@resmo it is, but they are not using the results to compare, so same group will never be in inventory.groups (which you don't need to do since add_group already checks this).
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.
@gaudenz for those that really want it, there will be global toggle available, you CAN add toggle at plugin level to do same
also the |
What should the verify_file method check? I looked at similar plugins and what they seem to do is check that the file has a specific ending (like aws_ec2.yml). This looks like a silly restriction to me as either the user has enabled the plugin explicitly in his ansible configuration or if it's loaded by the auto plugin there is a line There are currently no required parameters which don't have a default value which we could check. |
its there because the user might have N plugins enabled and this allows for a very quick filter (avoiding reading the file itself) to skip/handle the source. Yes the auto plugin can take care of it, but it adds a layer of indirection and always requires reading the file. Also its an easy way to avoid 'extra' errors since when we don't have a good filter on verify_file we are attempting to use multiple plugins and if they all fail, we have to return ALL errors, since we are unsure which one the user meant to use. |
bfe1090
to
35c134a
Compare
ready_for_review |
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.
shipit
SUMMARY
cloudscale.ch API inventory plugin
ISSUE TYPE
(actually new plugin)
COMPONENT NAME
cloudscale
ADDITIONAL INFORMATION
Inventory plugin as a companion to the already existing cloudscale.ch cloud modules.