This is an automated email from the git hooks/post-receive script.
praiskup pushed a commit to branch master
in repository copr/copr.
commit 48880ccdc1ff0c514318d9d0c255341d830e55a0
Author: Pavel Raiskup <praiskup(a)redhat.com>
AuthorDate: Sat Mar 16 18:29:33 2019 +0100
[backend] fix default arguments in redis scripts
Per redis upstream documentation:
redis-py 3.0 only accepts user data as bytes, strings or
numbers (ints, longs and floats). Attempting to specify a key
or a value as any other type will raise a DataError exception.
redis-py 2.X attempted to coerce any type of input into a
string. While occasionally convenient, this caused all sorts
of hidden errors when users passed boolean values (which were
coerced to 'True' or 'False'), a None value (which was coerced
to 'None') or other values, such as user defined types.
This was exactly our case, so we shouldn't rely on the fact that
None is transformed to "None".
Fixes: PR#583
---
backend/backend/vm_manage/manager.py | 4 ++--
backend/tests/vm_manager/test_manager.py | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/backend/backend/vm_manage/manager.py b/backend/backend/vm_manage/manager.py
index 42d78aa..87b40cb 100644
--- a/backend/backend/vm_manage/manager.py
+++ b/backend/backend/vm_manage/manager.py
@@ -209,7 +209,7 @@ class VmManager(object):
vmd_list = self.get_all_vm_in_group(group)
return [vmd for vmd in vmd_list if vmd.bound_to_user is not None]
- def acquire_vm(self, groups, ownername, pid, task_id=None, build_id=None,
chroot=None):
+ def acquire_vm(self, groups, ownername, pid, task_id="None",
build_id="None", chroot="None"):
"""
Try to acquire VM from pool.
@@ -262,7 +262,7 @@ class VmManager(object):
self.log.info("Release vm result `%s`", lua_result)
return lua_result == "OK"
- def start_vm_termination(self, vm_name, allowed_pre_state=None):
+ def start_vm_termination(self, vm_name, allowed_pre_state="None"):
"""
Initiate VM termination process using redis publish.
diff --git a/backend/tests/vm_manager/test_manager.py
b/backend/tests/vm_manager/test_manager.py
index a5213a5..7bd8d56 100644
--- a/backend/tests/vm_manager/test_manager.py
+++ b/backend/tests/vm_manager/test_manager.py
@@ -128,6 +128,7 @@ class TestManager(object):
vmd.store_field(self.rc, "state", VmStates.READY)
# undefined both last_health_check and server_start_timestamp
+ mc_time.time.return_value = 0.1
with pytest.raises(NoVmAvailable):
self.vmm.acquire_vm([GID1], self.ownername, 42)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.