mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +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'
|
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(
|
register(
|
||||||
'STDOUT_MAX_BYTES_DISPLAY',
|
'STDOUT_MAX_BYTES_DISPLAY',
|
||||||
field_class=fields.IntegerField,
|
field_class=fields.IntegerField,
|
||||||
|
@ -12,10 +12,12 @@ class UriCleaner(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_sensitive(cleartext):
|
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:
|
if settings.PRIMARY_GALAXY_URL:
|
||||||
exclude_list = [settings.PRIMARY_GALAXY_URL] + [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
exclude_list += [settings.PRIMARY_GALAXY_URL]
|
||||||
else:
|
if settings.FALLBACK_GALAXY_SERVERS:
|
||||||
exclude_list = [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
exclude_list += [server['url'] for server in settings.FALLBACK_GALAXY_SERVERS]
|
||||||
redactedtext = cleartext
|
redactedtext = cleartext
|
||||||
text_index = 0
|
text_index = 0
|
||||||
while True:
|
while True:
|
||||||
|
@ -1959,9 +1959,15 @@ class RunProjectUpdate(BaseTask):
|
|||||||
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
||||||
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
||||||
env['ANSIBLE_GALAXY_IGNORE'] = True
|
env['ANSIBLE_GALAXY_IGNORE'] = True
|
||||||
# Set up the fallback server, which is the normal Ansible Galaxy by default
|
# Set up the public Galaxy server, if enabled
|
||||||
galaxy_servers = list(settings.FALLBACK_GALAXY_SERVERS)
|
if settings.PUBLIC_GALAXY_ENABLED:
|
||||||
# If private galaxy URL is non-blank, that means this feature is 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:
|
if settings.PRIMARY_GALAXY_URL:
|
||||||
galaxy_servers = [{'id': 'primary_galaxy'}] + galaxy_servers
|
galaxy_servers = [{'id': 'primary_galaxy'}] + galaxy_servers
|
||||||
for key in GALAXY_SERVER_FIELDS:
|
for key in GALAXY_SERVER_FIELDS:
|
||||||
|
@ -635,16 +635,18 @@ PRIMARY_GALAXY_USERNAME = ''
|
|||||||
PRIMARY_GALAXY_TOKEN = ''
|
PRIMARY_GALAXY_TOKEN = ''
|
||||||
PRIMARY_GALAXY_PASSWORD = ''
|
PRIMARY_GALAXY_PASSWORD = ''
|
||||||
PRIMARY_GALAXY_AUTH_URL = ''
|
PRIMARY_GALAXY_AUTH_URL = ''
|
||||||
# Settings for the fallback galaxy server(s), normally this is the
|
|
||||||
# actual Ansible Galaxy site.
|
# Settings for the public galaxy server(s).
|
||||||
# server options: 'id', 'url', 'username', 'password', 'token', 'auth_url'
|
PUBLIC_GALAXY_ENABLED = True
|
||||||
# To not use any fallback servers set this to []
|
PUBLIC_GALAXY_SERVER = {
|
||||||
FALLBACK_GALAXY_SERVERS = [
|
'id': 'galaxy',
|
||||||
{
|
'url': 'https://galaxy.ansible.com'
|
||||||
'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).
|
# Enable bubblewrap support for running jobs (playbook runs only).
|
||||||
# Note: This setting may be overridden by database settings.
|
# Note: This setting may be overridden by database settings.
|
||||||
|
@ -89,6 +89,9 @@ export default ['i18n', function(i18n) {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
reset: 'PRIMARY_GALAXY_AUTH_URL',
|
reset: 'PRIMARY_GALAXY_AUTH_URL',
|
||||||
},
|
},
|
||||||
|
PUBLIC_GALAXY_ENABLED: {
|
||||||
|
type: 'toggleSwitch',
|
||||||
|
},
|
||||||
AWX_TASK_ENV: {
|
AWX_TASK_ENV: {
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
reset: 'AWX_TASK_ENV',
|
reset: 'AWX_TASK_ENV',
|
||||||
|
Loading…
Reference in New Issue
Block a user