2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-12-24 12:11:52 +00:00

Fix importing task on existing folder

Allow deletion of a failed task.
This commit is contained in:
Jarrod Johnson 2020-05-11 16:37:21 -04:00
parent 807c68890d
commit b5ccf9446a
2 changed files with 7 additions and 6 deletions

View File

@ -144,19 +144,19 @@ class PluginCollection(object):
def handle_deployment(configmanager, inputdata, pathcomponents,
operation):
if len(pathcomponents) == 1:
yield msg.ChildCollection('distributions')
yield msg.ChildCollection('profiles')
yield msg.ChildCollection('importing')
yield msg.ChildCollection('distributions/')
yield msg.ChildCollection('profiles/')
yield msg.ChildCollection('importing/')
return
if pathcomponents[1] == 'distributions':
if len(pathcomponents) == 2:
for dist in osimage.list_distros():
yield msg.ChildCollection(dist)
yield msg.ChildCollection(dist + '/')
return
if pathcomponents[1] == 'profiles':
if len(pathcomponents) == 2:
for prof in osimage.list_profiles():
yield msg.ChildCollection(prof)
yield msg.ChildCollection(prof + '/')
return
if pathcomponents[1] == 'importing':
if len(pathcomponents) == 2 or not pathcomponents[-1]:

View File

@ -315,6 +315,7 @@ importing = {}
class MediaImporter(object):
def __init__(self, media):
self.worker = None
identity = fingerprint(media)
self.percent = 0.0
identity, _ = identity
@ -342,7 +343,7 @@ class MediaImporter(object):
self.profiles = []
def stop(self):
if self.worker.poll() is None:
if self.worker and self.worker.poll() is None:
self.worker.kill()
@property