1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

framework/output: Fix checking artifact kind

Don't construct an ArtifactType in Output.Add_artifact, the Artifact
class does that for us.

Next, fix the use of a nonexistent attribute Artifact.valid_kinds
This commit is contained in:
Brendan Jackman 2017-12-06 15:20:24 +00:00 committed by marcbonnici
parent fd7ae4b95b
commit b5ac669994

View File

@ -85,9 +85,6 @@ class Output(object):
raise HostError(msg.format(path))
path = os.path.relpath(path, self.basepath)
if isinstance(kind, basestring):
kind = ArtifactType(kind)
self.result.add_artifact(name, path, kind, description, classifiers)
def add_event(self, message):
@ -276,7 +273,8 @@ class Result(object):
)
ArtifactType = enum(['log', 'meta', 'data', 'export', 'raw'])
ARTIFACT_TYPES = ['log', 'meta', 'data', 'export', 'raw']
ArtifactType = enum(ARTIFACT_TYPES)
class Artifact(object):
@ -356,7 +354,7 @@ class Artifact(object):
self.kind = ArtifactType(kind)
except ValueError:
msg = 'Invalid Artifact kind: {}; must be in {}'
raise ValueError(msg.format(kind, self.valid_kinds))
raise ValueError(msg.format(kind, ARTIFACT_TYPES))
self.description = description
self.classifiers = classifiers or {}