Skip to content

Commit

Permalink
Import container.yml as YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Houseknecht committed Jun 3, 2018
1 parent 4529144 commit 7052cb8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions galaxy/importer/loaders/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ def load(self):

description = data.pop('description')

data['role_type'] = self._get_role_type(
galaxy_info, container_yml_type)
data['role_type'] = self._get_role_type(galaxy_info, container_yml_type)
data['tags'] = meta_parser.parse_tags()
data['platforms'] = meta_parser.parse_platforms()
data['cloud_platforms'] = meta_parser.parse_cloud_platforms()
Expand Down Expand Up @@ -322,18 +321,18 @@ def _load_container_yml(self):
if os.path.exists(container_meta_file):
container_yml_type = self.CONTAINER_META_FILE
with open(container_meta_file) as fp:
container_yml = fp.read()
container_yml = yaml.safe_load(fp)

ansible_container_meta_file = os.path.join(
self.path, self.ANSIBLE_CONTAINER_META_FILE)
if os.path.exists(ansible_container_meta_file):
if container_yml_type is not None:
raise exc.ContentLoadError(
'Found container.yml and meta/container.yml. '
'A role can only have only one container.yml file.')
'A role can have only one container.yml file.')
container_yml_type = self.ANSIBLE_CONTAINER_META_FILE
with open(ansible_container_meta_file) as fp:
container_yml = fp.read()
container_yml = yaml.safe_load(fp)

return container_yml_type, container_yml

Expand Down

0 comments on commit 7052cb8

Please sign in to comment.