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

Andrea Bolognani posted 8 patches 7 years, 6 months ago
[libvirt] [jenkins-ci PATCH 2/8] lcitool: Use JSON to pass extra-vars
Posted by Andrea Bolognani 7 years, 6 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 2/8] lcitool: Use JSON to pass extra-vars
Posted by Erik Skultety 7 years, 6 months ago
On Thu, Jul 19, 2018 at 06:32:02PM +0200, Andrea Bolognani wrote:
> 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@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list