mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Support .yaml extension for meta file (#46505)
This commit is contained in:
parent
880762e07e
commit
e4cadddd70
1 changed files with 23 additions and 21 deletions
|
@ -47,7 +47,7 @@ except ImportError:
|
||||||
class GalaxyRole(object):
|
class GalaxyRole(object):
|
||||||
|
|
||||||
SUPPORTED_SCMS = set(['git', 'hg'])
|
SUPPORTED_SCMS = set(['git', 'hg'])
|
||||||
META_MAIN = os.path.join('meta', 'main.yml')
|
META_MAIN = (os.path.join('meta', 'main.yml'), os.path.join('meta', 'main.yaml'))
|
||||||
META_INSTALL = os.path.join('meta', '.galaxy_install_info')
|
META_INSTALL = os.path.join('meta', '.galaxy_install_info')
|
||||||
ROLE_DIRS = ('defaults', 'files', 'handlers', 'meta', 'tasks', 'templates', 'vars', 'tests')
|
ROLE_DIRS = ('defaults', 'files', 'handlers', 'meta', 'tasks', 'templates', 'vars', 'tests')
|
||||||
|
|
||||||
|
@ -97,7 +97,8 @@ class GalaxyRole(object):
|
||||||
Returns role metadata
|
Returns role metadata
|
||||||
"""
|
"""
|
||||||
if self._metadata is None:
|
if self._metadata is None:
|
||||||
meta_path = os.path.join(self.path, self.META_MAIN)
|
for meta_main in self.META_MAIN:
|
||||||
|
meta_path = os.path.join(self.path, meta_main)
|
||||||
if os.path.isfile(meta_path):
|
if os.path.isfile(meta_path):
|
||||||
try:
|
try:
|
||||||
f = open(meta_path, 'r')
|
f = open(meta_path, 'r')
|
||||||
|
@ -269,7 +270,8 @@ class GalaxyRole(object):
|
||||||
members = role_tar_file.getmembers()
|
members = role_tar_file.getmembers()
|
||||||
# next find the metadata file
|
# next find the metadata file
|
||||||
for member in members:
|
for member in members:
|
||||||
if self.META_MAIN in member.name:
|
for meta_main in self.META_MAIN:
|
||||||
|
if meta_main in member.name:
|
||||||
# Look for parent of meta/main.yml
|
# Look for parent of meta/main.yml
|
||||||
# Due to possibility of sub roles each containing meta/main.yml
|
# Due to possibility of sub roles each containing meta/main.yml
|
||||||
# look for shortest length parent
|
# look for shortest length parent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue