-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
ovirt hosts facts add cluster version filtration #48664
Conversation
Hi @mnecas, thank you for submitting this pull-request! |
) | ||
if(module.params.get('cluster_version')): |
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 remove ()
around if
@@ -83,7 +100,10 @@ def main(): | |||
hosts = hosts_service.list( | |||
search=module.params['pattern'], | |||
all_content=module.params['all_content'], | |||
follow='cluster' |
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 add ,
at the end
filtered_hosts = [] | ||
for host in hosts: | ||
cluster = host.cluster | ||
if(str(cluster.version.major) + '.' + str(cluster.version.minor) == module.params.get('cluster_version')): |
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 remove () around if
def main(): | ||
argument_spec = ovirt_facts_full_argument_spec( | ||
pattern=dict(default='', required=False), | ||
all_content=dict(default=False, type='bool'), | ||
cluster_version=dict(default=None, type='str'), |
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 that param also to documentation
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 would make it a list so user can pass more versions
The test
|
# All hosts with cluster version 4.2: | ||
- ovirt_host_facts: | ||
pattern: name=host* | ||
cluster_version: |
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.
Hmm, better would be a string.
@@ -33,6 +33,12 @@ | |||
default: False | |||
version_added: "2.7" | |||
type: bool | |||
cluster_version: | |||
description: | |||
- "Filters all your hosts which you got and returns only those with correct version of cluster." |
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.
Filter the hosts based on the cluster version.
cluster_version: | ||
description: | ||
- "Filters all your hosts which you got and returns only those with correct version of cluster." | ||
type: dict |
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.
str
shipit |
* ovirt hosts facts add cluster version filtration * update filtering of ovirt hosts and input of cluster version * ovirt host facts change compat version to string
SUMMARY
Now you can filter ovirt_hosts_facts with cluster version
Fixes #38871
ISSUE TYPE
COMPONENT NAME
ovirt
ADDITIONAL INFORMATION