2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Implement argument to nodefirmware to backup

This commit is contained in:
Jarrod Johnson 2017-08-16 17:33:23 -04:00
parent 54f25cfa9e
commit b35463e594

View File

@ -66,7 +66,9 @@ def printfirm(node, prefix, data):
argparser = optparse.OptionParser(
usage="Usage: %prog <noderange> [update <file>]")
usage="Usage: %prog <noderange> [update [--backup <file>]")
argparser.add_option('-b', '--backup', action='store_true',
help='Target a backup bank rather than primary')
(options, args) = argparser.parse_args()
upfile = None
try:
@ -98,7 +100,10 @@ def update_firmware(session, filename):
filename = os.path.abspath(filename)
resource = '/noderange/{0}/inventory/firmware/updates/active'.format(
noderange)
for res in session.create(resource, {'filename': filename}):
upargs = {'filename': filename}
if options.backup:
upargs['bank'] = 'bank'
for res in session.create(resource, upargs):
watchurl = res['created']
currnode = watchurl.split('/')[1]
nodeurls[currnode] = '/' + watchurl