From 99191366d5971dafc42225ecd6f93d63c61057d9 Mon Sep 17 00:00:00 2001 From: Joseph Hall Date: Sat, 20 Sep 2014 07:50:49 -0600 Subject: [PATCH] Update formatting for manage.bootstrap runner --- salt/runners/manage.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/salt/runners/manage.py b/salt/runners/manage.py index cdd732b51c..477150b288 100644 --- a/salt/runners/manage.py +++ b/salt/runners/manage.py @@ -293,19 +293,22 @@ def versions(): return ret -def bootstrap(version="develop", +def bootstrap(version='develop', script=None, - hosts="", + hosts='', root_user=True): ''' Bootstrap minions with salt-bootstrap version : develop Git tag of version to install + script : https://bootstrap.saltstack.com Script to execute + hosts - Comma separated hosts [example: hosts="host1.local,host2.local"] + Comma-separated hosts [example: hosts='host1.local,host2.local'] + root_user : True Prepend ``root@`` to each host. @@ -313,24 +316,25 @@ def bootstrap(version="develop", .. code-block:: bash - salt-run manage.bootstrap hosts="host1,host2" - salt-run manage.bootstrap hosts="host1,host2" version="v0.17" - salt-run manage.bootstrap hosts="host1,host2" version="v0.17" script="https://bootstrap.saltstack.com/develop" - salt-run manage.bootstrap hosts="ec2-user@host1,ec2-user@host2" root_user=False + salt-run manage.bootstrap hosts='host1,host2' + salt-run manage.bootstrap hosts='host1,host2' version='v0.17' + salt-run manage.bootstrap hosts='host1,host2' version='v0.17' script='https://bootstrap.saltstack.com/develop' + salt-run manage.bootstrap hosts='ec2-user@host1,ec2-user@host2' root_user=False ''' if script is None: script = 'https://bootstrap.saltstack.com' - for host in hosts.split(","): + + for host in hosts.split(','): # Could potentially lean on salt-ssh utils to make - # deployment easier on existing hosts (i.e. use sshpass, - # or expect, pass better options to ssh etc) - subprocess.call(["ssh", - "root@" if root_user else "" + host, - "python -c 'import urllib; " - "print urllib.urlopen(" - "\"" + script + "\"" - ").read()' | sh -s -- git " + version]) + # deployment easier on existing hosts (i.e. use salt.utils.vt, + # pass better options to ssh, etc) + subprocess.call(['ssh', + 'root@' if root_user else '' + host, + 'python -c 'import urllib; ' + 'print urllib.urlopen(' + '\'' + script + '\'' + ').read()' | sh -s -- git ' + version]) def bootstrap_psexec(hosts='', master=None, version=None, arch='win32',