Major rename of package from lib to ansibleworks.
12
.gitignore
vendored
@ -1,8 +1,10 @@
|
||||
lib/settings/local_settings.py*
|
||||
lib/acom.sqlite3
|
||||
lib/projects
|
||||
lib/public/media
|
||||
lib/public/static
|
||||
ansibleworks/settings/local_settings.py*
|
||||
ansibleworks/acom.sqlite3
|
||||
ansibleworks/projects
|
||||
ansibleworks/public/media
|
||||
ansibleworks/public/static
|
||||
env/*
|
||||
build
|
||||
dist
|
||||
*.py[c,o]
|
||||
*.swp
|
||||
|
||||
12
MANIFEST.in
@ -1,9 +1,9 @@
|
||||
recursive-include lib *.py
|
||||
recursive-include lib/static *.ico
|
||||
recursive-include lib/templates *.html
|
||||
recursive-exclude lib/settings local_settings.py
|
||||
recursive-include ansibleworks *.py
|
||||
recursive-include ansibleworks/static *.ico
|
||||
recursive-include ansibleworks/templates *.html
|
||||
recursive-exclude ansibleworks/settings local_settings.py
|
||||
include *.py *.txt *.md
|
||||
include MANIFEST.in
|
||||
include COPYING
|
||||
prune lib/public
|
||||
prune lib/project
|
||||
prune ansibleworks/public
|
||||
prune ansibleworks/project
|
||||
|
||||
1
Makefile
@ -1,4 +1,5 @@
|
||||
clean:
|
||||
rm -rf build dist *.egg-info
|
||||
find . -type f -regex ".*\.py[co]$$" -delete
|
||||
|
||||
rebase:
|
||||
|
||||
10
README.md
@ -25,12 +25,10 @@ See the ansible-doc repo
|
||||
Accessing the UI
|
||||
================
|
||||
|
||||
The UI is installed under lib/static/web. After starting the django server
|
||||
(i.e. make runserver), access the ui from a web browser at:
|
||||
The UI is installed under ansibleworks/ui/ and accessible at the root URL.
|
||||
After starting the Django server (i.e. make runserver), access the UI from a
|
||||
web browser at:
|
||||
|
||||
http://127.0.0.1:8013/static/web/app/index.html
|
||||
http://127.0.0.1:8013/
|
||||
|
||||
(routes and formal installation steps including Apache proxying pending)
|
||||
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,8 @@ __all__ = ['__version__']
|
||||
def manage():
|
||||
# Default to production mode unless being called from manage.py, which sets
|
||||
# the environment variable for development mode instead.
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lib.settings.production')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
|
||||
'ansibleworks.settings.production')
|
||||
from django.core.management import execute_from_command_line
|
||||
if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'):
|
||||
sys.stdout.write('ansibleworks-%s\n' % __version__)
|
||||
@ -1,2 +1,2 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
@ -1,11 +1,14 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
import logging
|
||||
from django.db.models import Q
|
||||
from django.contrib.auth.models import User
|
||||
from lib.main.models import *
|
||||
from ansibleworks.main.models import *
|
||||
|
||||
__all__ = ['get_user_queryset', 'check_user_access']
|
||||
|
||||
logger = logging.getLogger('lib.main.access')
|
||||
logger = logging.getLogger('ansibleworks.main.access')
|
||||
|
||||
access_registry = {
|
||||
# <model_class>: [<access_class>, ...],
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
import urllib
|
||||
@ -13,8 +13,8 @@ from django.http import HttpResponseRedirect
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.html import format_html
|
||||
from lib.main.models import *
|
||||
from lib.main.forms import *
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.forms import *
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
@ -1,15 +1,14 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
#
|
||||
# This file is part of Ansible Commander.
|
||||
# All rights reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from lib.main.models import *
|
||||
from ansibleworks.main.models import *
|
||||
from django.contrib.auth.models import User
|
||||
from lib.main.serializers import *
|
||||
from lib.main.rbac import *
|
||||
from lib.main.access import *
|
||||
from ansibleworks.main.serializers import *
|
||||
from ansibleworks.main.rbac import *
|
||||
from ansibleworks.main.access import *
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
from rest_framework import mixins
|
||||
from rest_framework import generics
|
||||
@ -142,10 +141,10 @@ class BaseSubList(BaseList):
|
||||
|
||||
if self.__class__.parent_model == Organization:
|
||||
organization = Organization.objects.get(pk=data[inject_primary_key])
|
||||
import lib.main.views
|
||||
if self.__class__ == lib.main.views.OrganizationsUsersList:
|
||||
import ansibleworks.main.views
|
||||
if self.__class__ == ansibleworks.main.views.OrganizationsUsersList:
|
||||
organization.users.add(obj)
|
||||
elif self.__class__ == lib.main.views.OrganizationsAdminsList:
|
||||
elif self.__class__ == ansibleworks.main.views.OrganizationsAdminsList:
|
||||
organization.admins.add(obj)
|
||||
|
||||
else:
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
from rest_framework.filters import BaseFilterBackend
|
||||
from django.core.exceptions import PermissionDenied
|
||||
@ -1,11 +1,11 @@
|
||||
# (C) AnsibleWorks, 2013
|
||||
# All Rights Reserved
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield.fields import JSONFormField
|
||||
from lib.main.models import *
|
||||
from ansibleworks.main.models import *
|
||||
|
||||
EMPTY_CHOICE = ('', '---------')
|
||||
|
||||
2
ansibleworks/main/management/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
@ -1,19 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
#
|
||||
# This file is part of Ansible Commander.
|
||||
#
|
||||
# Ansible Commander is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Ansible Commander is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# All Rights Reserved.
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
from optparse import make_option
|
||||
@ -31,7 +31,7 @@ class Command(NoArgsCommand):
|
||||
)
|
||||
|
||||
def handle_noargs(self, **options):
|
||||
from lib.main.models import Job, JobEvent
|
||||
from ansibleworks.main.models import Job, JobEvent
|
||||
event_type = options.get('event_type', None)
|
||||
if not event_type:
|
||||
raise CommandError('No event specified')
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
from optparse import make_option
|
||||
@ -43,7 +43,7 @@ class Command(NoArgsCommand):
|
||||
self.stdout.write(json.dumps(groups, indent=indent))
|
||||
|
||||
def get_host(self, inventory, hostname, indent=None):
|
||||
from lib.main.models import Host
|
||||
from ansibleworks.main.models import Host
|
||||
hostvars = {}
|
||||
try:
|
||||
# FIXME: Check if active?
|
||||
@ -57,7 +57,7 @@ class Command(NoArgsCommand):
|
||||
|
||||
def handle_noargs(self, **options):
|
||||
try:
|
||||
from lib.main.models import Inventory
|
||||
from ansibleworks.main.models import Inventory
|
||||
try:
|
||||
# Command line argument takes precedence over environment
|
||||
# variable.
|
||||
2
ansibleworks/main/migrations/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
@ -1,19 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
#
|
||||
# This file is part of Ansible Commander.
|
||||
#
|
||||
# Ansible Commander is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Ansible Commander is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# All Rights Reserved.
|
||||
|
||||
import os
|
||||
import shlex
|
||||
@ -81,7 +67,7 @@ class EditHelper(object):
|
||||
@classmethod
|
||||
def illegal_changes(cls, request, obj, model_class):
|
||||
''' have any illegal changes been made (for a PUT request)? '''
|
||||
from lib.main.access import check_user_access
|
||||
from ansibleworks.main.access import check_user_access
|
||||
#can_admin = model_class.can_user_administrate(request.user, obj, request.DATA)
|
||||
can_admin = check_user_access(request.user, User, 'change', obj, request.DATA)
|
||||
if (not can_admin) or (can_admin == 'partial'):
|
||||
@ -724,7 +710,7 @@ class Job(CommonModel):
|
||||
return bool(self.status == 'new')
|
||||
|
||||
def start(self, **kwargs):
|
||||
from lib.main.tasks import RunJob
|
||||
from ansibleworks.main.tasks import RunJob
|
||||
if not self.can_start:
|
||||
return False
|
||||
needed = self.get_passwords_needed_to_start()
|
||||
@ -1,13 +1,13 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import logging
|
||||
from django.http import Http404
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
from rest_framework import permissions
|
||||
from lib.main.access import *
|
||||
from ansibleworks.main.access import *
|
||||
|
||||
logger = logging.getLogger('lib.main.rbac')
|
||||
logger = logging.getLogger('ansibleworks.main.rbac')
|
||||
|
||||
# FIXME: this will probably need to be subclassed by object type
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
# Django
|
||||
from django.contrib.auth.models import User
|
||||
@ -10,8 +10,8 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||
from rest_framework import serializers, pagination
|
||||
from rest_framework.templatetags.rest_framework import replace_query_param
|
||||
|
||||
# Ansible Commander
|
||||
from lib.main.models import *
|
||||
# AnsibleWorks
|
||||
from ansibleworks.main.models import *
|
||||
|
||||
BASE_FIELDS = ('id', 'url', 'related', 'summary_fields', 'created',
|
||||
'creation_date', 'name', 'description')
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import cStringIO
|
||||
import logging
|
||||
@ -12,12 +12,11 @@ import traceback
|
||||
from celery import Task
|
||||
from django.conf import settings
|
||||
import pexpect
|
||||
from lib.main.models import *
|
||||
from ansibleworks.main.models import *
|
||||
|
||||
__all__ = ['RunJob']
|
||||
|
||||
logger = logging.getLogger('lib.main.tasks')
|
||||
|
||||
logger = logging.getLogger('ansibleworks.main.tasks')
|
||||
|
||||
class RunJob(Task):
|
||||
'''
|
||||
11
ansibleworks/main/tests/__init__.py
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
from ansibleworks.main.tests.organizations import OrganizationsTest
|
||||
from ansibleworks.main.tests.users import UsersTest
|
||||
from ansibleworks.main.tests.inventory import InventoryTest
|
||||
from ansibleworks.main.tests.projects import ProjectsTest
|
||||
from ansibleworks.main.tests.commands import *
|
||||
from ansibleworks.main.tests.tasks import RunJobTest
|
||||
from ansibleworks.main.tests.jobs import *
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import contextlib
|
||||
import datetime
|
||||
@ -12,8 +12,7 @@ from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from lib.main.models import *
|
||||
|
||||
from ansibleworks.main.models import *
|
||||
|
||||
class BaseTestMixin(object):
|
||||
'''
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
import os
|
||||
@ -10,8 +10,8 @@ from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
from django.utils.timezone import now
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTest
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTest
|
||||
|
||||
__all__ = ['RunCommandAsScriptTest', 'AcomInventoryTest',
|
||||
'AcomCallbackEventTest']
|
||||
@ -77,7 +77,7 @@ class RunCommandAsScriptTest(BaseCommandTest):
|
||||
'''
|
||||
|
||||
def test_run_command_as_script(self):
|
||||
from lib.main.management.commands import run_command_as_script
|
||||
from ansibleworks.main.management.commands import run_command_as_script
|
||||
os.environ['ACOM_TEST_DATABASE_NAME'] = settings.DATABASES['default']['NAME']
|
||||
# FIXME: Not sure how to test ImportError for settings module.
|
||||
def run_cmd(name, *args, **kwargs):
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import datetime
|
||||
import json
|
||||
@ -7,8 +7,8 @@ import json
|
||||
from django.contrib.auth.models import User as DjangoUser
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTest
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTest
|
||||
|
||||
class InventoryTest(BaseTest):
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import datetime
|
||||
import json
|
||||
@ -9,8 +9,8 @@ from django.db import transaction
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from django.test.utils import override_settings
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTestMixin
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTestMixin
|
||||
|
||||
__all__ = ['JobTemplateTest', 'JobTest', 'JobStartCancelTest']
|
||||
|
||||
@ -221,9 +221,9 @@ class BaseJobTestMixin(BaseTestMixin):
|
||||
self.team_ops_west.users.add(self.user_iris)
|
||||
|
||||
# Each user has his/her own set of credentials.
|
||||
from lib.main.tests.tasks import (TEST_SSH_KEY_DATA,
|
||||
TEST_SSH_KEY_DATA_LOCKED,
|
||||
TEST_SSH_KEY_DATA_UNLOCK)
|
||||
from ansibleworks.main.tests.tasks import (TEST_SSH_KEY_DATA,
|
||||
TEST_SSH_KEY_DATA_LOCKED,
|
||||
TEST_SSH_KEY_DATA_UNLOCK)
|
||||
self.cred_bob = self.user_bob.credentials.create(
|
||||
ssh_username='bob',
|
||||
ssh_password='ASK',
|
||||
@ -825,7 +825,7 @@ class JobStartCancelTest(BaseJobTestMixin, django.test.TransactionTestCase):
|
||||
self.assertEqual(job.status, 'failed')
|
||||
|
||||
# Test with a job that prompts for SSH unlock key, given the right key.
|
||||
from lib.main.tests.tasks import TEST_SSH_KEY_DATA_UNLOCK
|
||||
from ansibleworks.main.tests.tasks import TEST_SSH_KEY_DATA_UNLOCK
|
||||
job = self.jt_ops_west_run.create_job(
|
||||
credential=self.cred_greg,
|
||||
created_by=self.user_sue,
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import datetime
|
||||
import json
|
||||
@ -8,8 +8,8 @@ from django.contrib.auth.models import User as DjangoUser
|
||||
from django.core.urlresolvers import reverse
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTest
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTest
|
||||
|
||||
class OrganizationsTest(BaseTest):
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import datetime
|
||||
import json
|
||||
@ -8,8 +8,8 @@ from django.contrib.auth.models import User as DjangoUser
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from django.core.urlresolvers import reverse
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTest
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTest
|
||||
|
||||
TEST_PLAYBOOK = '''- hosts: mygroup
|
||||
gather_facts: false
|
||||
@ -1,14 +1,14 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTransactionTest
|
||||
from lib.main.tasks import RunJob
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTransactionTest
|
||||
from ansibleworks.main.tasks import RunJob
|
||||
|
||||
TEST_PLAYBOOK = '''- hosts: test-group
|
||||
gather_facts: False
|
||||
@ -1,13 +1,13 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
import json
|
||||
|
||||
from django.contrib.auth.models import User as DjangoUser
|
||||
import django.test
|
||||
from django.test.client import Client
|
||||
from lib.main.models import *
|
||||
from lib.main.tests.base import BaseTest
|
||||
from ansibleworks.main.models import *
|
||||
from ansibleworks.main.tests.base import BaseTest
|
||||
|
||||
class UsersTest(BaseTest):
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
from django.conf.urls import include, patterns, url as original_url
|
||||
import lib.main.views as views
|
||||
import ansibleworks.main.views as views
|
||||
|
||||
def url(regex, view, kwargs=None, name=None, prefix=''):
|
||||
# Set default name from view name (if a string).
|
||||
@ -10,7 +10,7 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
|
||||
name = view
|
||||
return original_url(regex, view, kwargs, name, prefix)
|
||||
|
||||
organizations_urls = patterns('lib.main.views',
|
||||
organizations_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'organizations_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'organizations_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/audit_trail/$', 'organizations_audit_trail_list'),
|
||||
@ -22,7 +22,7 @@ organizations_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/teams/$', 'organizations_teams_list'),
|
||||
)
|
||||
|
||||
users_urls = patterns('lib.main.views',
|
||||
users_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'users_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'users_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/teams/$', 'users_teams_list'),
|
||||
@ -33,20 +33,20 @@ users_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/permissions/$', 'users_permissions_list'),
|
||||
)
|
||||
|
||||
projects_urls = patterns('lib.main.views',
|
||||
projects_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'projects_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'projects_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/playbooks/$', 'projects_detail_playbooks'),
|
||||
url(r'^(?P<pk>[0-9]+)/organizations/$', 'projects_organizations_list'),
|
||||
)
|
||||
|
||||
audit_trails_urls = patterns('lib.main.views',
|
||||
audit_trails_urls = patterns('ansibleworks.main.views',
|
||||
#url(r'^$', 'audit_trails_list'),
|
||||
#url(r'^(?P<pk>[0-9]+)/$', 'audit_trails_detail'),
|
||||
# ... and ./audit_trails/ on all resources
|
||||
)
|
||||
|
||||
teams_urls = patterns('lib.main.views',
|
||||
teams_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'teams_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'teams_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/projects/$', 'teams_projects_list'),
|
||||
@ -55,7 +55,7 @@ teams_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/permissions/$', 'teams_permissions_list'),
|
||||
)
|
||||
|
||||
inventory_urls = patterns('lib.main.views',
|
||||
inventory_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'inventory_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'inventory_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/hosts/$', 'inventory_hosts_list'),
|
||||
@ -63,7 +63,7 @@ inventory_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/root_groups/$', 'inventory_root_groups_list'),
|
||||
)
|
||||
|
||||
hosts_urls = patterns('lib.main.views',
|
||||
hosts_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'hosts_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'hosts_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/variable_data/$', 'hosts_variable_detail'),
|
||||
@ -71,7 +71,7 @@ hosts_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'host_job_host_summary_list'),
|
||||
)
|
||||
|
||||
groups_urls = patterns('lib.main.views',
|
||||
groups_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'groups_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'groups_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/children/$', 'groups_children_list'),
|
||||
@ -82,28 +82,28 @@ groups_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'group_job_host_summary_list'),
|
||||
)
|
||||
|
||||
variable_data_urls = patterns('lib.main.views',
|
||||
variable_data_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'variable_detail'),
|
||||
# See also variable_data resources on hosts/groups.
|
||||
)
|
||||
|
||||
credentials_urls = patterns('lib.main.views',
|
||||
credentials_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'credentials_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'credentials_detail'),
|
||||
# See also credentials resources on users/teams.
|
||||
)
|
||||
|
||||
permissions_urls = patterns('lib.main.views',
|
||||
permissions_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'permissions_detail'),
|
||||
)
|
||||
|
||||
job_templates_urls = patterns('lib.main.views',
|
||||
job_templates_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'job_template_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'job_template_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/jobs/$', 'job_template_job_list'),
|
||||
)
|
||||
|
||||
jobs_urls = patterns('lib.main.views',
|
||||
jobs_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'job_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'job_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/start/$', 'job_start'),
|
||||
@ -116,21 +116,21 @@ jobs_urls = patterns('lib.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/job_events/$', 'job_job_event_list'),
|
||||
)
|
||||
|
||||
job_host_summary_urls = patterns('lib.main.views',
|
||||
job_host_summary_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'job_host_summary_detail'),
|
||||
)
|
||||
|
||||
job_events_urls = patterns('lib.main.views',
|
||||
job_events_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'job_event_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'job_event_detail'),
|
||||
)
|
||||
|
||||
tags_urls = patterns('lib.main.views',
|
||||
tags_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'tags_detail'),
|
||||
# ... and tag relations on all resources
|
||||
)
|
||||
|
||||
v1_urls = patterns('lib.main.views',
|
||||
v1_urls = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'api_v1_root_view'),
|
||||
url(r'^authtoken/$', 'auth_token_view'),
|
||||
url(r'^me/$', 'users_me_list'),
|
||||
@ -152,7 +152,7 @@ v1_urls = patterns('lib.main.views',
|
||||
url(r'^tags/', include(tags_urls)),
|
||||
)
|
||||
|
||||
urlpatterns = patterns('lib.main.views',
|
||||
urlpatterns = patterns('ansibleworks.main.views',
|
||||
url(r'^$', 'api_root_view'),
|
||||
url(r'^v1/', include(v1_urls)),
|
||||
)
|
||||
@ -1,13 +1,13 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved
|
||||
# All Rights Reserved.
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.shortcuts import get_object_or_404
|
||||
from lib.main.models import *
|
||||
from ansibleworks.main.models import *
|
||||
from django.contrib.auth.models import User
|
||||
from lib.main.serializers import *
|
||||
from lib.main.rbac import *
|
||||
from ansibleworks.main.serializers import *
|
||||
from ansibleworks.main.rbac import *
|
||||
from django.core.urlresolvers import reverse
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
from rest_framework import mixins
|
||||
@ -24,7 +24,7 @@ import re
|
||||
import sys
|
||||
import json as python_json
|
||||
from base_views import *
|
||||
from lib.main.access import *
|
||||
from ansibleworks.main.access import *
|
||||
|
||||
class ApiRootView(APIView):
|
||||
'''
|
||||
2
ansibleworks/middleware/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
12
ansibleworks/middleware/exceptions.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
import traceback
|
||||
from django.http import HttpResponse
|
||||
|
||||
class ExceptionMiddleware(object):
|
||||
|
||||
def process_exception(self, request, exception):
|
||||
# FIXME: Should only format plain text for API exceptions.
|
||||
return HttpResponse(traceback.format_exc(exception), content_type="text/plain", status=500)
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# This file is a utility Ansible plugin that is not part of Ansible Commander
|
||||
# or Ansible. It does not import any ansible-commander code, nor does its
|
||||
# license apply to Ansible or Ansible Commander.
|
||||
# This file is a utility Ansible plugin that is not part of the AnsibleWorks
|
||||
# or Ansible packages. It does not import any code from either package, nor
|
||||
# does its license apply to Ansible or AnsibleWorks.
|
||||
#
|
||||
# Copyright (c) 2013, AnsibleWorks Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
2
ansibleworks/settings/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
@ -24,8 +24,8 @@ ADMINS = (
|
||||
MANAGERS = ADMINS
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'FILTER_BACKEND': 'lib.main.custom_filters.CustomFilterBackend',
|
||||
'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'lib.main.serializers.PaginationSerializer',
|
||||
'FILTER_BACKEND': 'ansibleworks.main.custom_filters.CustomFilterBackend',
|
||||
'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'ansibleworks.main.serializers.PaginationSerializer',
|
||||
'PAGINATE_BY': 25,
|
||||
'PAGINATE_BY_PARAM': 'page_size',
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
@ -106,12 +106,12 @@ ALLOWED_HOSTS = []
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||
'django.core.context_processors.request',
|
||||
'lib.ui.context_processors.settings',
|
||||
'ansibleworks.ui.context_processors.settings',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES += (
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'lib.middleware.exceptions.ExceptionMiddleware',
|
||||
'ansibleworks.middleware.exceptions.ExceptionMiddleware',
|
||||
'django.middleware.transaction.TransactionMiddleware',
|
||||
# middleware loaded after this point will be subject to transactions
|
||||
)
|
||||
@ -120,9 +120,9 @@ TEMPLATE_DIRS = (
|
||||
os.path.join(BASE_DIR, 'templates'),
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'lib.urls'
|
||||
ROOT_URLCONF = 'ansibleworks.urls'
|
||||
|
||||
WSGI_APPLICATION = 'lib.wsgi.application'
|
||||
WSGI_APPLICATION = 'ansibleworks.wsgi.application'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.admin',
|
||||
@ -138,8 +138,8 @@ INSTALLED_APPS = (
|
||||
'django_extensions',
|
||||
'djcelery',
|
||||
'kombu.transport.django',
|
||||
'lib.main',
|
||||
'lib.ui',
|
||||
'ansibleworks.main',
|
||||
'ansibleworks.ui',
|
||||
)
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
@ -245,17 +245,17 @@ LOGGING = {
|
||||
'py.warnings': {
|
||||
'handlers': ['console'],
|
||||
},
|
||||
'lib.main': {
|
||||
'ansibleworks.main': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'filters': []
|
||||
},
|
||||
'lib.main.rbac': {
|
||||
'ansibleworks.main.rbac': {
|
||||
'handlers': ['null'],
|
||||
# Comment the line below to show lots of permissions logging.
|
||||
'propagate': False,
|
||||
},
|
||||
'lib.main.access': {
|
||||
'ansibleworks.main.access': {
|
||||
'handlers': ['null'],
|
||||
# Comment the line below to show lots of permissions logging.
|
||||
'propagate': False,
|
||||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
@ -5,6 +5,9 @@ The user interface to Ansible Commander
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
FIXME: Update the instructions below.
|
||||
|
||||
To use the UI you will first need to complete the installation of Ansible Commander. Within
|
||||
Ansbile Commander you should be able to start the server (make runserver) and log into the
|
||||
admin console. If that all works, then you are ready to install Ansible UI.
|
||||
@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
from django.conf import settings as django_settings
|
||||
|
||||
def settings(request):
|
||||
4
ansibleworks/ui/models.py
Normal file
@ -0,0 +1,4 @@
|
||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
# Empty models file.
|
||||
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |