mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Do not allow state where no Galaxy servers are enabled
This commit is contained in:
@@ -903,6 +903,11 @@ def galaxy_validate(serializer, attrs):
|
|||||||
setting_name = '{}{}'.format(prefix, k.upper())
|
setting_name = '{}{}'.format(prefix, k.upper())
|
||||||
errors.setdefault(setting_name, [])
|
errors.setdefault(setting_name, [])
|
||||||
errors[setting_name].append(msg)
|
errors[setting_name].append(msg)
|
||||||
|
if not galaxy_data['url']:
|
||||||
|
if _new_value('PUBLIC_GALAXY_ENABLED') is False:
|
||||||
|
errors.setdefault('PUBLIC_GALAXY_ENABLED', [])
|
||||||
|
msg = _('A URL for Primary Galaxy must be defined before disabling public Galaxy.')
|
||||||
|
errors['PUBLIC_GALAXY_ENABLED'].append(msg)
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
raise serializers.ValidationError(errors)
|
raise serializers.ValidationError(errors)
|
||||||
|
|||||||
@@ -1989,8 +1989,9 @@ class RunProjectUpdate(BaseTask):
|
|||||||
continue
|
continue
|
||||||
env_key = ('ANSIBLE_GALAXY_SERVER_{}_{}'.format(server.get('id', 'unnamed'), key)).upper()
|
env_key = ('ANSIBLE_GALAXY_SERVER_{}_{}'.format(server.get('id', 'unnamed'), key)).upper()
|
||||||
env[env_key] = server[key]
|
env[env_key] = server[key]
|
||||||
# now set the precedence of galaxy servers
|
if galaxy_servers:
|
||||||
env['ANSIBLE_GALAXY_SERVER_LIST'] = ','.join([server.get('id', 'unnamed') for server in galaxy_servers])
|
# now set the precedence of galaxy servers
|
||||||
|
env['ANSIBLE_GALAXY_SERVER_LIST'] = ','.join([server.get('id', 'unnamed') for server in galaxy_servers])
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def _build_scm_url_extra_vars(self, project_update):
|
def _build_scm_url_extra_vars(self, project_update):
|
||||||
|
|||||||
Reference in New Issue
Block a user