Finish adding settings to UI

This commit is contained in:
AlanCoding
2019-08-26 12:40:43 -04:00
parent d59d8562db
commit 093bf6877b
4 changed files with 35 additions and 14 deletions

View File

@@ -442,47 +442,54 @@ register(
register(
'PRIVATE_GALAXY_URL',
field_class=fields.URLField,
label=_('Private Galaxy Server Host'),
required=False,
allow_blank=True,
label=_('Private Galaxy Server URL'),
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
'The URL of the galaxy instance to connect to, this is required if using a private galaxy server.'),
category=_('Jobs'),
category_slug='jobs',
category_slug='jobs'
)
register(
'PRIVATE_GALAXY_USERNAME',
field_class=fields.CharField,
required=False,
allow_blank=True,
label=_('Private Galaxy Server Username'),
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
'The username to use for basic authentication against the Galaxy instance, '
'this is mutually exclusive with PRIVATE_GALAXY_TOKEN.'),
category=_('Jobs'),
category_slug='jobs',
depends_on=['PRIVATE_GALAXY_URL']
category_slug='jobs'
)
register(
'PRIVATE_GALAXY_PASSWORD',
field_class=fields.CharField,
encrypted=True,
required=False,
allow_blank=True,
label=_('Private Galaxy Server Password'),
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
'The password to use for basic authentication against the Galaxy instance, '
'this is mutually exclusive with PRIVATE_GALAXY_TOKEN.'),
category=_('Jobs'),
category_slug='jobs',
depends_on=['PRIVATE_GALAXY_URL']
category_slug='jobs'
)
register(
'PRIVATE_GALAXY_TOKEN',
field_class=fields.CharField,
encrypted=True,
required=False,
allow_blank=True,
label=_('Private Galaxy Server Token'),
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
'The username to use for basic authentication against the Galaxy instance, '
'The token to use for connecting with the Galaxy instance, '
'this is mutually exclusive with corresponding username and password settings.'),
category=_('Jobs'),
category_slug='jobs',
depends_on=['PRIVATE_GALAXY_URL']
category_slug='jobs'
)
register(

View File

@@ -1883,11 +1883,11 @@ class RunProjectUpdate(BaseTask):
env['TMP'] = settings.AWX_PROOT_BASE_PATH
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
# If private galaxy URL is non-blank, that means this feature is enabled
private_galaxy_url = settings.PRIVATE_GALAXY_URL
if private_galaxy_url:
# set up the fallback server, which is the normal Ansible Galaxy
env['ANSIBLE_GALAXY_SERVER_GALAXY_URL'] = 'https://galaxy.ansible.com'
env['ANSIBLE_GALAXY_SERVER_PRIVATE_GALAXY_URL'] = private_galaxy_url
for key in ('url', 'username', 'password', 'token'):
setting_name = 'PRIVATE_GALAXY_{}'.format(key.upper())
value = getattr(settings, setting_name)