diff options
author | Martin Nečas <necas.marty@gmail.com> | 2020-02-10 23:12:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 14:12:28 -0800 |
commit | becf3fbf972ae2ad6d41aac2d4a61f10476cd1f0 (patch) | |
tree | 931aabe6a6bf37408746707011095631308f3095 /lib/ansible/module_utils/ovirt.py | |
parent | 587ed81d1621cb70bac998ce38c1503aaeefe3e1 (diff) | |
download | ansible-becf3fbf972ae2ad6d41aac2d4a61f10476cd1f0.tar.gz |
Ovirt add search with space (#66890)
* ovirt search name with space (#59184)
* init ovirt_search_name_with_space
* add search_by_name with whitespace
* add comments
* add changelog
Diffstat (limited to 'lib/ansible/module_utils/ovirt.py')
-rw-r--r-- | lib/ansible/module_utils/ovirt.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ansible/module_utils/ovirt.py b/lib/ansible/module_utils/ovirt.py index 1e3cb7b123..38b048f95e 100644 --- a/lib/ansible/module_utils/ovirt.py +++ b/lib/ansible/module_utils/ovirt.py @@ -254,7 +254,8 @@ def search_by_attributes(service, list_params=None, **kwargs): # Check if 'list' method support search(look for search parameter): if 'search' in inspect.getargspec(service.list)[0]: res = service.list( - search=' and '.join('{0}={1}'.format(k, v) for k, v in kwargs.items()), + # There must be double quotes around name, because some oVirt resources it's possible to create then with space in name. + search=' and '.join('{0}="{1}"'.format(k, v) for k, v in kwargs.items()), **list_params ) else: @@ -281,7 +282,8 @@ def search_by_name(service, name, **kwargs): # Check if 'list' method support search(look for search parameter): if 'search' in inspect.getargspec(service.list)[0]: res = service.list( - search="name={name}".format(name=name) + # There must be double quotes around name, because some oVirt resources it's possible to create then with space in name. + search='name="{name}"'.format(name=name) ) else: res = [e for e in service.list() if e.name == name] |