From af986c28fc09c19e18262c74a64ffc7e5e87ff97 Mon Sep 17 00:00:00 2001 From: adrian-turjak Date: Wed, 17 May 2017 12:25:45 +1200 Subject: [PATCH] Renaming StackTask to Adjutant * This patch is just a search and replace with minor tweaks. * No functional changes, just renaming. Change-Id: I103790be7c0cd9234545e25e21ab1768cb5eb131 --- .gitignore | 2 +- DEVSTACK_GUIDE.md | 74 +++++++++---------- MANIFEST.in | 6 +- README.md | 12 +-- {stacktask => adjutant}/__init__.py | 4 +- {stacktask => adjutant}/actions/__init__.py | 0 .../actions/migrations/0001_initial.py | 0 .../migrations/0002_action_auto_approve.py | 0 .../actions/migrations/__init__.py | 0 {stacktask => adjutant}/actions/models.py | 0 .../actions/openstack_clients.py | 0 {stacktask => adjutant}/actions/user_store.py | 0 {stacktask => adjutant}/actions/utils.py | 4 +- adjutant/actions/v1/__init__.py | 1 + {stacktask => adjutant}/actions/v1/app.py | 2 +- {stacktask => adjutant}/actions/v1/base.py | 6 +- {stacktask => adjutant}/actions/v1/misc.py | 6 +- {stacktask => adjutant}/actions/v1/models.py | 10 +-- .../actions/v1/projects.py | 4 +- .../actions/v1/resources.py | 4 +- .../actions/v1/serializers.py | 0 .../actions/v1/tests/__init__.py | 0 .../actions/v1/tests/test_project_actions.py | 12 +-- .../actions/v1/tests/test_resource_actions.py | 18 ++--- .../actions/v1/tests/test_user_actions.py | 14 ++-- {stacktask => adjutant}/actions/v1/users.py | 4 +- {stacktask => adjutant}/api/__init__.py | 0 .../api/migrations/0001_initial.py | 6 +- .../api/migrations/0002_auto_20160815_2249.py | 0 .../api/migrations/0003_task_approved_by.py | 0 .../api/migrations/0004_auto_20160929_0317.py | 0 .../api/migrations/__init__.py | 0 {stacktask => adjutant}/api/models.py | 0 {stacktask => adjutant}/api/urls.py | 4 +- {stacktask => adjutant}/api/utils.py | 0 adjutant/api/v1/__init__.py | 1 + {stacktask => adjutant}/api/v1/app.py | 2 +- {stacktask => adjutant}/api/v1/models.py | 4 +- {stacktask => adjutant}/api/v1/openstack.py | 10 +-- {stacktask => adjutant}/api/v1/tasks.py | 12 +-- .../api/v1/templates/completed.txt | 0 .../v1/templates/email_update_completed.txt | 0 .../api/v1/templates/email_update_started.txt | 0 .../api/v1/templates/email_update_token.txt | 0 .../api/v1/templates/initial.txt | 0 .../templates/initial_password_completed.txt | 0 .../v1/templates/initial_password_token.txt | 0 .../v1/templates/invite_user_completed.txt | 0 .../api/v1/templates/invite_user_token.txt | 0 .../v1/templates/password_reset_completed.txt | 0 .../api/v1/templates/password_reset_token.txt | 0 .../api/v1/templates/signup_completed.txt | 0 .../api/v1/templates/signup_initial.txt | 0 .../api/v1/templates/signup_token.txt | 0 .../api/v1/templates/token.txt | 2 +- .../api/v1/tests/__init__.py | 12 +-- .../api/v1/tests/test_api_admin.py | 8 +- .../api/v1/tests/test_api_openstack.py | 6 +- .../api/v1/tests/test_api_taskview.py | 14 ++-- {stacktask => adjutant}/api/v1/urls.py | 2 +- {stacktask => adjutant}/api/v1/utils.py | 4 +- {stacktask => adjutant}/api/v1/views.py | 8 +- {stacktask => adjutant}/exceptions.py | 0 {stacktask => adjutant}/middleware.py | 2 +- .../notifications/__init__.py | 0 .../notifications/migrations/__init__.py | 0 .../notifications/models.py | 4 +- .../notifications/request_tracker/__init__.py | 0 .../request_tracker/migrations/__init__.py | 0 .../notifications/request_tracker/models.py | 4 +- .../notifications/templates/notification.txt | 2 +- {stacktask => adjutant}/settings.py | 30 ++++---- adjutant/startup/__init__.py | 1 + {stacktask => adjutant}/startup/checks.py | 4 +- {stacktask => adjutant}/startup/models.py | 0 {stacktask => adjutant}/test_settings.py | 6 +- {stacktask => adjutant}/urls.py | 2 +- {stacktask => adjutant}/utils.py | 0 {stacktask => adjutant}/wsgi.py | 4 +- conf/conf.yaml | 8 +- .../{stacktask.triggers => adjutant.triggers} | 0 debian/changelog | 5 +- debian/control | 4 +- package_readme.rst | 12 +-- setup.py | 8 +- stacktask/actions/v1/__init__.py | 1 - stacktask/api/v1/__init__.py | 1 - stacktask/startup/__init__.py | 1 - tox.ini | 4 +- 89 files changed, 190 insertions(+), 191 deletions(-) rename {stacktask => adjutant}/__init__.py (84%) rename {stacktask => adjutant}/actions/__init__.py (100%) rename {stacktask => adjutant}/actions/migrations/0001_initial.py (100%) rename {stacktask => adjutant}/actions/migrations/0002_action_auto_approve.py (100%) rename {stacktask => adjutant}/actions/migrations/__init__.py (100%) rename {stacktask => adjutant}/actions/models.py (100%) rename {stacktask => adjutant}/actions/openstack_clients.py (100%) rename {stacktask => adjutant}/actions/user_store.py (100%) rename {stacktask => adjutant}/actions/utils.py (96%) create mode 100644 adjutant/actions/v1/__init__.py rename {stacktask => adjutant}/actions/v1/app.py (73%) rename {stacktask => adjutant}/actions/v1/base.py (99%) rename {stacktask => adjutant}/actions/v1/misc.py (96%) rename {stacktask => adjutant}/actions/v1/models.py (90%) rename {stacktask => adjutant}/actions/v1/projects.py (99%) rename {stacktask => adjutant}/actions/v1/resources.py (98%) rename {stacktask => adjutant}/actions/v1/serializers.py (100%) rename {stacktask => adjutant}/actions/v1/tests/__init__.py (100%) rename {stacktask => adjutant}/actions/v1/tests/test_project_actions.py (98%) rename {stacktask => adjutant}/actions/v1/tests/test_resource_actions.py (97%) rename {stacktask => adjutant}/actions/v1/tests/test_user_actions.py (98%) rename {stacktask => adjutant}/actions/v1/users.py (99%) rename {stacktask => adjutant}/api/__init__.py (100%) rename {stacktask => adjutant}/api/migrations/0001_initial.py (88%) rename {stacktask => adjutant}/api/migrations/0002_auto_20160815_2249.py (100%) rename {stacktask => adjutant}/api/migrations/0003_task_approved_by.py (100%) rename {stacktask => adjutant}/api/migrations/0004_auto_20160929_0317.py (100%) rename {stacktask => adjutant}/api/migrations/__init__.py (100%) rename {stacktask => adjutant}/api/models.py (100%) rename {stacktask => adjutant}/api/urls.py (88%) rename {stacktask => adjutant}/api/utils.py (100%) create mode 100644 adjutant/api/v1/__init__.py rename {stacktask => adjutant}/api/v1/app.py (74%) rename {stacktask => adjutant}/api/v1/models.py (96%) rename {stacktask => adjutant}/api/v1/openstack.py (98%) rename {stacktask => adjutant}/api/v1/tasks.py (98%) rename {stacktask => adjutant}/api/v1/templates/completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/email_update_completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/email_update_started.txt (100%) rename {stacktask => adjutant}/api/v1/templates/email_update_token.txt (100%) rename {stacktask => adjutant}/api/v1/templates/initial.txt (100%) rename {stacktask => adjutant}/api/v1/templates/initial_password_completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/initial_password_token.txt (100%) rename {stacktask => adjutant}/api/v1/templates/invite_user_completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/invite_user_token.txt (100%) rename {stacktask => adjutant}/api/v1/templates/password_reset_completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/password_reset_token.txt (100%) rename {stacktask => adjutant}/api/v1/templates/signup_completed.txt (100%) rename {stacktask => adjutant}/api/v1/templates/signup_initial.txt (100%) rename {stacktask => adjutant}/api/v1/templates/signup_token.txt (100%) rename {stacktask => adjutant}/api/v1/templates/token.txt (81%) rename {stacktask => adjutant}/api/v1/tests/__init__.py (97%) rename {stacktask => adjutant}/api/v1/tests/test_api_admin.py (99%) rename {stacktask => adjutant}/api/v1/tests/test_api_openstack.py (98%) rename {stacktask => adjutant}/api/v1/tests/test_api_taskview.py (99%) rename {stacktask => adjutant}/api/v1/urls.py (97%) rename {stacktask => adjutant}/api/v1/utils.py (98%) rename {stacktask => adjutant}/api/v1/views.py (99%) rename {stacktask => adjutant}/exceptions.py (100%) rename {stacktask => adjutant}/middleware.py (98%) rename {stacktask => adjutant}/notifications/__init__.py (100%) rename {stacktask => adjutant}/notifications/migrations/__init__.py (100%) rename {stacktask => adjutant}/notifications/models.py (97%) rename {stacktask => adjutant}/notifications/request_tracker/__init__.py (100%) rename {stacktask => adjutant}/notifications/request_tracker/migrations/__init__.py (100%) rename {stacktask => adjutant}/notifications/request_tracker/models.py (96%) rename {stacktask => adjutant}/notifications/templates/notification.txt (91%) rename {stacktask => adjutant}/settings.py (88%) create mode 100644 adjutant/startup/__init__.py rename {stacktask => adjutant}/startup/checks.py (94%) rename {stacktask => adjutant}/startup/models.py (100%) rename {stacktask => adjutant}/test_settings.py (99%) rename {stacktask => adjutant}/urls.py (93%) rename {stacktask => adjutant}/utils.py (100%) rename {stacktask => adjutant}/wsgi.py (94%) rename debian/{stacktask.triggers => adjutant.triggers} (100%) delete mode 100644 stacktask/actions/v1/__init__.py delete mode 100644 stacktask/api/v1/__init__.py delete mode 100644 stacktask/startup/__init__.py diff --git a/.gitignore b/.gitignore index 3a63df7..c297726 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ *.sqlite3 *~ *.log -stacktask.egg-info/* +adjutant.egg-info/* dist/* .tox/* env/* diff --git a/DEVSTACK_GUIDE.md b/DEVSTACK_GUIDE.md index 7f36fe0..fe6cb27 100644 --- a/DEVSTACK_GUIDE.md +++ b/DEVSTACK_GUIDE.md @@ -1,6 +1,6 @@ -# Deploying StackTask in Devstack +# Deploying Adjutant in Devstack -This is a guide to setting up StackTask in a running Devstack environment similar to how we have been running it for development purposes. +This is a guide to setting up Adjutant in a running Devstack environment similar to how we have been running it for development purposes. This guide assumes you are running this in a clean ubuntu 14.04 virtual machine with sudo access. @@ -29,46 +29,46 @@ Run the devstack build: Provided your VM has enough ram to handle a devstack install this should take a while, but go smoothly. Ideally give your VM 5gb or more of ram, any less can cause the devstack build to fail. -## Deploy StackTask +## Deploy Adjutant -Grab the StackTask repo. +Grab the Adjutant repo. ``` -git clone https://github.com/catalyst/stacktask.git +git clone https://github.com/catalyst/adjutant.git ``` Then you'll want to setup a virtual environment. ``` -cd stacktask +cd adjutant virtualenv venv source venv/bin/activate ``` -Once that is done you can install StackTask into your virtual environment, which will also install all the required python libraries: +Once that is done you can install Adjutant into your virtual environment, which will also install all the required python libraries: ``` python setup.py develop ``` -If you prefer you can install it fully, but using develop instead allows you update the StackTask code and have the service reflect that without rerunning the install. +If you prefer you can install it fully, but using develop instead allows you update the Adjutant code and have the service reflect that without rerunning the install. -## Running StackTask +## Running Adjutant -Still in the StackTask repo directory, you will now need to run the migrations to build a basic database. By default this will use sqlite3, and for testing and development this is ideal and easier. +Still in the Adjutant repo directory, you will now need to run the migrations to build a basic database. By default this will use sqlite3, and for testing and development this is ideal and easier. ``` -stacktask-api migrate +adjutant-api migrate ``` Now the that the migrations have been setup and the database built run the service from the same directory, and it will revert to using the config file at 'conf/conf.yaml': ``` -stacktask-api runserver 0.0.0.0:5050 +adjutant-api runserver 0.0.0.0:5050 ``` Note: The port doesn't matter, but 5050 is a safe bet as it isn't used by any other DevStack services and we can then safely assume you will be using the same url for the rest of the guide. -Now you have StackTask running, keep this window open as you'll want to keep an eye on the console output. +Now you have Adjutant running, keep this window open as you'll want to keep an eye on the console output. -## Add StackTask to Keystone Catalogue +## Add Adjutant to Keystone Catalogue In a new SSH termimal connected to your ubuntu VM setup your credentials as environment variables: ``` @@ -81,33 +81,33 @@ export OS_REGION_NAME=RegionOne If you used the localrc file as given above, these should work. -Now setup a new service in Keystone for StackTask and add an endpoint for it: +Now setup a new service in Keystone for Adjutant and add an endpoint for it: ``` -openstack service create registration --name stacktask -openstack endpoint create stacktask --publicurl http://0.0.0.0:5050/v1 --region RegionOne +openstack service create registration --name adjutant +openstack endpoint create adjutant --publicurl http://0.0.0.0:5050/v1 --region RegionOne ``` -## StackTask specific roles +## Adjutant specific roles -To allow certain actions, StackTask requires two special roles to exist. You can create them as such: +To allow certain actions, Adjutant requires two special roles to exist. You can create them as such: ``` openstack role create project_admin openstack role create project_mod ``` -## Testing StackTask via the CLI +## Testing Adjutant via the CLI Now that the service is running, and the endpoint setup, you will want to install the client and try talking to the service: ``` -sudo pip install python-stacktaskclient +sudo pip install python-adjutantclient ``` In this case the client is safe to install globally as none of its requirements will conflict with OpenStack. Now lets check the status of the service: ``` -stacktask status +adjutant status ``` What you should get is: @@ -122,30 +122,30 @@ Seeing as we've done nothing to the service yet this is the expected output. To list the users on your current project (admin users are hidden): ``` -stacktask user-list +adjutant user-list ``` Now lets try inviting a new user: ``` -stacktask user-invite --email bob@example.com --roles project_admin +adjutant user-invite --email bob@example.com --roles project_admin ``` -You then then get a note saying your invitation has been sent followed by a print out of the users on your current project (same as doing 'stacktask user-list'). +You then then get a note saying your invitation has been sent followed by a print out of the users on your current project (same as doing 'adjutant user-list'). -Now if you look at the log in the StackTask terminal you should still have open, you will see a print out of the email that would have been sent to bob@example.com. In the email is a line that looks like this: +Now if you look at the log in the Adjutant terminal you should still have open, you will see a print out of the email that would have been sent to bob@example.com. In the email is a line that looks like this: ``` http://192.168.122.160:8080/token/e86cbfb187d34222ace90845f900893c ``` Normally that would direct the user to a Horizon dashboard page where they can submit their password. -Since we don't have that running, your only option is to submit it via the CLI. This is cumbersome, but doable. From that url in your StackTask output, grab the values after '.../token/'. That is bob's token. You can submit that via the CLI: +Since we don't have that running, your only option is to submit it via the CLI. This is cumbersome, but doable. From that url in your Adjutant output, grab the values after '.../token/'. That is bob's token. You can submit that via the CLI: ``` -stacktask token-submit --data '{"password": "123456"}' +adjutant token-submit --data '{"password": "123456"}' ``` Now if you get the user list, you will see bob is now active: ``` -stacktask user-list +adjutant user-list ``` And also shows up as a user if you do: @@ -154,13 +154,13 @@ openstack user list ``` -## Setting Up StackTask on Horizon +## Setting Up Adjutant on Horizon This is a little annoying, since we can't simple install the changes as a plugin, but for the purposes of our demo we will be using a fork of Horizon with our internal Horizon changes rebased on top. -First grab the StackTask fork of horizon: +First grab the Adjutant fork of horizon: ``` -git clone https://github.com/catalyst/horizon.git -b stable/mitaka_stacktask +git clone https://github.com/catalyst/horizon.git -b stable/mitaka_adjutant ``` Now we will copy the code from that repo to replace the code devstack is using: @@ -168,7 +168,7 @@ Now we will copy the code from that repo to replace the code devstack is using: cp -r horizon/* /opt/stack/horizon/ ``` -We will also need to add the StackTask url to the local_settings file for the non-authed views: +We will also need to add the Adjutant url to the local_settings file for the non-authed views: ``` echo 'OPENSTACK_REGISTRATION_URL="http://0.0.0.0:5050/v1"' >> /opt/stack/horizon/openstack_dashboard/local/local_settings.py ``` @@ -181,7 +181,7 @@ sudo service apache2 restart Now if you go to your devstack Horizon dashboard you will be able to access the new panel and new un-authed views. -To help testing token submission, you probably will want to update this line in the StackTask conf from: +To help testing token submission, you probably will want to update this line in the Adjutant conf from: ``` TOKEN_SUBMISSION_URL: http://192.168.122.160:8080/dashboard/token/ ``` @@ -222,7 +222,7 @@ EMAIL_SETTINGS: Once the service has reset, it should now send emails via that server rather than print them to console. -## Updating stacktask +## Updating adjutant -Stacktask doesn't have a typical manage.py file, instead this functionality is installed into the virtual enviroment when stacktask is installed. -All of the expected Django functionality can be used using the 'stacktask-api' cli. +Adjutant doesn't have a typical manage.py file, instead this functionality is installed into the virtual enviroment when adjutant is installed. +All of the expected Django functionality can be used using the 'adjutant-api' cli. diff --git a/MANIFEST.in b/MANIFEST.in index 7ca3ed1..96c26a5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include test-requirements.txt include README.md include package_readme.rst graft conf -graft stacktask/api/v*/templates -graft stacktask/notifications/templates -graft stacktask/notifications/*/templates +graft adjutant/api/v*/templates +graft adjutant/notifications/templates +graft adjutant/notifications/*/templates diff --git a/README.md b/README.md index b4c4e8d..388066a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# StackTask +# Adjutant A basic workflow framework built using Django and Django-Rest-Framework to help automate basic Admin tasks within an OpenStack cluster. @@ -234,7 +234,7 @@ While this is a Django application, it does not follow the standard Django folde Rather than a standard Django application, treat this as a more standard python application in this regard. -Once installed, all the normal manage.py functions can be called directly on the 'stacktask' commandline function. +Once installed, all the normal manage.py functions can be called directly on the 'adjutant' commandline function. ### Dev Environment: @@ -256,11 +256,11 @@ $ tox ``` To run just action unit tests: ``` -$ tox stacktask.actions +$ tox adjutant.actions ``` To run a single api test: ``` -$ tox stacktask.api.v1.tests.test_api_taskview.TaskViewTests.test_duplicate_tasks_new_user +$ tox adjutant.api.v1.tests.test_api_taskview.TaskViewTests.test_duplicate_tasks_new_user ``` ### Adding Actions: @@ -294,7 +294,7 @@ Incrementing package version: Build the package: dpkg-buildpackage -us -uc -Now a debian package has been built that will unpack a virtualenv containing stacktask and all dependencies in a self-contained package, so they do not conflict with other python packages on the system. +Now a debian package has been built that will unpack a virtualenv containing adjutant and all dependencies in a self-contained package, so they do not conflict with other python packages on the system. ### Puppet module Then a puppet module will be able to install the debian package, setup a database, and run the service via nginx and uwsgi in the virtualenv. @@ -303,7 +303,7 @@ Then a puppet module will be able to install the debian package, setup a databas Custom email templates are placed in: ``` -/etc/stacktask/templates/ +/etc/adjutant/templates/ ``` This is so that adding personalised or deployment specific templates is kept outside of the scope of the service itself and managed by the deployer. diff --git a/stacktask/__init__.py b/adjutant/__init__.py similarity index 84% rename from stacktask/__init__.py rename to adjutant/__init__.py index 3cae314..4b871f4 100644 --- a/stacktask/__init__.py +++ b/adjutant/__init__.py @@ -14,11 +14,11 @@ def management_command(): - """Entry-point for the 'stacktask' command-line admin utility.""" + """Entry-point for the 'adjutant' command-line admin utility.""" import os import sys - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stacktask.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "adjutant.settings") from django.core.management import execute_from_command_line diff --git a/stacktask/actions/__init__.py b/adjutant/actions/__init__.py similarity index 100% rename from stacktask/actions/__init__.py rename to adjutant/actions/__init__.py diff --git a/stacktask/actions/migrations/0001_initial.py b/adjutant/actions/migrations/0001_initial.py similarity index 100% rename from stacktask/actions/migrations/0001_initial.py rename to adjutant/actions/migrations/0001_initial.py diff --git a/stacktask/actions/migrations/0002_action_auto_approve.py b/adjutant/actions/migrations/0002_action_auto_approve.py similarity index 100% rename from stacktask/actions/migrations/0002_action_auto_approve.py rename to adjutant/actions/migrations/0002_action_auto_approve.py diff --git a/stacktask/actions/migrations/__init__.py b/adjutant/actions/migrations/__init__.py similarity index 100% rename from stacktask/actions/migrations/__init__.py rename to adjutant/actions/migrations/__init__.py diff --git a/stacktask/actions/models.py b/adjutant/actions/models.py similarity index 100% rename from stacktask/actions/models.py rename to adjutant/actions/models.py diff --git a/stacktask/actions/openstack_clients.py b/adjutant/actions/openstack_clients.py similarity index 100% rename from stacktask/actions/openstack_clients.py rename to adjutant/actions/openstack_clients.py diff --git a/stacktask/actions/user_store.py b/adjutant/actions/user_store.py similarity index 100% rename from stacktask/actions/user_store.py rename to adjutant/actions/user_store.py diff --git a/stacktask/actions/utils.py b/adjutant/actions/utils.py similarity index 96% rename from stacktask/actions/utils.py rename to adjutant/actions/utils.py index 03affb7..cf55389 100644 --- a/stacktask/actions/utils.py +++ b/adjutant/actions/utils.py @@ -1,7 +1,7 @@ import six from smtplib import SMTPException -from stacktask.api.v1.utils import create_notification +from adjutant.api.v1.utils import create_notification from django.core.mail import EmailMultiAlternatives from django.template import loader @@ -47,7 +47,7 @@ def send_email(to_addresses, context, conf, task): # these are the message headers which will be visible to # the email client. headers = { - 'X-StackTask-Task-UUID': task.uuid, + 'X-Adjutant-Task-UUID': task.uuid, # From needs to be set to be distinct from return-path 'From': reply_email, 'Reply-To': reply_email, diff --git a/adjutant/actions/v1/__init__.py b/adjutant/actions/v1/__init__.py new file mode 100644 index 0000000..84334ba --- /dev/null +++ b/adjutant/actions/v1/__init__.py @@ -0,0 +1 @@ +default_app_config = 'adjutant.actions.v1.app.ActionV1Config' diff --git a/stacktask/actions/v1/app.py b/adjutant/actions/v1/app.py similarity index 73% rename from stacktask/actions/v1/app.py rename to adjutant/actions/v1/app.py index 1ef83df..ef12ce5 100644 --- a/stacktask/actions/v1/app.py +++ b/adjutant/actions/v1/app.py @@ -3,5 +3,5 @@ from django.apps import AppConfig class ActionV1Config(AppConfig): - name = "stacktask.actions.v1" + name = "adjutant.actions.v1" label = 'actions_v1' diff --git a/stacktask/actions/v1/base.py b/adjutant/actions/v1/base.py similarity index 99% rename from stacktask/actions/v1/base.py rename to adjutant/actions/v1/base.py index ebc2bb0..d8e99ce 100644 --- a/stacktask/actions/v1/base.py +++ b/adjutant/actions/v1/base.py @@ -17,8 +17,8 @@ from logging import getLogger from django.conf import settings from django.utils import timezone -from stacktask.actions import user_store -from stacktask.actions.models import Action +from adjutant.actions import user_store +from adjutant.actions.models import Action class BaseAction(object): @@ -66,7 +66,7 @@ class BaseAction(object): Sets up required data as fields. """ - self.logger = getLogger('stacktask') + self.logger = getLogger('adjutant') for field in self.required: field_data = data[field] diff --git a/stacktask/actions/v1/misc.py b/adjutant/actions/v1/misc.py similarity index 96% rename from stacktask/actions/v1/misc.py rename to adjutant/actions/v1/misc.py index 78f97bc..a44211d 100644 --- a/stacktask/actions/v1/misc.py +++ b/adjutant/actions/v1/misc.py @@ -16,9 +16,9 @@ import six from django.conf import settings -from stacktask.actions.v1.base import BaseAction -from stacktask.actions import user_store -from stacktask.actions.utils import send_email +from adjutant.actions.v1.base import BaseAction +from adjutant.actions import user_store +from adjutant.actions.utils import send_email class SendAdditionalEmailAction(BaseAction): diff --git a/stacktask/actions/v1/models.py b/adjutant/actions/v1/models.py similarity index 90% rename from stacktask/actions/v1/models.py rename to adjutant/actions/v1/models.py index 9fd8455..84a8d1b 100644 --- a/stacktask/actions/v1/models.py +++ b/adjutant/actions/v1/models.py @@ -14,16 +14,16 @@ from django.conf import settings -from stacktask.actions.v1 import serializers -from stacktask.actions.v1.projects import ( +from adjutant.actions.v1 import serializers +from adjutant.actions.v1.projects import ( NewProjectWithUserAction, AddDefaultUsersToProjectAction) -from stacktask.actions.v1.users import ( +from adjutant.actions.v1.users import ( EditUserRolesAction, NewUserAction, ResetUserPasswordAction, UpdateUserEmailAction) -from stacktask.actions.v1.resources import ( +from adjutant.actions.v1.resources import ( NewDefaultNetworkAction, NewProjectDefaultNetworkAction, SetProjectQuotaAction) -from stacktask.actions.v1.misc import SendAdditionalEmailAction +from adjutant.actions.v1.misc import SendAdditionalEmailAction # Update settings dict with tuples in the format: diff --git a/stacktask/actions/v1/projects.py b/adjutant/actions/v1/projects.py similarity index 99% rename from stacktask/actions/v1/projects.py rename to adjutant/actions/v1/projects.py index a75e75b..c08adce 100644 --- a/stacktask/actions/v1/projects.py +++ b/adjutant/actions/v1/projects.py @@ -16,8 +16,8 @@ from uuid import uuid4 from django.utils import timezone -from stacktask.actions import user_store -from stacktask.actions.v1.base import ( +from adjutant.actions import user_store +from adjutant.actions.v1.base import ( BaseAction, UserNameAction, UserMixin, ProjectMixin) diff --git a/stacktask/actions/v1/resources.py b/adjutant/actions/v1/resources.py similarity index 98% rename from stacktask/actions/v1/resources.py rename to adjutant/actions/v1/resources.py index a71a301..87a02d2 100644 --- a/stacktask/actions/v1/resources.py +++ b/adjutant/actions/v1/resources.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from stacktask.actions.v1.base import BaseAction, ProjectMixin +from adjutant.actions.v1.base import BaseAction, ProjectMixin from django.conf import settings -from stacktask.actions import openstack_clients, user_store +from adjutant.actions import openstack_clients, user_store import six diff --git a/stacktask/actions/v1/serializers.py b/adjutant/actions/v1/serializers.py similarity index 100% rename from stacktask/actions/v1/serializers.py rename to adjutant/actions/v1/serializers.py diff --git a/stacktask/actions/v1/tests/__init__.py b/adjutant/actions/v1/tests/__init__.py similarity index 100% rename from stacktask/actions/v1/tests/__init__.py rename to adjutant/actions/v1/tests/__init__.py diff --git a/stacktask/actions/v1/tests/test_project_actions.py b/adjutant/actions/v1/tests/test_project_actions.py similarity index 98% rename from stacktask/actions/v1/tests/test_project_actions.py rename to adjutant/actions/v1/tests/test_project_actions.py index c662537..6553ded 100644 --- a/stacktask/actions/v1/tests/test_project_actions.py +++ b/adjutant/actions/v1/tests/test_project_actions.py @@ -17,15 +17,15 @@ from django.test.utils import override_settings import mock -from stacktask.actions.v1.projects import ( +from adjutant.actions.v1.projects import ( NewProjectWithUserAction, AddDefaultUsersToProjectAction) -from stacktask.api.models import Task -from stacktask.api.v1 import tests -from stacktask.api.v1.tests import (FakeManager, setup_temp_cache, - modify_dict_settings) +from adjutant.api.models import Task +from adjutant.api.v1 import tests +from adjutant.api.v1.tests import (FakeManager, setup_temp_cache, + modify_dict_settings) -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) class ProjectActionTests(TestCase): diff --git a/stacktask/actions/v1/tests/test_resource_actions.py b/adjutant/actions/v1/tests/test_resource_actions.py similarity index 97% rename from stacktask/actions/v1/tests/test_resource_actions.py rename to adjutant/actions/v1/tests/test_resource_actions.py index b42839e..9c3369e 100644 --- a/stacktask/actions/v1/tests/test_resource_actions.py +++ b/adjutant/actions/v1/tests/test_resource_actions.py @@ -16,30 +16,30 @@ from django.test import TestCase import mock -from stacktask.actions.v1.resources import ( +from adjutant.actions.v1.resources import ( NewDefaultNetworkAction, NewProjectDefaultNetworkAction, SetProjectQuotaAction) -from stacktask.api.models import Task -from stacktask.api.v1.tests import (FakeManager, setup_temp_cache, - modify_dict_settings) -from stacktask.actions.v1.tests import ( +from adjutant.api.models import Task +from adjutant.api.v1.tests import (FakeManager, setup_temp_cache, + modify_dict_settings) +from adjutant.actions.v1.tests import ( get_fake_neutron, get_fake_novaclient, get_fake_cinderclient, setup_neutron_cache, neutron_cache, cinder_cache, nova_cache, setup_mock_caches) -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) @mock.patch( - 'stacktask.actions.v1.resources.' + + 'adjutant.actions.v1.resources.' + 'openstack_clients.get_neutronclient', get_fake_neutron) @mock.patch( - 'stacktask.actions.v1.resources.' + + 'adjutant.actions.v1.resources.' + 'openstack_clients.get_novaclient', get_fake_novaclient) @mock.patch( - 'stacktask.actions.v1.resources.' + + 'adjutant.actions.v1.resources.' + 'openstack_clients.get_cinderclient', get_fake_cinderclient) class ProjectSetupActionTests(TestCase): diff --git a/stacktask/actions/v1/tests/test_user_actions.py b/adjutant/actions/v1/tests/test_user_actions.py similarity index 98% rename from stacktask/actions/v1/tests/test_user_actions.py rename to adjutant/actions/v1/tests/test_user_actions.py index 9a75fa7..1d1984d 100644 --- a/stacktask/actions/v1/tests/test_user_actions.py +++ b/adjutant/actions/v1/tests/test_user_actions.py @@ -16,18 +16,18 @@ import mock from django.test.utils import override_settings -from stacktask.actions.v1.users import ( +from adjutant.actions.v1.users import ( EditUserRolesAction, NewUserAction, ResetUserPasswordAction, UpdateUserEmailAction) -from stacktask.api.models import Task -from stacktask.api.v1 import tests -from stacktask.api.v1.tests import (FakeManager, setup_temp_cache, - modify_dict_settings, StacktaskTestCase) +from adjutant.api.models import Task +from adjutant.api.v1 import tests +from adjutant.api.v1.tests import (FakeManager, setup_temp_cache, + modify_dict_settings, AdjutantTestCase) -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) -class UserActionTests(StacktaskTestCase): +class UserActionTests(AdjutantTestCase): def test_new_user(self): """ diff --git a/stacktask/actions/v1/users.py b/adjutant/actions/v1/users.py similarity index 99% rename from stacktask/actions/v1/users.py rename to adjutant/actions/v1/users.py index b6947da..acec182 100644 --- a/stacktask/actions/v1/users.py +++ b/adjutant/actions/v1/users.py @@ -15,8 +15,8 @@ from django.conf import settings from django.db import models -from stacktask.actions import user_store -from stacktask.actions.v1.base import ( +from adjutant.actions import user_store +from adjutant.actions.v1.base import ( UserNameAction, UserIdAction, UserMixin, ProjectMixin) diff --git a/stacktask/api/__init__.py b/adjutant/api/__init__.py similarity index 100% rename from stacktask/api/__init__.py rename to adjutant/api/__init__.py diff --git a/stacktask/api/migrations/0001_initial.py b/adjutant/api/migrations/0001_initial.py similarity index 88% rename from stacktask/api/migrations/0001_initial.py rename to adjutant/api/migrations/0001_initial.py index 56bf9b8..49784d4 100644 --- a/stacktask/api/migrations/0001_initial.py +++ b/adjutant/api/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import models, migrations import jsonfield.fields import django.utils.timezone -import stacktask.api.models +import adjutant.api.models class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Notification', fields=[ - ('uuid', models.CharField(default=stacktask.api.models.hex_uuid, max_length=32, serialize=False, primary_key=True)), + ('uuid', models.CharField(default=adjutant.api.models.hex_uuid, max_length=32, serialize=False, primary_key=True)), ('notes', jsonfield.fields.JSONField(default={})), ('error', models.BooleanField(default=False, db_index=True)), ('created_on', models.DateTimeField(default=django.utils.timezone.now)), @@ -26,7 +26,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Task', fields=[ - ('uuid', models.CharField(default=stacktask.api.models.hex_uuid, max_length=32, serialize=False, primary_key=True)), + ('uuid', models.CharField(default=adjutant.api.models.hex_uuid, max_length=32, serialize=False, primary_key=True)), ('hash_key', models.CharField(max_length=32, db_index=True)), ('ip_address', models.GenericIPAddressField()), ('keystone_user', jsonfield.fields.JSONField(default={})), diff --git a/stacktask/api/migrations/0002_auto_20160815_2249.py b/adjutant/api/migrations/0002_auto_20160815_2249.py similarity index 100% rename from stacktask/api/migrations/0002_auto_20160815_2249.py rename to adjutant/api/migrations/0002_auto_20160815_2249.py diff --git a/stacktask/api/migrations/0003_task_approved_by.py b/adjutant/api/migrations/0003_task_approved_by.py similarity index 100% rename from stacktask/api/migrations/0003_task_approved_by.py rename to adjutant/api/migrations/0003_task_approved_by.py diff --git a/stacktask/api/migrations/0004_auto_20160929_0317.py b/adjutant/api/migrations/0004_auto_20160929_0317.py similarity index 100% rename from stacktask/api/migrations/0004_auto_20160929_0317.py rename to adjutant/api/migrations/0004_auto_20160929_0317.py diff --git a/stacktask/api/migrations/__init__.py b/adjutant/api/migrations/__init__.py similarity index 100% rename from stacktask/api/migrations/__init__.py rename to adjutant/api/migrations/__init__.py diff --git a/stacktask/api/models.py b/adjutant/api/models.py similarity index 100% rename from stacktask/api/models.py rename to adjutant/api/models.py diff --git a/stacktask/api/urls.py b/adjutant/api/urls.py similarity index 88% rename from stacktask/api/urls.py rename to adjutant/api/urls.py index 2874a6c..d1667b3 100644 --- a/stacktask/api/urls.py +++ b/adjutant/api/urls.py @@ -18,9 +18,9 @@ from django.conf import settings from rest_framework_swagger.views import get_swagger_view urlpatterns = [ - url(r'^v1/', include('stacktask.api.v1.urls')), + url(r'^v1/', include('adjutant.api.v1.urls')), ] if settings.DEBUG: - schema_view = get_swagger_view(title='StackTask API') + schema_view = get_swagger_view(title='Adjutant API') urlpatterns.append(url(r'^docs/', schema_view)) diff --git a/stacktask/api/utils.py b/adjutant/api/utils.py similarity index 100% rename from stacktask/api/utils.py rename to adjutant/api/utils.py diff --git a/adjutant/api/v1/__init__.py b/adjutant/api/v1/__init__.py new file mode 100644 index 0000000..0f1fc40 --- /dev/null +++ b/adjutant/api/v1/__init__.py @@ -0,0 +1 @@ +default_app_config = 'adjutant.api.v1.app.APIV1Config' diff --git a/stacktask/api/v1/app.py b/adjutant/api/v1/app.py similarity index 74% rename from stacktask/api/v1/app.py rename to adjutant/api/v1/app.py index 8cdeb5c..c4461e4 100644 --- a/stacktask/api/v1/app.py +++ b/adjutant/api/v1/app.py @@ -2,5 +2,5 @@ from django.apps import AppConfig class APIV1Config(AppConfig): - name = "stacktask.api.v1" + name = "adjutant.api.v1" label = 'api_v1' diff --git a/stacktask/api/v1/models.py b/adjutant/api/v1/models.py similarity index 96% rename from stacktask/api/v1/models.py rename to adjutant/api/v1/models.py index 6b40ef2..cc829a2 100644 --- a/stacktask/api/v1/models.py +++ b/adjutant/api/v1/models.py @@ -14,8 +14,8 @@ from django.conf import settings -from stacktask.api.v1 import tasks -from stacktask.api.v1 import openstack +from adjutant.api.v1 import tasks +from adjutant.api.v1 import openstack def register_taskview_class(url, taskview_class): diff --git a/stacktask/api/v1/openstack.py b/adjutant/api/v1/openstack.py similarity index 98% rename from stacktask/api/v1/openstack.py rename to adjutant/api/v1/openstack.py index dd11f1e..2e6067b 100644 --- a/stacktask/api/v1/openstack.py +++ b/adjutant/api/v1/openstack.py @@ -17,11 +17,11 @@ from django.utils import timezone from rest_framework.response import Response -from stacktask.actions import user_store -from stacktask.api import models -from stacktask.api import utils -from stacktask.api.v1 import tasks -from stacktask.api.v1.utils import add_task_id_for_roles +from adjutant.actions import user_store +from adjutant.api import models +from adjutant.api import utils +from adjutant.api.v1 import tasks +from adjutant.api.v1.utils import add_task_id_for_roles class UserList(tasks.InviteUser): diff --git a/stacktask/api/v1/tasks.py b/adjutant/api/v1/tasks.py similarity index 98% rename from stacktask/api/v1/tasks.py rename to adjutant/api/v1/tasks.py index a11614b..48de0cd 100644 --- a/stacktask/api/v1/tasks.py +++ b/adjutant/api/v1/tasks.py @@ -13,15 +13,15 @@ # under the License. from rest_framework.response import Response -from stacktask.actions.user_store import IdentityManager -from stacktask.api.models import Task +from adjutant.actions.user_store import IdentityManager +from adjutant.api.models import Task from django.utils import timezone -from stacktask.api import utils -from stacktask.api.v1.views import APIViewWithLogger -from stacktask.api.v1.utils import ( +from adjutant.api import utils +from adjutant.api.v1.views import APIViewWithLogger +from adjutant.api.v1.utils import ( send_stage_email, create_notification, create_token, create_task_hash, add_task_id_for_roles) -from stacktask.exceptions import SerializerMissingException +from adjutant.exceptions import SerializerMissingException from django.conf import settings diff --git a/stacktask/api/v1/templates/completed.txt b/adjutant/api/v1/templates/completed.txt similarity index 100% rename from stacktask/api/v1/templates/completed.txt rename to adjutant/api/v1/templates/completed.txt diff --git a/stacktask/api/v1/templates/email_update_completed.txt b/adjutant/api/v1/templates/email_update_completed.txt similarity index 100% rename from stacktask/api/v1/templates/email_update_completed.txt rename to adjutant/api/v1/templates/email_update_completed.txt diff --git a/stacktask/api/v1/templates/email_update_started.txt b/adjutant/api/v1/templates/email_update_started.txt similarity index 100% rename from stacktask/api/v1/templates/email_update_started.txt rename to adjutant/api/v1/templates/email_update_started.txt diff --git a/stacktask/api/v1/templates/email_update_token.txt b/adjutant/api/v1/templates/email_update_token.txt similarity index 100% rename from stacktask/api/v1/templates/email_update_token.txt rename to adjutant/api/v1/templates/email_update_token.txt diff --git a/stacktask/api/v1/templates/initial.txt b/adjutant/api/v1/templates/initial.txt similarity index 100% rename from stacktask/api/v1/templates/initial.txt rename to adjutant/api/v1/templates/initial.txt diff --git a/stacktask/api/v1/templates/initial_password_completed.txt b/adjutant/api/v1/templates/initial_password_completed.txt similarity index 100% rename from stacktask/api/v1/templates/initial_password_completed.txt rename to adjutant/api/v1/templates/initial_password_completed.txt diff --git a/stacktask/api/v1/templates/initial_password_token.txt b/adjutant/api/v1/templates/initial_password_token.txt similarity index 100% rename from stacktask/api/v1/templates/initial_password_token.txt rename to adjutant/api/v1/templates/initial_password_token.txt diff --git a/stacktask/api/v1/templates/invite_user_completed.txt b/adjutant/api/v1/templates/invite_user_completed.txt similarity index 100% rename from stacktask/api/v1/templates/invite_user_completed.txt rename to adjutant/api/v1/templates/invite_user_completed.txt diff --git a/stacktask/api/v1/templates/invite_user_token.txt b/adjutant/api/v1/templates/invite_user_token.txt similarity index 100% rename from stacktask/api/v1/templates/invite_user_token.txt rename to adjutant/api/v1/templates/invite_user_token.txt diff --git a/stacktask/api/v1/templates/password_reset_completed.txt b/adjutant/api/v1/templates/password_reset_completed.txt similarity index 100% rename from stacktask/api/v1/templates/password_reset_completed.txt rename to adjutant/api/v1/templates/password_reset_completed.txt diff --git a/stacktask/api/v1/templates/password_reset_token.txt b/adjutant/api/v1/templates/password_reset_token.txt similarity index 100% rename from stacktask/api/v1/templates/password_reset_token.txt rename to adjutant/api/v1/templates/password_reset_token.txt diff --git a/stacktask/api/v1/templates/signup_completed.txt b/adjutant/api/v1/templates/signup_completed.txt similarity index 100% rename from stacktask/api/v1/templates/signup_completed.txt rename to adjutant/api/v1/templates/signup_completed.txt diff --git a/stacktask/api/v1/templates/signup_initial.txt b/adjutant/api/v1/templates/signup_initial.txt similarity index 100% rename from stacktask/api/v1/templates/signup_initial.txt rename to adjutant/api/v1/templates/signup_initial.txt diff --git a/stacktask/api/v1/templates/signup_token.txt b/adjutant/api/v1/templates/signup_token.txt similarity index 100% rename from stacktask/api/v1/templates/signup_token.txt rename to adjutant/api/v1/templates/signup_token.txt diff --git a/stacktask/api/v1/templates/token.txt b/adjutant/api/v1/templates/token.txt similarity index 81% rename from stacktask/api/v1/templates/token.txt rename to adjutant/api/v1/templates/token.txt index add4795..bd92c38 100644 --- a/stacktask/api/v1/templates/token.txt +++ b/adjutant/api/v1/templates/token.txt @@ -1,6 +1,6 @@ Hello, -Your task with StackTask is almost complete. +Your task with Adjutant is almost complete. The actions in your task are: {% for action in actions %} diff --git a/stacktask/api/v1/tests/__init__.py b/adjutant/api/v1/tests/__init__.py similarity index 97% rename from stacktask/api/v1/tests/__init__.py rename to adjutant/api/v1/tests/__init__.py index 77b2f94..a60a5ae 100644 --- a/stacktask/api/v1/tests/__init__.py +++ b/adjutant/api/v1/tests/__init__.py @@ -275,8 +275,8 @@ class modify_dict_settings(override_settings): The decorator will act after both override_settings and modify_settings. - Can be applied to test functions or StacktaskTestCase, - StacktaskAPITestCase classes. In those two classes settings can also + Can be applied to test functions or AdjutantTestCase, + AdjutantAPITestCase classes. In those two classes settings can also be modified using: with self.modify_dict_settings(...): @@ -402,7 +402,7 @@ class TestCaseMixin(object): """ Mixin to add modify_dict_settings functions to test classes """ @classmethod def setUpClass(cls): - super(StacktaskAPITestCase, cls).setUpClass() + super(AdjutantAPITestCase, cls).setUpClass() if cls._modified_dict_settings: cls._cls_modifyied_dict_context = override_settings( **cls._overridden_settings) @@ -413,20 +413,20 @@ class TestCaseMixin(object): if hasattr(cls, '_cls_modified_dict_context'): cls._cls_modified_dict_context.disable() delattr(cls, '_cls_modified_dict_context') - super(StacktaskAPITestCase, cls).tearDownClass() + super(AdjutantAPITestCase, cls).tearDownClass() def modify_dict_settings(self, **kwargs): return modify_dict_settings(**kwargs) -class StacktaskTestCase(TestCase, TestCaseMixin): +class AdjutantTestCase(TestCase, TestCaseMixin): """ TestCase override that has support for @modify_dict_settings as a class decorator and internal function """ -class StacktaskAPITestCase(APITestCase, TestCaseMixin): +class AdjutantAPITestCase(APITestCase, TestCaseMixin): """ APITestCase override that has support for @modify_dict_settings as a class decorator, and internal function diff --git a/stacktask/api/v1/tests/test_api_admin.py b/adjutant/api/v1/tests/test_api_admin.py similarity index 99% rename from stacktask/api/v1/tests/test_api_admin.py rename to adjutant/api/v1/tests/test_api_admin.py index c59d8d3..2d4433c 100644 --- a/stacktask/api/v1/tests/test_api_admin.py +++ b/adjutant/api/v1/tests/test_api_admin.py @@ -25,12 +25,12 @@ import mock from rest_framework import status from rest_framework.test import APITestCase -from stacktask.api.models import Task, Token -from stacktask.api.v1.tests import (FakeManager, setup_temp_cache, - modify_dict_settings) +from adjutant.api.models import Task, Token +from adjutant.api.v1.tests import (FakeManager, setup_temp_cache, + modify_dict_settings) -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) class AdminAPITests(APITestCase): """ diff --git a/stacktask/api/v1/tests/test_api_openstack.py b/adjutant/api/v1/tests/test_api_openstack.py similarity index 98% rename from stacktask/api/v1/tests/test_api_openstack.py rename to adjutant/api/v1/tests/test_api_openstack.py index e8ef26b..bc042a0 100644 --- a/stacktask/api/v1/tests/test_api_openstack.py +++ b/adjutant/api/v1/tests/test_api_openstack.py @@ -19,11 +19,11 @@ from rest_framework.test import APITestCase from django.test.utils import override_settings -from stacktask.api.models import Token -from stacktask.api.v1.tests import FakeManager, setup_temp_cache +from adjutant.api.models import Token +from adjutant.api.v1.tests import FakeManager, setup_temp_cache -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) class OpenstackAPITests(APITestCase): """ diff --git a/stacktask/api/v1/tests/test_api_taskview.py b/adjutant/api/v1/tests/test_api_taskview.py similarity index 99% rename from stacktask/api/v1/tests/test_api_taskview.py rename to adjutant/api/v1/tests/test_api_taskview.py index b96b832..328f4ae 100644 --- a/stacktask/api/v1/tests/test_api_taskview.py +++ b/adjutant/api/v1/tests/test_api_taskview.py @@ -19,15 +19,15 @@ from django.core import mail from rest_framework import status -from stacktask.api.models import Task, Token -from stacktask.api.v1.tests import (FakeManager, setup_temp_cache, - StacktaskAPITestCase, modify_dict_settings) -from stacktask.api.v1 import tests +from adjutant.api.models import Task, Token +from adjutant.api.v1.tests import (FakeManager, setup_temp_cache, + AdjutantAPITestCase, modify_dict_settings) +from adjutant.api.v1 import tests -@mock.patch('stacktask.actions.user_store.IdentityManager', +@mock.patch('adjutant.actions.user_store.IdentityManager', FakeManager) -class TaskViewTests(StacktaskAPITestCase): +class TaskViewTests(AdjutantAPITestCase): """ Tests to ensure the approval/token workflow does what is expected with the given TaskViews. These test don't check @@ -924,7 +924,7 @@ class TaskViewTests(StacktaskAPITestCase): # email address, however there isn't a very # good way to address this as keystone doesn't # store emails in their own field - # Currently this is an issue for the forked stacktask + # Currently this is an issue for the forked adjutant # horizon data = {'email': "test@example.com", 'username': 'test_user'} response = self.client.post(url, data, format='json') diff --git a/stacktask/api/v1/urls.py b/adjutant/api/v1/urls.py similarity index 97% rename from stacktask/api/v1/urls.py rename to adjutant/api/v1/urls.py index d4fd304..4c9375c 100644 --- a/stacktask/api/v1/urls.py +++ b/adjutant/api/v1/urls.py @@ -13,7 +13,7 @@ # under the License. from django.conf.urls import url -from stacktask.api.v1 import views +from adjutant.api.v1 import views from django.conf import settings diff --git a/stacktask/api/v1/utils.py b/adjutant/api/v1/utils.py similarity index 98% rename from stacktask/api/v1/utils.py rename to adjutant/api/v1/utils.py index 151e8e3..8590f29 100644 --- a/stacktask/api/v1/utils.py +++ b/adjutant/api/v1/utils.py @@ -28,7 +28,7 @@ from django.utils import timezone from rest_framework.response import Response -from stacktask.api.models import Notification, Token +from adjutant.api.models import Notification, Token def create_token(task): @@ -103,7 +103,7 @@ def send_stage_email(task, email_conf, token=None): # these are the message headers which will be visible to # the email client. headers = { - 'X-StackTask-Task-UUID': task.uuid, + 'X-Adjutant-Task-UUID': task.uuid, # From needs to be set to be disctinct from return-path 'From': email_conf['reply'], 'Reply-To': email_conf['reply'], diff --git a/stacktask/api/v1/views.py b/adjutant/api/v1/views.py similarity index 99% rename from stacktask/api/v1/views.py rename to adjutant/api/v1/views.py index 7e463be..92d3393 100644 --- a/stacktask/api/v1/views.py +++ b/adjutant/api/v1/views.py @@ -22,9 +22,9 @@ from rest_framework.exceptions import ParseError from rest_framework.response import Response from rest_framework.views import APIView -from stacktask.api import utils -from stacktask.api.models import Notification, Task, Token -from stacktask.api.v1.utils import ( +from adjutant.api import utils +from adjutant.api.models import Notification, Task, Token +from adjutant.api.v1.utils import ( create_notification, create_token, parse_filters, send_stage_email) @@ -34,7 +34,7 @@ class APIViewWithLogger(APIView): """ def __init__(self, *args, **kwargs): super(APIViewWithLogger, self).__init__(*args, **kwargs) - self.logger = getLogger('stacktask') + self.logger = getLogger('adjutant') class StatusView(APIViewWithLogger): diff --git a/stacktask/exceptions.py b/adjutant/exceptions.py similarity index 100% rename from stacktask/exceptions.py rename to adjutant/exceptions.py diff --git a/stacktask/middleware.py b/adjutant/middleware.py similarity index 98% rename from stacktask/middleware.py rename to adjutant/middleware.py index c8f92fe..92f9c65 100644 --- a/stacktask/middleware.py +++ b/adjutant/middleware.py @@ -73,7 +73,7 @@ class RequestLoggingMiddleware(object): """ def __init__(self): - self.logger = getLogger('stacktask') + self.logger = getLogger('adjutant') def process_request(self, request): self.logger.info( diff --git a/stacktask/notifications/__init__.py b/adjutant/notifications/__init__.py similarity index 100% rename from stacktask/notifications/__init__.py rename to adjutant/notifications/__init__.py diff --git a/stacktask/notifications/migrations/__init__.py b/adjutant/notifications/migrations/__init__.py similarity index 100% rename from stacktask/notifications/migrations/__init__.py rename to adjutant/notifications/migrations/__init__.py diff --git a/stacktask/notifications/models.py b/adjutant/notifications/models.py similarity index 97% rename from stacktask/notifications/models.py rename to adjutant/notifications/models.py index b89f369..081acc3 100644 --- a/stacktask/notifications/models.py +++ b/adjutant/notifications/models.py @@ -16,7 +16,7 @@ from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.template import loader from smtplib import SMTPException -from stacktask.api.models import Notification +from adjutant.api.models import Notification class NotificationEngine(object): @@ -88,7 +88,7 @@ class EmailNotification(NotificationEngine): # these are the message headers which will be visible to # the email client. headers = { - 'X-StackTask-Task-UUID': task.uuid, + 'X-Adjutant-Task-UUID': task.uuid, # From needs to be set to be disctinct from return-path 'From': self.conf['reply'], 'Reply-To': self.conf['reply'], diff --git a/stacktask/notifications/request_tracker/__init__.py b/adjutant/notifications/request_tracker/__init__.py similarity index 100% rename from stacktask/notifications/request_tracker/__init__.py rename to adjutant/notifications/request_tracker/__init__.py diff --git a/stacktask/notifications/request_tracker/migrations/__init__.py b/adjutant/notifications/request_tracker/migrations/__init__.py similarity index 100% rename from stacktask/notifications/request_tracker/migrations/__init__.py rename to adjutant/notifications/request_tracker/migrations/__init__.py diff --git a/stacktask/notifications/request_tracker/models.py b/adjutant/notifications/request_tracker/models.py similarity index 96% rename from stacktask/notifications/request_tracker/models.py rename to adjutant/notifications/request_tracker/models.py index 88eea86..fccf94f 100644 --- a/stacktask/notifications/request_tracker/models.py +++ b/adjutant/notifications/request_tracker/models.py @@ -14,8 +14,8 @@ from django.conf import settings from django.template import loader -from stacktask.notifications.models import NotificationEngine -from stacktask.api.models import Notification +from adjutant.notifications.models import NotificationEngine +from adjutant.api.models import Notification from rtkit.resource import RTResource from rtkit.authenticators import CookieAuthenticator from rtkit.errors import RTResourceError diff --git a/stacktask/notifications/templates/notification.txt b/adjutant/notifications/templates/notification.txt similarity index 91% rename from stacktask/notifications/templates/notification.txt rename to adjutant/notifications/templates/notification.txt index bd9705d..188708e 100644 --- a/stacktask/notifications/templates/notification.txt +++ b/adjutant/notifications/templates/notification.txt @@ -1,5 +1,5 @@ {% if notification.error %} 1 -An error has occur in the stacktask service that needs attention. +An error has occur in the adjutant service that needs attention. {% else %} There is a task that needs some attention. {% endif %} diff --git a/stacktask/settings.py b/adjutant/settings.py similarity index 88% rename from stacktask/settings.py rename to adjutant/settings.py index e503348..dc05229 100644 --- a/stacktask/settings.py +++ b/adjutant/settings.py @@ -13,7 +13,7 @@ # under the License. """ -Django settings for StackTask. +Django settings for Adjutant. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ @@ -26,7 +26,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ import os import sys import yaml -from stacktask.utils import setup_task_settings +from adjutant.utils import setup_task_settings BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Application definition @@ -40,9 +40,9 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'rest_framework', 'rest_framework_swagger', - 'stacktask.actions', - 'stacktask.api', - 'stacktask.notifications', + 'adjutant.actions', + 'adjutant.api', + 'adjutant.notifications', ) MIDDLEWARE_CLASSES = ( @@ -53,19 +53,19 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'stacktask.middleware.KeystoneHeaderUnwrapper', - 'stacktask.middleware.RequestLoggingMiddleware' + 'adjutant.middleware.KeystoneHeaderUnwrapper', + 'adjutant.middleware.RequestLoggingMiddleware' ) if 'test' in sys.argv: # modify MIDDLEWARE_CLASSES MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) - MIDDLEWARE_CLASSES.remove('stacktask.middleware.KeystoneHeaderUnwrapper') - MIDDLEWARE_CLASSES.append('stacktask.middleware.TestingHeaderUnwrapper') + MIDDLEWARE_CLASSES.remove('adjutant.middleware.KeystoneHeaderUnwrapper') + MIDDLEWARE_CLASSES.append('adjutant.middleware.TestingHeaderUnwrapper') -ROOT_URLCONF = 'stacktask.urls' +ROOT_URLCONF = 'adjutant.urls' -WSGI_APPLICATION = 'stacktask.wsgi.application' +WSGI_APPLICATION = 'adjutant.wsgi.application' LANGUAGE_CODE = 'en-us' @@ -88,17 +88,17 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True, - 'DIRS': ['/etc/stacktask/templates/'], + 'DIRS': ['/etc/adjutant/templates/'], 'NAME': 'include_etc_templates', }, ] # Setup of local settings data if 'test' in sys.argv: - from stacktask import test_settings + from adjutant import test_settings CONFIG = test_settings.conf_dict else: - config_file = "/etc/stacktask/conf.yaml" + config_file = "/etc/adjutant/conf.yaml" if not os.path.isfile(config_file): print("%s does not exist. Reverting to default config file." % config_file) @@ -126,7 +126,7 @@ for app in CONFIG['ADDITIONAL_APPS']: # NOTE(adriant): Because the order matters, we want this import to be last # so the startup checks run after everything is imported. -INSTALLED_APPS.append("stacktask.startup") +INSTALLED_APPS.append("adjutant.startup") DATABASES = CONFIG['DATABASES'] diff --git a/adjutant/startup/__init__.py b/adjutant/startup/__init__.py new file mode 100644 index 0000000..60f9f30 --- /dev/null +++ b/adjutant/startup/__init__.py @@ -0,0 +1 @@ +default_app_config = 'adjutant.startup.checks.StartUpConfig' diff --git a/stacktask/startup/checks.py b/adjutant/startup/checks.py similarity index 94% rename from stacktask/startup/checks.py rename to adjutant/startup/checks.py index 4f4d757..4034068 100644 --- a/stacktask/startup/checks.py +++ b/adjutant/startup/checks.py @@ -1,7 +1,7 @@ from django.apps import AppConfig from django.conf import settings -from stacktask.exceptions import ActionNotFound, TaskViewNotFound +from adjutant.exceptions import ActionNotFound, TaskViewNotFound def check_expected_taskviews(): @@ -40,7 +40,7 @@ def check_configured_actions(): class StartUpConfig(AppConfig): - name = "stacktask.startup" + name = "adjutant.startup" def ready(self): """A pre-startup function for the api diff --git a/stacktask/startup/models.py b/adjutant/startup/models.py similarity index 100% rename from stacktask/startup/models.py rename to adjutant/startup/models.py diff --git a/stacktask/test_settings.py b/adjutant/test_settings.py similarity index 99% rename from stacktask/test_settings.py rename to adjutant/test_settings.py index 028f536..63cbc79 100644 --- a/stacktask/test_settings.py +++ b/adjutant/test_settings.py @@ -15,8 +15,8 @@ SECRET_KEY = '+er!4olta#17a=n%uotcazg2ncpl==yjog%1*o-(cr%zys-)!' ADDITIONAL_APPS = [ - 'stacktask.api.v1', - 'stacktask.actions.v1', + 'adjutant.api.v1', + 'adjutant.actions.v1', ] DATABASES = { @@ -37,7 +37,7 @@ LOGGING = { }, }, 'loggers': { - 'stacktask': { + 'adjutant': { 'handlers': ['file'], 'level': 'INFO', 'propagate': False, diff --git a/stacktask/urls.py b/adjutant/urls.py similarity index 93% rename from stacktask/urls.py rename to adjutant/urls.py index 7efbc0a..f412a0e 100644 --- a/stacktask/urls.py +++ b/adjutant/urls.py @@ -15,5 +15,5 @@ from django.conf.urls import include, url urlpatterns = [ - url(r'^', include('stacktask.api.urls')), + url(r'^', include('adjutant.api.urls')), ] diff --git a/stacktask/utils.py b/adjutant/utils.py similarity index 100% rename from stacktask/utils.py rename to adjutant/utils.py diff --git a/stacktask/wsgi.py b/adjutant/wsgi.py similarity index 94% rename from stacktask/wsgi.py rename to adjutant/wsgi.py index b83f676..1e37e98 100644 --- a/stacktask/wsgi.py +++ b/adjutant/wsgi.py @@ -13,7 +13,7 @@ # under the License. """ -WSGI config for StackTask. +WSGI config for Adjutant. It exposes the WSGI callable as a module-level variable named ``application``. @@ -27,7 +27,7 @@ from django.conf import settings from urlparse import urlparse from keystonemiddleware.auth_token import AuthProtocol -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stacktask.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "adjutant.settings") application = get_wsgi_application() diff --git a/conf/conf.yaml b/conf/conf.yaml index 28f8778..b448caf 100644 --- a/conf/conf.yaml +++ b/conf/conf.yaml @@ -7,9 +7,9 @@ ALLOWED_HOSTS: - "*" ADDITIONAL_APPS: - - stacktask.api.v1 - - stacktask.actions.v1 - - stacktask.notifications.request_tracker + - adjutant.api.v1 + - adjutant.actions.v1 + - adjutant.notifications.request_tracker DATABASES: default: @@ -25,7 +25,7 @@ LOGGING: class: logging.FileHandler filename: reg_log.log loggers: - stacktask: + adjutant: handlers: - file level: INFO diff --git a/debian/stacktask.triggers b/debian/adjutant.triggers similarity index 100% rename from debian/stacktask.triggers rename to debian/adjutant.triggers diff --git a/debian/changelog b/debian/changelog index 9529fe1..d59e119 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ python-stacktask (0.1.4) unstable; urgency=medium python-stacktask (0.1.3) unstable; urgency=medium - * Renaming cmd to stacktask-api + * Renaming cmd to adjutant-api -- Dale Smith Thu, 10 Mar 2016 10:41:31 +0000 @@ -24,7 +24,6 @@ python-stacktask (0.1.1a4) unstable; urgency=medium python-stacktask (0.1.1a3) unstable; urgency=medium - * Initial release. + * Initial release. -- Dale Smith Mon, 14 Dec 2015 15:43:59 +0000 - diff --git a/debian/control b/debian/control index 3d9451c..7f9594c 100644 --- a/debian/control +++ b/debian/control @@ -1,11 +1,11 @@ -Source: python-stacktask +Source: python-adjutant Section: python Priority: extra Maintainer: Adrian Turjak Build-Depends: debhelper (>=9), python, dh-virtualenv (>= 0.8) Standards-Version: 3.9.5 -Package: python-stacktask +Package: python-adjutant Architecture: any Pre-Depends: dpkg (>= 1.16.1), python2.7 | python2.6, ${misc:Pre-Depends} Depends: uwsgi, uwsgi-plugin-python, ${python:Depends}, ${misc:Depends} diff --git a/package_readme.rst b/package_readme.rst index 9aab884..3e0cec3 100644 --- a/package_readme.rst +++ b/package_readme.rst @@ -1,4 +1,4 @@ -StackTask is a service that sits along Keystone and allows the automation and approval of tasks normally requiring a user with an admin role. StackTask allows defining of such tasks as part of a workflow which can either be entirely automatic, or require admin approval. The goal is to automate business logic, and augment the functionality of Keystone and other OpenStack services without getting in the way of future OpenStack features or duplicating development effort. +Adjutant is a service that sits along Keystone and allows the automation and approval of tasks normally requiring a user with an admin role. Adjutant allows defining of such tasks as part of a workflow which can either be entirely automatic, or require admin approval. The goal is to automate business logic, and augment the functionality of Keystone and other OpenStack services without getting in the way of future OpenStack features or duplicating development effort. Quick Dev Deployment ==================== @@ -7,13 +7,13 @@ To quickly deploy the service for testing you can install via pip, setup a defau :: - pip install stacktask + pip install adjutant -Then running the service will look for a config in either **/etc/stacktask/conf.yaml** or it will default to **conf/conf.yaml** from the directory you run the command in. +Then running the service will look for a config in either **/etc/adjutant/conf.yaml** or it will default to **conf/conf.yaml** from the directory you run the command in. :: - stacktask migrate - stacktask runserver + adjutant migrate + adjutant runserver -For now you will have to source the default conf from the github repo or the library install location itself, but we hope to add an additional commandline function which will copy and setup a basic default config in **/etc/stacktask/conf.yaml**. \ No newline at end of file +For now you will have to source the default conf from the github repo or the library install location itself, but we hope to add an additional commandline function which will copy and setup a basic default config in **/etc/adjutant/conf.yaml**. \ No newline at end of file diff --git a/setup.py b/setup.py index 0eeefc3..46a0c09 100644 --- a/setup.py +++ b/setup.py @@ -7,12 +7,12 @@ with open('package_readme.rst') as file: long_description = file.read() setup( - name='stacktask', + name='adjutant', version='0.1.4', description='An admin task workflow service for openstack.', long_description=long_description, - url='https://github.com/catalyst/stacktask', + url='https://github.com/catalyst/adjutant', author='Adrian Turjak', author_email='adriant@catalyst.net.nz', license='Apache 2.0', @@ -29,14 +29,14 @@ setup( keywords='openstack keystone users tasks registration workflow', packages=find_packages(), package_data={ - 'stacktask': [ + 'adjutant': [ 'api/v*/templates/*.txt', 'notifications/templates/*.txt', 'notifications/*/templates/*.txt']}, install_requires=required, entry_points={ 'console_scripts': [ - 'stacktask-api = stacktask:management_command', + 'adjutant-api = adjutant:management_command', ], } ) diff --git a/stacktask/actions/v1/__init__.py b/stacktask/actions/v1/__init__.py deleted file mode 100644 index 2a1c42c..0000000 --- a/stacktask/actions/v1/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'stacktask.actions.v1.app.ActionV1Config' diff --git a/stacktask/api/v1/__init__.py b/stacktask/api/v1/__init__.py deleted file mode 100644 index 7756e17..0000000 --- a/stacktask/api/v1/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'stacktask.api.v1.app.APIV1Config' diff --git a/stacktask/startup/__init__.py b/stacktask/startup/__init__.py deleted file mode 100644 index 71b9be3..0000000 --- a/stacktask/startup/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'stacktask.startup.checks.StartUpConfig' diff --git a/tox.ini b/tox.ini index 439824f..6af3f9a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ skipsdist = True usedevelop = True deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = stacktask-api test {posargs} +commands = adjutant-api test {posargs} setenv = VIRTUAL_ENV={envdir} [testenv:pep8] @@ -16,4 +16,4 @@ commands = flake8 ignore = D100,D101,D102,D103,D104,D105,D200,D203,D202,D204,D205,D208,D400,D401 show-source = true builtins = _ -exclude=.venv,venv,.env,env,.git,.tox,dist,doc,*lib/python*,*egg,stacktask/api/migrations/*,stacktask/actions/migrations +exclude=.venv,venv,.env,env,.git,.tox,dist,doc,*lib/python*,*egg,adjutant/api/migrations/*,adjutant/actions/migrations