Skip to content

Conversation

@blarghmatey
Copy link
Contributor

Being able to specify the user to run django commands as can help to prevent permissions issues from cropping up, such as when compiling static assets or migrating a sqlite database which are then owned by root.

What does this PR do?

Adds the runas parameter to the django.command and django.collectstatic functions for specifying the user to execute commands as.

What issues does this PR fix or reference?

N/A

Previous Behavior

All django commands would be executed by whichever user the salt daemon is being executed as.

New Behavior

Django commands can be run as an arbitrary user to avoid permissions issues

Tests written?

No

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@rallytime
Copy link
Contributor

Thanks for this @blarghmatey - It looks like there are some related test failures here: https://jenkins.saltstack.com/job/PR/job/salt-pr-linode-cent7-py3/1424/#showFailuresLink

unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_collectstatic
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_command
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_command_with_args
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_command_with_kwargs
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_command_with_kwargs_ignore_dunder
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_createsuperuser
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_syncdb
unit.modules.test_djangomod.DjangomodCliCommandTestCase.test_django_admin_cli_syncdb_migrate

Can you take a look?

Being able to specify the user to run django commands as can help to prevent permissions issues from cropping up, such as when compiling static assets or migrating a sqlite database which are then owned by root.
@blarghmatey
Copy link
Contributor Author

@rallytime it looks like I've resolved all of the Django related failures in this PR. Let me know if there is anything else that you need me to address before this can get merged. Thanks!

@rallytime rallytime merged commit 907c179 into saltstack:develop Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants