Remove invalid type link from runtime conf dir at proper time.

This commit is contained in:
Darko Poljak 2017-11-02 17:54:14 +01:00
parent c14f3b68f4
commit 782e662a13

View file

@ -55,7 +55,6 @@ class CdistType(object):
self.path = self.name self.path = self.name
self.absolute_path = os.path.join(self.base_path, self.path) self.absolute_path = os.path.join(self.base_path, self.path)
if not os.path.isdir(self.absolute_path): if not os.path.isdir(self.absolute_path):
os.remove(self.absolute_path)
raise InvalidTypeError(self.name, self.path, self.absolute_path) raise InvalidTypeError(self.name, self.path, self.absolute_path)
self.manifest_path = os.path.join(self.name, "manifest") self.manifest_path = os.path.join(self.name, "manifest")
self.explorer_path = os.path.join(self.name, "explorer") self.explorer_path = os.path.join(self.name, "explorer")
@ -83,6 +82,9 @@ class CdistType(object):
except InvalidTypeError as e: except InvalidTypeError as e:
# ignore invalid type, log warning and continue # ignore invalid type, log warning and continue
cls.log.warning(e) cls.log.warning(e)
# remove invalid from runtime conf dir
absolute_path = os.path.join(base_path, name)
os.remove(absolute_path)
@classmethod @classmethod
def list_type_names(cls, base_path): def list_type_names(cls, base_path):