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
pull/67297/head
Martin Nečas 5 years ago committed by GitHub
parent 587ed81d16
commit becf3fbf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "ovirt - add suport for search with space"

@ -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]

Loading…
Cancel
Save