mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Add UI toggle to disable public Galaxy (#3867)
This commit is contained in:
parent
d06b0de74b
commit
b2b33605cc
@ -513,6 +513,16 @@ register(
|
||||
category_slug='jobs'
|
||||
)
|
||||
|
||||
register(
|
||||
'PUBLIC_GALAXY_ENABLED',
|
||||
field_class=fields.BooleanField,
|
||||
default=True,
|
||||
label=_('Allow Access to Public Galaxy'),
|
||||
help_text=_('Allow or deny access to the public Ansible Galaxy during project updates.'),
|
||||
category=_('Jobs'),
|
||||
category_slug='jobs'
|
||||
)
|
||||
|
||||
register(
|
||||
'STDOUT_MAX_BYTES_DISPLAY',
|
||||
field_class=fields.IntegerField,
|
||||
|
@ -12,10 +12,12 @@ class UriCleaner(object):
|
||||
|
||||
@staticmethod
|
||||
def remove_sensitive(cleartext):
|
||||
# exclude_list contains the items that will _not_ be redacted
|
||||
exclude_list = [settings.PUBLIC_GALAXY_SERVER['url']]
|
||||
if settings.PRIMARY_GALAXY_URL:
|
||||
exclude_list = [settings.PRIMARY_GALAXY_URL] + [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
||||
else:
|
||||
exclude_list = [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
||||
exclude_list += [settings.PRIMARY_GALAXY_URL]
|
||||
if settings.FALLBACK_GALAXY_SERVERS:
|
||||
exclude_list += [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
||||
redactedtext = cleartext
|
||||
text_index = 0
|
||||
while True:
|
||||
|
@ -1959,9 +1959,15 @@ class RunProjectUpdate(BaseTask):
|
||||
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
||||
env['ANSIBLE_GALAXY_IGNORE'] = True
|
||||
# Set up the fallback server, which is the normal Ansible Galaxy by default
|
||||
galaxy_servers = list(settings.FALLBACK_GALAXY_SERVERS)
|
||||
# If private galaxy URL is non-blank, that means this feature is enabled
|
||||
# Set up the public Galaxy server, if enabled
|
||||
if settings.PUBLIC_GALAXY_ENABLED:
|
||||
galaxy_servers = [settings.PUBLIC_GALAXY_SERVER]
|
||||
else:
|
||||
galaxy_servers = []
|
||||
# Set up fallback Galaxy servers, if configured
|
||||
if settings.FALLBACK_GALAXY_SERVERS:
|
||||
galaxy_servers = settings.FALLBACK_GALAXY_SERVERS + galaxy_servers
|
||||
# Set up the primary Galaxy server, if configured
|
||||
if settings.PRIMARY_GALAXY_URL:
|
||||
galaxy_servers = [{'id': 'primary_galaxy'}] + galaxy_servers
|
||||
for key in GALAXY_SERVER_FIELDS:
|
||||
|
@ -635,16 +635,18 @@ PRIMARY_GALAXY_USERNAME = ''
|
||||
PRIMARY_GALAXY_TOKEN = ''
|
||||
PRIMARY_GALAXY_PASSWORD = ''
|
||||
PRIMARY_GALAXY_AUTH_URL = ''
|
||||
# Settings for the fallback galaxy server(s), normally this is the
|
||||
# actual Ansible Galaxy site.
|
||||
# server options: 'id', 'url', 'username', 'password', 'token', 'auth_url'
|
||||
# To not use any fallback servers set this to []
|
||||
FALLBACK_GALAXY_SERVERS = [
|
||||
{
|
||||
'id': 'galaxy',
|
||||
'url': 'https://galaxy.ansible.com'
|
||||
}
|
||||
]
|
||||
|
||||
# Settings for the public galaxy server(s).
|
||||
PUBLIC_GALAXY_ENABLED = True
|
||||
PUBLIC_GALAXY_SERVER = {
|
||||
'id': 'galaxy',
|
||||
'url': 'https://galaxy.ansible.com'
|
||||
}
|
||||
|
||||
# List of dicts of fallback (additional) Galaxy servers. If configured, these
|
||||
# will be higher precedence than public Galaxy, but lower than primary Galaxy.
|
||||
# Available options: 'id', 'url', 'username', 'password', 'token', 'auth_url'
|
||||
FALLBACK_GALAXY_SERVERS = []
|
||||
|
||||
# Enable bubblewrap support for running jobs (playbook runs only).
|
||||
# Note: This setting may be overridden by database settings.
|
||||
|
@ -89,6 +89,9 @@ export default ['i18n', function(i18n) {
|
||||
type: 'text',
|
||||
reset: 'PRIMARY_GALAXY_AUTH_URL',
|
||||
},
|
||||
PUBLIC_GALAXY_ENABLED: {
|
||||
type: 'toggleSwitch',
|
||||
},
|
||||
AWX_TASK_ENV: {
|
||||
type: 'textarea',
|
||||
reset: 'AWX_TASK_ENV',
|
||||
|
Loading…
Reference in New Issue
Block a user