From c1d2feb12869a9146f619ebd9ee9f423b6b4fdf9 Mon Sep 17 00:00:00 2001 From: lining <2313806311@qq.com> Date: Mon, 22 May 2017 17:29:43 +0800 Subject: [PATCH] fix bug set secret value --- kvmagent/kvmagent/plugins/vm_plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kvmagent/kvmagent/plugins/vm_plugin.py b/kvmagent/kvmagent/plugins/vm_plugin.py index b17ad62025..386084159a 100644 --- a/kvmagent/kvmagent/plugins/vm_plugin.py +++ b/kvmagent/kvmagent/plugins/vm_plugin.py @@ -3308,7 +3308,9 @@ def _create_ceph_secret_key(userKey, uuid): try: o = shell.call("virsh secret-define %s" % spath) o = o.strip(' \n\t\r') - _, generateuuid, _ = o.split() + uuidReg = "[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}" + pattern = re.compile(uuidReg) + generateuuid = pattern.findall(o)[0] shell.call('virsh secret-set-value %s %s' % (generateuuid, userKey)) finally: os.remove(spath)