Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: kick.py

Issue 4768985027444736: 1369 - Integrate ensure_dependencies.py (Closed)
Patch Set: Created Sept. 18, 2014, 10:15 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« ensure_dependencies.py ('K') | « ensure_dependencies.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 getopt 5 import getopt
6 from run import resolveHostList, runCommand 6 from run import resolveHostList, runCommand
7 7
8 def usage(): 8 def usage():
9 print >>sys.stderr, ''' 9 print >>sys.stderr, '''
10 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ... 10 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ...
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 elif option == '-t': 42 elif option == '-t':
43 mode = ' --test --noop' 43 mode = ' --test --noop'
44 44
45 return user, mode, args 45 return user, mode, args
46 46
47 def updateMaster(user): 47 def updateMaster(user):
48 print 'Updating data on the puppet master...' 48 print 'Updating data on the puppet master...'
49 remoteCommand = ' && '.join([ 49 remoteCommand = ' && '.join([
50 'sudo hg pull -qu -R /etc/puppet/infrastructure', 50 'sudo hg pull -qu -R /etc/puppet/infrastructure',
51 'sudo hg pull -qu -R /etc/puppet/infrastructure/modules/private', 51 'sudo hg pull -qu -R /etc/puppet/infrastructure/modules/private',
52 'sudo /etc/puppet/infrastructure/ensure_dependencies.py /etc/puppet/infrastr ucture',
Wladimir Palant 2014/09/18 10:45:59 The sudoers file on puppetmaster needs to be updat
mathias 2014/09/18 13:01:25 Done.
52 ]) 53 ])
53 runCommand(user, "puppetmaster.adblockplus.org", remoteCommand) 54 runCommand(user, "puppetmaster.adblockplus.org", remoteCommand)
54 55
55 def updateClient(user, host, mode): 56 def updateClient(user, host, mode):
56 print 'Provisioning %s...' % host 57 print 'Provisioning %s...' % host
57 remoteCommand = 'sudo puppet agent%s' % mode 58 remoteCommand = 'sudo puppet agent%s' % mode
58 59
59 # Have to ignore errors here, Puppet will return non-zero for successful runs 60 # Have to ignore errors here, Puppet will return non-zero for successful runs
60 runCommand(user, host, remoteCommand, ignore_errors=True) 61 runCommand(user, host, remoteCommand, ignore_errors=True)
61 62
62 if __name__ == "__main__": 63 if __name__ == "__main__":
63 user, mode, args = parseOptions(sys.argv[1:]) 64 user, mode, args = parseOptions(sys.argv[1:])
64 needKicking = resolveHostList(args) 65 needKicking = resolveHostList(args)
65 if len(needKicking) == 0: 66 if len(needKicking) == 0:
66 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' 67 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do'
67 sys.exit(0) 68 sys.exit(0)
68 updateMaster(user) 69 updateMaster(user)
69 for host in needKicking: 70 for host in needKicking:
70 updateClient(user, host, mode) 71 updateClient(user, host, mode)
OLDNEW
« ensure_dependencies.py ('K') | « ensure_dependencies.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld