Skip to content

Commit

Permalink
duplicate file name to test item
Browse files Browse the repository at this point in the history
  • Loading branch information
jscotka committed May 31, 2018
1 parent 6ccd469 commit a5c8249
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions colin/checks/dockerfile.py.fmf
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
description: "asdasdsfdasfsda f"

/FromTagNotLatestCheck:
test: "dockerfile.py"
name: "from_tag_not_latest"
message: "In FROM, tag has to be specified and not 'latest'."
description: "Using the 'latest' tag may cause unpredictable builds. It is recommended that a specific tag is used in the FROM."
reference_url: "https://fedoraproject.org/wiki/Container:Guidelines#FROM"
tags: ["from", "dockerfile", "baseimage", "latest"]

/MaintainerDeprecatedCheck:
test: "dockerfile.py"
name: "maintainer_deprecated"
message: "Dockerfile instruction `MAINTAINER` is deprecated."
description: "Replace with label 'maintainer'."
Expand Down
6 changes: 2 additions & 4 deletions colin/core/checks/abstract_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ class AbstractCheck(object):
def _get_fmf_metadata(self):
output = {}
classfile = inspect.getfile(self.__class__)
unique_identifier = os.path.join(os.path.basename(classfile), self.__class__.__name__)

fmf_tree = fmf.Tree(os.path.dirname(classfile))
items = [x for x in fmf_tree.prune(names=[unique_identifier]) if x]
items = [x for x in fmf_tree.prune(names=[self.__class__.__name__], filters=["test:%s" % os.path.basename(classfile)]) if x]
if len(items) == 1:
output = items[0].data
elif len(items) > 1:
raise Exception("There is more FMF test metadata named: %s" % unique_identifier)
raise Exception("There is more FMF test metadata for item: %s" % self.__class__)
return output

def _set_fmf_metadata(self, metadata_dict):
Expand Down

0 comments on commit a5c8249

Please sign in to comment.