openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab...@apache.org
Subject [incubator-openwhisk] branch master updated: Add '-e' to redo for ansible variables and change '-a' to gradle arguments only. (#3332)
Date Fri, 23 Feb 2018 20:06:43 GMT
This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new cc921e4  Add '-e' to redo for ansible variables and change '-a' to gradle arguments
only. (#3332)
cc921e4 is described below

commit cc921e466a0da8872044111d19b44c7fe5760b8b
Author: Jonathan Springer <jonpspri@gmail.com>
AuthorDate: Fri Feb 23 15:06:41 2018 -0500

    Add '-e' to redo for ansible variables and change '-a' to gradle arguments only. (#3332)
---
 tools/build/redo | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/build/redo b/tools/build/redo
index b152c24..6dc3cd8 100755
--- a/tools/build/redo
+++ b/tools/build/redo
@@ -93,7 +93,8 @@ def getArgs():
     parser.add_argument('-g', '--gradle', help='use target using inferred gradle file if
component is not one of known targets', action='store_const', const=True, default=False)
     parser.add_argument('-n', '--just-print', help='prints the component configuration but
does not run any targets', action='store_const', const=True, default=False, dest='skiprun')
     parser.add_argument('-c', '--list-components', help='list known component names and exit',
action='store_const', const=True, default=False, dest='list')
-    parser.add_argument('-a', '--additional-task-arguments', dest='extraArgs', action='append',
help='pass additional arguments to underlying task command')
+    parser.add_argument('-a', '--additional-task-arguments', dest='extraArgs', action='append',
help='pass additional arguments to gradle build')
+    parser.add_argument('-e', '--extra-ansible-vars', dest='extraAnsibleVars', action='append',
help='pass extra vars to ansible-playbook')
     parser.add_argument('components', nargs = '*', help='component name(s) to run (in order
specified if more than one)')
     parser.add_argument('--dir', help='whisk home directory')
 
@@ -144,7 +145,7 @@ class Playbook:
     def path(self, basedir):
         return basedir + '/' + self.dir
 
-    def execcmd(self, props, mode = False, extraArgs = ''):
+    def execcmd(self, props, mode = False, extraAnsibleVars = []):
         if self.dir and self.file and (mode is False or mode in self.modes):
             cmd = [ self.cmd ]
             if self.env:
@@ -152,8 +153,8 @@ class Playbook:
             cmd.append(self.file)
             if mode:
                 cmd.append('-e mode=%s' % mode)
-            if extraArgs is not '':
-                cmd.append(extraArgs)
+            if extraAnsibleVars:
+                cmd.append(' '.join(map(lambda x: "-e '" + str(x) + "'", extraAnsibleVars)))
             return ' '.join(cmd)
 
 class Gradle:
@@ -393,11 +394,11 @@ def doOne(component, args, props):
         run(cmd, basedir, args.skiprun)
 
     if args.teardown and playbook is not None:
-        cmd = playbook.execcmd(props, 'clean', extraArgs = extraArgs)
+        cmd = playbook.execcmd(props, 'clean', extraAnsibleVars = args.extraAnsibleVars)
         run(cmd, playbook.path(basedir), args.skiprun)
 
     if args.deploy and playbook is not None:
-        cmd = playbook.execcmd(props, extraArgs = extraArgs)
+        cmd = playbook.execcmd(props, extraAnsibleVars = args.extraAnsibleVars)
         run(cmd, playbook.path(basedir), args.skiprun)
 
 if __name__ == '__main__':

-- 
To stop receiving notification emails like this one, please contact
rabbah@apache.org.

Mime
View raw message