mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Add warnings when installing container type roles
This commit is contained in:
parent
7b2f15453d
commit
77de83730d
3 changed files with 29 additions and 15 deletions
|
@ -91,7 +91,8 @@ class GalaxyAPI(object):
|
||||||
headers = self.__auth_header()
|
headers = self.__auth_header()
|
||||||
try:
|
try:
|
||||||
display.vvv(url)
|
display.vvv(url)
|
||||||
resp = open_url(url, data=args, validate_certs=self._validate_certs, headers=headers, method=method)
|
resp = open_url(url, data=args, validate_certs=self._validate_certs, headers=headers, method=method,
|
||||||
|
timeout=20)
|
||||||
data = json.load(resp)
|
data = json.load(resp)
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
res = json.load(e)
|
res = json.load(e)
|
||||||
|
|
|
@ -18,18 +18,21 @@ galaxy_info:
|
||||||
|
|
||||||
min_ansible_version: {{ min_ansible_version }}
|
min_ansible_version: {{ min_ansible_version }}
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
# repo for this role. During role install, if no tags are available,
|
# repo for this role. During role install, if no tags are available,
|
||||||
# Galaxy will use this branch. During import Galaxy will access files on
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
# this branch. If travis integration is cofigured, only notification for this
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
# (usually master) will be used.
|
# (usually master) will be used.
|
||||||
#github_branch:
|
#github_branch:
|
||||||
|
|
||||||
#
|
#
|
||||||
# Below are all platforms currently available. Just uncomment
|
# Below are all platforms currently available. Just uncomment the ones that apply
|
||||||
# the ones that apply to your role. If you don't see your
|
# to your role. If you don't see your platform on this list, let us know,
|
||||||
# platform on this list, let us know and we'll get it added!
|
# and we'll get it added!
|
||||||
#
|
#
|
||||||
#platforms:
|
#platforms:
|
||||||
{%- for platform,versions in platforms.items() %}
|
{%- for platform,versions in platforms.items() %}
|
||||||
|
@ -42,18 +45,16 @@ galaxy_info:
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
galaxy_tags: []
|
galaxy_tags: []
|
||||||
# List tags for your role here, one per line. A tag is
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
# a keyword that describes and categorizes the role.
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
# Users find roles by searching for tags. Be sure to
|
# remove the '[]' above, if you add tags to this list.
|
||||||
# remove the '[]' above if you add tags to this list.
|
|
||||||
#
|
#
|
||||||
# NOTE: A tag is limited to a single word comprised of
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
# alphanumeric characters. Maximum 20 tags per role.
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
dependencies: []
|
dependencies: []
|
||||||
# List your role dependencies here, one per line.
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
# Be sure to remove the '[]' above if you add dependencies
|
# if you add dependencies to this list.
|
||||||
# to this list.
|
|
||||||
{%- for dependency in dependencies %}
|
{%- for dependency in dependencies %}
|
||||||
#- {{ dependency }}
|
#- {{ dependency }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
|
@ -49,7 +49,6 @@ class GalaxyRole(object):
|
||||||
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')
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, galaxy, name, src=None, version=None, scm=None, path=None):
|
def __init__(self, galaxy, name, src=None, version=None, scm=None, path=None):
|
||||||
|
|
||||||
self._metadata = None
|
self._metadata = None
|
||||||
|
@ -83,6 +82,7 @@ class GalaxyRole(object):
|
||||||
self.paths = [x for x in galaxy.roles_paths]
|
self.paths = [x for x in galaxy.roles_paths]
|
||||||
self.paths = [os.path.join(x, self.name) for x in self.paths]
|
self.paths = [os.path.join(x, self.name) for x in self.paths]
|
||||||
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.name == other.name
|
return self.name == other.name
|
||||||
|
|
||||||
|
@ -136,6 +136,8 @@ class GalaxyRole(object):
|
||||||
version=self.version,
|
version=self.version,
|
||||||
install_date=datetime.datetime.utcnow().strftime("%c"),
|
install_date=datetime.datetime.utcnow().strftime("%c"),
|
||||||
)
|
)
|
||||||
|
if not os.path.exists(os.path.join(self.path, 'meta')):
|
||||||
|
os.makedirs(os.path.join(self.path, 'meta'))
|
||||||
info_path = os.path.join(self.path, self.META_INSTALL)
|
info_path = os.path.join(self.path, self.META_INSTALL)
|
||||||
with open(info_path, 'w+') as f:
|
with open(info_path, 'w+') as f:
|
||||||
try:
|
try:
|
||||||
|
@ -210,6 +212,16 @@ class GalaxyRole(object):
|
||||||
if not role_data:
|
if not role_data:
|
||||||
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server))
|
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server))
|
||||||
|
|
||||||
|
if role_data.get('role_type') == 'CON':
|
||||||
|
# Container Enabled
|
||||||
|
display.warning("%s is a Container Enabled role and should only be installed using "
|
||||||
|
"Ansible Container" % self.name)
|
||||||
|
|
||||||
|
if role_data.get('role_type') == 'APP':
|
||||||
|
# Container Role
|
||||||
|
display.warning("%s is a Container App role and should only be installed using Ansible "
|
||||||
|
"Container" % self.name)
|
||||||
|
|
||||||
role_versions = api.fetch_role_related('versions', role_data['id'])
|
role_versions = api.fetch_role_related('versions', role_data['id'])
|
||||||
if not self.version:
|
if not self.version:
|
||||||
# convert the version names to LooseVersion objects
|
# convert the version names to LooseVersion objects
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue