mirror of
https://github.com/xcat2/confluent.git
synced 2025-04-13 16:57:59 +00:00
Merge branch 'master' of github.com:jjohnson42/confluent
This commit is contained in:
commit
d1bafa98bb
@ -460,7 +460,7 @@ def createresource(args):
|
||||
if keydata is None:
|
||||
return
|
||||
targpath = fullpath_target(resname)
|
||||
if targpath.startswitch('/noderange//'):
|
||||
if targpath.startswith('/noderange//'):
|
||||
collection = targpath
|
||||
else:
|
||||
collection, _, resname = targpath.rpartition('/')
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@ nodefirmware(8) -- Report firmware information on confluent nodes
|
||||
## SYNOPSIS
|
||||
|
||||
`nodefirmware <noderange>`
|
||||
`nodefirmware <noderange> update <filename>`
|
||||
`nodefirmware <noderange> update [--backup] <filename>`
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
|
@ -26,7 +26,8 @@ updatesbytarget = {}
|
||||
|
||||
def execupdate(handler, filename, updateobj):
|
||||
try:
|
||||
completion = handler(filename, progress=updateobj.handle_progress)
|
||||
completion = handler(filename, progress=updateobj.handle_progress,
|
||||
bank=updateobj.bank)
|
||||
if completion is None:
|
||||
completion = 'complete'
|
||||
updateobj.handle_progress({'phase': completion, 'progress': 100.0})
|
||||
@ -35,7 +36,9 @@ def execupdate(handler, filename, updateobj):
|
||||
'detail': str(e)})
|
||||
|
||||
class Updater(object):
|
||||
def __init__(self, node, handler, filename, tenant=None, name=None):
|
||||
def __init__(self, node, handler, filename, tenant=None, name=None,
|
||||
bank=None):
|
||||
self.bank = bank
|
||||
self.node = node
|
||||
self.phase = 'initializing'
|
||||
self.detail = ''
|
||||
|
@ -399,6 +399,7 @@ class InputFirmwareUpdate(ConfluentMessage):
|
||||
|
||||
def __init__(self, path, nodes, inputdata):
|
||||
self.filename = inputdata['filename']
|
||||
self.bank = inputdata.get('bank', None)
|
||||
self.nodes = nodes
|
||||
|
||||
|
||||
|
@ -455,7 +455,8 @@ class IpmiHandler(object):
|
||||
|
||||
def handle_update(self):
|
||||
u = firmwaremanager.Updater(self.node, self.ipmicmd.update_firmware,
|
||||
self.inputdata.filename, self.tenant)
|
||||
self.inputdata.filename, self.tenant,
|
||||
bank=self.inputdata.bank)
|
||||
self.output.put(
|
||||
msg.CreatedResource(
|
||||
'nodes/{0}/inventory/firmware/updates/active/{1}'.format(
|
||||
|
Loading…
x
Reference in New Issue
Block a user