From b5ccf9446a2021e125901a1db70589ff91b463c4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 11 May 2020 16:37:21 -0400 Subject: [PATCH] Fix importing task on existing folder Allow deletion of a failed task. --- confluent_server/confluent/core.py | 10 +++++----- confluent_server/confluent/osimage.py | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index 72cc254c..c155356f 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -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]: diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index 39eff8db..41882bdc 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -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