[libvirt] [jenkins-ci PATCH 2/8] lcitool: Use JSON to pass extra-vars

Andrea Bolognani abologna at redhat.com
Thu Jul 19 16:32:02 UTC 2018


We're going to add more extra-vars later on, and they
will be in some cases more complex than simple strings;
using JSON allows us to do that and also be less verbose.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 guests/lcitool | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 5526a27..4acb076 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -19,6 +19,7 @@
 import argparse
 import crypt
 import fnmatch
+import json
 import os
 import random
 import string
@@ -432,10 +433,10 @@ class Application:
         ansible_cfg_path = os.path.join(base, "ansible.cfg")
         playbook_path = os.path.join(base, "site.yml")
 
-        extra_vars = "flavor={} root_password_file={}".format(
-            flavor,
-            root_pass_file,
-        )
+        extra_vars = json.dumps({
+            "root_password_file": root_pass_file,
+            "flavor": flavor,
+        })
 
         cmd = [
             "ansible-playbook",
-- 
2.17.1




More information about the libvir-list mailing list