mirror of
https://github.com/xcat2/confluent.git
synced 2026-06-19 01:50:46 +00:00
Provide support for removing update
This allows for cancelling and cleanup after reporting.
This commit is contained in:
@@ -53,12 +53,31 @@ class Updater(object):
|
||||
self.percent = float(progress['progress'])
|
||||
self.detail = progress.get('detail', '')
|
||||
|
||||
def cancel(self):
|
||||
self.updateproc.kill()
|
||||
|
||||
@property
|
||||
def progress(self):
|
||||
return {'phase': self.phase, 'progress': self.percent,
|
||||
'detail': self.detail}
|
||||
|
||||
|
||||
def remove_updates(nodes, tenant, element):
|
||||
if len(element) < 5:
|
||||
raise exc.InvalidArgumentException()
|
||||
upid = element[-1]
|
||||
for node in nodes:
|
||||
try:
|
||||
upd = updatesbytarget[(node, tenant)][upid]
|
||||
except KeyError:
|
||||
raise exc.NotFoundException('No active update matches request')
|
||||
upd.cancel()
|
||||
del updatesbytarget[(node, tenant)][upid]
|
||||
yield msg.DeletedResource(
|
||||
'nodes/{0}/inventory/firmware/updates/active/{1}'.format(
|
||||
node, upid))
|
||||
|
||||
|
||||
def list_updates(nodes, tenant, element):
|
||||
showmode = False
|
||||
if len(element) > 4:
|
||||
|
||||
@@ -984,5 +984,8 @@ def retrieve(nodes, element, configmanager, inputdata):
|
||||
|
||||
def delete(nodes, element, configmanager, inputdata):
|
||||
initthread()
|
||||
if '/'.join(element).startswith('inventory/firmware/updates/active'):
|
||||
return firmwaremanager.remove_updates(nodes, configmanager.tenant,
|
||||
element)
|
||||
return perform_requests(
|
||||
'delete', nodes, element, configmanager, inputdata)
|
||||
|
||||
Reference in New Issue
Block a user