Merge pull request #7120 from fherbert/playbook_symlinks

Add option to follow symlinks when scanning for playbooks

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-05-26 22:26:49 +00:00 committed by GitHub
commit 1b1a93dd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View File

@ -423,6 +423,19 @@ register(
category_slug='jobs',
)
register(
'AWX_SHOW_PLAYBOOK_LINKS',
field_class=fields.BooleanField,
default=False,
label=_('Follow symlinks'),
help_text=_(
'Follow symbolic links when scanning for playbooks. Be aware that setting this to True can lead '
'to infinite recursion if a link points to a parent directory of itself.'
),
category=_('Jobs'),
category_slug='jobs',
)
register(
'PRIMARY_GALAXY_URL',
field_class=fields.URLField,

View File

@ -199,7 +199,7 @@ class ProjectOptions(models.Model):
results = []
project_path = self.get_project_path()
if project_path:
for dirpath, dirnames, filenames in os.walk(smart_str(project_path)):
for dirpath, dirnames, filenames in os.walk(smart_str(project_path, followlinks=settings.AWX_SHOW_PLAYBOOK_LINKS)):
if skip_directory(dirpath):
continue
for filename in filenames:

View File

@ -563,6 +563,9 @@ AWX_ROLES_ENABLED = True
# Note: This setting may be overridden by database settings.
AWX_COLLECTIONS_ENABLED = True
# Follow symlinks when scanning for playbooks
AWX_SHOW_PLAYBOOK_LINKS = False
# Settings for primary galaxy server, should be set in the UI
PRIMARY_GALAXY_URL = ''
PRIMARY_GALAXY_USERNAME = ''

View File

@ -71,6 +71,9 @@ export default ['i18n', function(i18n) {
AWX_COLLECTIONS_ENABLED: {
type: 'toggleSwitch',
},
AWX_SHOW_PLAYBOOK_LINKS: {
type: 'toggleSwitch',
},
PRIMARY_GALAXY_URL: {
type: 'text',
reset: 'PRIMARY_GALAXY_URL',