Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- print sys.argv
- if len(sys.argv)==1:
- sys.exit(0)
- import commands
- for item in sys.argv[1:]:
- print 'item',item
- #unpack
- print commands.getoutput('unzip -o %s'%item)
- #install
- patch_name=item.split('.')[0]
- print 'INSTALL %s' % patch_name
- uuid_update=commands.getoutput('xe patch-upload file-name=%s.xsupdate'%patch_name)
- print 'result'
- print uuid_update
- #apply to hosts
- '''
- uuid ( RO) : 7f36dd15-3fdb-4daf-a259-971df8276ae1
- name-label ( RW): xen
- name-description ( RW): Default install of XenServer
- '''
- hosts=commands.getoutput('xe host-list')
- import re
- #found_result=re.findall('uuid\.*:\s([0-9a-z\-]',hosts)
- for uuid_host in re.findall('uuid \( RO\)\s+:\s([0-9a-z-]+)',hosts):
- print 'APPLY TO HOST',uuid_host
- commands.getoutput('xe patch-apply host-uuid=%s uuid=%s'%(uuid_host,uuid_update))
- commands.getoutput('xe-toolstack-restart')
- print 'SUCCSESFUL'
Advertisement
Add Comment
Please, Sign In to add comment