Renaming StackTask to Adjutant

* This patch is just a search and replace with minor tweaks.
* No functional changes, just renaming.

Change-Id: I103790be7c0cd9234545e25e21ab1768cb5eb131
This commit is contained in:
adrian-turjak 2017-05-17 12:25:45 +12:00
parent 829d6ac30e
commit af986c28fc
89 changed files with 190 additions and 191 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.sqlite3
*~
*.log
stacktask.egg-info/*
adjutant.egg-info/*
dist/*
.tox/*
env/*

View File

@ -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 <bobs_token> --data '{"password": "123456"}'
adjutant token-submit <bobs_token> --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.

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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,

View File

@ -0,0 +1 @@
default_app_config = 'adjutant.actions.v1.app.ActionV1Config'

View File

@ -3,5 +3,5 @@ from django.apps import AppConfig
class ActionV1Config(AppConfig):
name = "stacktask.actions.v1"
name = "adjutant.actions.v1"
label = 'actions_v1'

View File

@ -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]

View File

@ -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):

View File

@ -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:

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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):
"""

View File

@ -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)

View File

@ -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={})),

View File

@ -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))

View File

@ -0,0 +1 @@
default_app_config = 'adjutant.api.v1.app.APIV1Config'

View File

@ -2,5 +2,5 @@ from django.apps import AppConfig
class APIV1Config(AppConfig):
name = "stacktask.api.v1"
name = "adjutant.api.v1"
label = 'api_v1'

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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):
"""

View File

@ -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):
"""

View File

@ -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')

View File

@ -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

View File

@ -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'],

View File

@ -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):

View File

@ -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(

View File

@ -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'],

View File

@ -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

View File

@ -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 %}

View File

@ -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']

View File

@ -0,0 +1 @@
default_app_config = 'adjutant.startup.checks.StartUpConfig'

View File

@ -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

View File

@ -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,

View File

@ -15,5 +15,5 @@
from django.conf.urls import include, url
urlpatterns = [
url(r'^', include('stacktask.api.urls')),
url(r'^', include('adjutant.api.urls')),
]

View File

@ -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()

View File

@ -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

5
debian/changelog vendored
View File

@ -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 <dale@catalyst-eu.net> 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 <dale@catalyst-eu.net> Mon, 14 Dec 2015 15:43:59 +0000

4
debian/control vendored
View File

@ -1,11 +1,11 @@
Source: python-stacktask
Source: python-adjutant
Section: python
Priority: extra
Maintainer: Adrian Turjak <adriant@catalyst.net.nz>
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}

View File

@ -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 <port>
adjutant migrate
adjutant runserver <port>
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**.
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**.

View File

@ -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',
],
}
)

View File

@ -1 +0,0 @@
default_app_config = 'stacktask.actions.v1.app.ActionV1Config'

View File

@ -1 +0,0 @@
default_app_config = 'stacktask.api.v1.app.APIV1Config'

View File

@ -1 +0,0 @@
default_app_config = 'stacktask.startup.checks.StartUpConfig'

View File

@ -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