| LEFT | RIGHT |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding: utf-8 | 2 # coding: utf-8 |
| 3 | 3 |
| 4 import sys | 4 import sys |
| 5 import os | |
| 6 import re | |
| 7 import subprocess | |
| 8 import getopt | 5 import getopt |
| 9 import yaml | |
| 10 from run import resolveHostList, runCommand | 6 from run import resolveHostList, runCommand |
| 11 | 7 |
| 12 def usage(): | 8 def usage(): |
| 13 print >>sys.stderr, ''' | 9 print >>sys.stderr, ''' |
| 14 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ... | 10 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ... |
| 15 | 11 |
| 16 Runs provisioning on the given hosts or groups of hosts. | 12 Runs provisioning on the given hosts or groups of hosts. |
| 17 | 13 |
| 18 Options: | 14 Options: |
| 19 -u <user> User name to use with the SSH command (needs access to puppet | 15 -u <user> User name to use with the SSH command (needs access to puppet |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 61 |
| 66 if __name__ == "__main__": | 62 if __name__ == "__main__": |
| 67 user, mode, args = parseOptions(sys.argv[1:]) | 63 user, mode, args = parseOptions(sys.argv[1:]) |
| 68 needKicking = resolveHostList(args) | 64 needKicking = resolveHostList(args) |
| 69 if len(needKicking) == 0: | 65 if len(needKicking) == 0: |
| 70 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' | 66 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' |
| 71 sys.exit(0) | 67 sys.exit(0) |
| 72 updateMaster(user) | 68 updateMaster(user) |
| 73 for host in needKicking: | 69 for host in needKicking: |
| 74 updateClient(user, host, mode) | 70 updateClient(user, host, mode) |
| LEFT | RIGHT |