Rename ansibleworks to awx.
10
.gitignore
vendored
@@ -1,8 +1,8 @@
|
|||||||
ansibleworks/settings/local_settings.py*
|
awx/settings/local_settings.py*
|
||||||
ansibleworks/*.sqlite3
|
awx/*.sqlite3
|
||||||
ansibleworks/projects
|
awx/projects
|
||||||
ansibleworks/public/media
|
awx/public/media
|
||||||
ansibleworks/public/static
|
awx/public/static
|
||||||
env/*
|
env/*
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
|
|||||||
5
COPYING
@@ -1,6 +1,5 @@
|
|||||||
AnsibleWorks is commercial software licensed to you under
|
AWX is commercial software licensed to you under an annual agreement from
|
||||||
an annual agreement from AnsibleWorks.
|
AnsibleWorks.
|
||||||
|
|
||||||
It is free for use for up to five managed servers or virtual instances,
|
It is free for use for up to five managed servers or virtual instances,
|
||||||
after which you must purchase a license.
|
after which you must purchase a license.
|
||||||
|
|
||||||
|
|||||||
21
MANIFEST.in
@@ -1,14 +1,15 @@
|
|||||||
recursive-include ansibleworks *.py
|
recursive-include awx *.py
|
||||||
recursive-include ansibleworks/static *.ico
|
recursive-include awx/static *.ico
|
||||||
recursive-include ansibleworks/templates *.html
|
recursive-include awx/templates *.html
|
||||||
recursive-include ansibleworks/ui *.html *.js
|
recursive-include awx/ui *.html *.js
|
||||||
recursive-include ansibleworks/ui/static *.css *.ico *.png *.gif *.jpg
|
recursive-include awx/ui/static *.css *.ico *.png *.gif *.jpg
|
||||||
recursive-include ansibleworks/ui/static *.eot *.svg *.ttf *.woff *.otf
|
recursive-include awx/ui/static *.eot *.svg *.ttf *.woff *.otf
|
||||||
recursive-include config *
|
recursive-include config *
|
||||||
recursive-exclude ansibleworks/settings local_settings.py
|
recursive-exclude awx devonly.py
|
||||||
|
recursive-exclude awx/settings local_settings.py*
|
||||||
include *.py *.txt *.md
|
include *.py *.txt *.md
|
||||||
include MANIFEST.in
|
include MANIFEST.in
|
||||||
include COPYING
|
include COPYING
|
||||||
prune ansibleworks/public
|
prune awx/public
|
||||||
prune ansibleworks/projects
|
prune awx/projects
|
||||||
prune ansibleworks/ui/static/lib/jstree/_*
|
prune awx/ui/static/lib/jstree/_*
|
||||||
|
|||||||
16
Makefile
@@ -1,6 +1,6 @@
|
|||||||
PYTHON=python
|
PYTHON=python
|
||||||
SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
||||||
RELEASE=ansibleworks-1.2b2
|
RELEASE=awx-1.2b2
|
||||||
|
|
||||||
.PHONY: clean rebase push setup requirements requirements_pypi develop refresh \
|
.PHONY: clean rebase push setup requirements requirements_pypi develop refresh \
|
||||||
adduser syncdb migrate dbchange dbshell runserver celeryd test \
|
adduser syncdb migrate dbchange dbshell runserver celeryd test \
|
||||||
@@ -20,7 +20,7 @@ rebase:
|
|||||||
push:
|
push:
|
||||||
git push origin master
|
git push origin master
|
||||||
|
|
||||||
# Use Ansible to setup AnsibleWorks development environment.
|
# Use Ansible to setup AWX development environment.
|
||||||
setup:
|
setup:
|
||||||
ansible-playbook app_setup/setup.yml --verbose -i "127.0.0.1," -c local -e working_dir=`pwd`
|
ansible-playbook app_setup/setup.yml --verbose -i "127.0.0.1," -c local -e working_dir=`pwd`
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ requirements:
|
|||||||
requirements_pypi:
|
requirements_pypi:
|
||||||
pip install -r requirements/dev.txt
|
pip install -r requirements/dev.txt
|
||||||
|
|
||||||
# "Install" ansibleworks package in development mode. Creates link to working
|
# "Install" awx package in development mode. Creates link to working
|
||||||
# copy in site-packages and installs ansibleworks-manage command.
|
# copy in site-packages and installs awx-manage command.
|
||||||
develop:
|
develop:
|
||||||
python setup.py develop
|
python setup.py develop
|
||||||
|
|
||||||
@@ -60,10 +60,9 @@ migrate: syncdb
|
|||||||
dbchange:
|
dbchange:
|
||||||
python manage.py schemamigration main v12b2_changes --auto
|
python manage.py schemamigration main v12b2_changes --auto
|
||||||
|
|
||||||
# access database shell
|
# access database shell, asks for password
|
||||||
# asks for password # PYTHON_PATH=./acom python acom/manage.py dbshell
|
|
||||||
dbshell:
|
dbshell:
|
||||||
sudo -u postgres psql -d acom
|
sudo -u postgres psql -d awx
|
||||||
|
|
||||||
# Run the built-in development webserver (by default on http://localhost:8013).
|
# Run the built-in development webserver (by default on http://localhost:8013).
|
||||||
runserver:
|
runserver:
|
||||||
@@ -122,5 +121,4 @@ rpm: sdist
|
|||||||
--define "_specdir %{_topdir}" \
|
--define "_specdir %{_topdir}" \
|
||||||
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
|
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
|
||||||
--define "_sourcedir %{_topdir}" \
|
--define "_sourcedir %{_topdir}" \
|
||||||
-ba packaging/rpm/ansibleworks.spec
|
-ba packaging/rpm/awx.spec
|
||||||
|
|
||||||
|
|||||||
13
README.md
@@ -1,15 +1,14 @@
|
|||||||
AnsibleWorks
|
AWX
|
||||||
============
|
===
|
||||||
|
|
||||||
Formerly known as ansible-commander, AnsibleWorks provides a web-based user
|
Formerly known as ansible-commander and AnsibleWorks, AWX provides a web-based
|
||||||
interface and REST API built on top of Ansible.
|
user interface, REST API and task engine built on top of Ansible.
|
||||||
|
|
||||||
The current version under development is 1.2-b2.
|
The current version under development is 1.2-b2.
|
||||||
|
|
||||||
Resources
|
Resources
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Refer to `CONTRIBUTING.md` to get started developing, testing and building
|
Refer to `CONTRIBUTING.md` to get started developing, testing and building AWX.
|
||||||
AnsibleWorks.
|
|
||||||
|
|
||||||
Refer to `setup/README.md` to get started deploying AnsibleWorks.
|
Refer to `setup/README.md` to get started deploying AWX.
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
|
|
||||||
__version__ = '1.2-b2'
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
__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',
|
|
||||||
'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__)
|
|
||||||
else:
|
|
||||||
execute_from_command_line(sys.argv)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# 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.scripts import *
|
|
||||||
from ansibleworks.main.tests.tasks import RunJobTest
|
|
||||||
from ansibleworks.main.tests.jobs import *
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
|
|
||||||
# Development settings for Ansible Commander project.
|
|
||||||
|
|
||||||
from defaults import *
|
|
||||||
|
|
||||||
# If a local_settings.py file is present here, use it and ignore the global
|
|
||||||
# settings. Normally local settings would only be present during development.
|
|
||||||
try:
|
|
||||||
local_settings_file = os.path.join(os.path.dirname(__file__),
|
|
||||||
'local_settings.py')
|
|
||||||
execfile(local_settings_file)
|
|
||||||
# Hack so that the autoreload will detect changes to local_settings.py.
|
|
||||||
class dummymodule(str):
|
|
||||||
__file__ = property(lambda self: self)
|
|
||||||
sys.modules['local_settings'] = dummymodule(local_settings_file)
|
|
||||||
except IOError:
|
|
||||||
# Otherwise, rely on the global settings file specified in the environment,
|
|
||||||
# defaulting to /etc/ansibleworks/settings.py.
|
|
||||||
try:
|
|
||||||
settings_file = os.environ.get('ANSIBLEWORKS_SETTINGS_FILE',
|
|
||||||
'/etc/ansibleworks/settings.py')
|
|
||||||
execfile(settings_file)
|
|
||||||
except IOError:
|
|
||||||
pass
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
|
|
||||||
# Production settings for Ansible Commander project.
|
|
||||||
|
|
||||||
from defaults import *
|
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
# Clear database settings to force production environment to define them.
|
|
||||||
DATABASES = {}
|
|
||||||
|
|
||||||
# Clear the secret key to force production environment to define it.
|
|
||||||
SECRET_KEY = None
|
|
||||||
|
|
||||||
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
|
||||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
|
||||||
ALLOWED_HOSTS = []
|
|
||||||
|
|
||||||
# Production should only use minified JS for UI.
|
|
||||||
# CLH 6/20/13 - leave the following set to False until we actually have minified js ready
|
|
||||||
USE_MINIFIED_JS = False
|
|
||||||
|
|
||||||
INTERNAL_API_URL = 'http://127.0.0.1:80'
|
|
||||||
|
|
||||||
# If a local_settings.py file is present here, use it and ignore the global
|
|
||||||
# settings. Normally, local settings would only be present during development.
|
|
||||||
try:
|
|
||||||
local_settings_file = os.path.join(os.path.dirname(__file__),
|
|
||||||
'local_settings.py')
|
|
||||||
execfile(local_settings_file)
|
|
||||||
except IOError:
|
|
||||||
# Otherwise, rely on the global settings file specified in the environment,
|
|
||||||
# defaulting to /etc/ansibleworks/settings.py.
|
|
||||||
settings_file = os.environ.get('ANSIBLEWORKS_SETTINGS_FILE',
|
|
||||||
'/etc/ansibleworks/settings.py')
|
|
||||||
try:
|
|
||||||
execfile(settings_file)
|
|
||||||
except IOError:
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
raise ImproperlyConfigured('No AnsibleWorks configuration found in %s'\
|
|
||||||
% settings_file)
|
|
||||||
@@ -44,13 +44,13 @@
|
|||||||
# took out parameter... db=acom priv=ALL
|
# took out parameter... db=acom priv=ALL
|
||||||
- name: setup the postgresql user
|
- name: setup the postgresql user
|
||||||
postgresql_user: >
|
postgresql_user: >
|
||||||
name=ansible_commander
|
name=awx
|
||||||
password=${database_password}
|
password=${database_password}
|
||||||
login_user=postgres
|
login_user=postgres
|
||||||
sudo_user: postgres
|
sudo_user: postgres
|
||||||
|
|
||||||
- name: create the database
|
- name: create the database
|
||||||
postgresql_db: name=acom state=present
|
postgresql_db: name=awx state=present
|
||||||
|
|
||||||
- name: configure the database authentication for runtime mode
|
- name: configure the database authentication for runtime mode
|
||||||
template: src=templates/pg_hba.j2 dest=/var/lib/pgsql/data/pg_hba.conf owner=postgres
|
template: src=templates/pg_hba.j2 dest=/var/lib/pgsql/data/pg_hba.conf owner=postgres
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
service: name=postgresql state=restarted
|
service: name=postgresql state=restarted
|
||||||
|
|
||||||
- name: configure python settings (with database password)
|
- name: configure python settings (with database password)
|
||||||
template: src=templates/local_settings.py.j2 dest=${working_dir}/ansibleworks/settings/local_settings.py
|
template: src=templates/local_settings.py.j2 dest=${working_dir}/awx/settings/local_settings.py
|
||||||
|
|
||||||
- name: sync django database
|
- name: sync django database
|
||||||
command: python ${working_dir}/manage.py syncdb --noinput
|
command: python ${working_dir}/manage.py syncdb --noinput
|
||||||
|
|||||||
26
awx/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
__version__ = '1.2-b2'
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
__all__ = ['__version__']
|
||||||
|
|
||||||
|
# Check for the presence/absence of "devonly" module to determine if running
|
||||||
|
# from a source code checkout or release packaage.
|
||||||
|
try:
|
||||||
|
import awx.devonly
|
||||||
|
MODE = 'development'
|
||||||
|
except ImportError:
|
||||||
|
MODE = 'production'
|
||||||
|
|
||||||
|
def manage():
|
||||||
|
# Update the default settings environment variable based on current mode.
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'awx.settings.%s' % MODE)
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'):
|
||||||
|
sys.stdout.write('awx-%s\n' % __version__)
|
||||||
|
else:
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
6
awx/devonly.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
# This file should only be present in a source checkout, and never in a release
|
||||||
|
# package, to allow us to determine whether we're running in a development or
|
||||||
|
# production mode.
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
import logging
|
import logging
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
__all__ = ['get_user_queryset', 'check_user_access']
|
__all__ = ['get_user_queryset', 'check_user_access']
|
||||||
|
|
||||||
logger = logging.getLogger('ansibleworks.main.access')
|
logger = logging.getLogger('awx.main.access')
|
||||||
|
|
||||||
access_registry = {
|
access_registry = {
|
||||||
# <model_class>: [<access_class>, ...],
|
# <model_class>: [<access_class>, ...],
|
||||||
@@ -15,9 +15,9 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.admin import UserAdmin
|
from django.contrib.auth.admin import UserAdmin
|
||||||
|
|
||||||
from ansibleworks.main.compat import format_html
|
from awx.main.compat import format_html
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.forms import *
|
from awx.main.forms import *
|
||||||
|
|
||||||
|
|
||||||
class UserAdmin(UserAdmin):
|
class UserAdmin(UserAdmin):
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
from rest_framework import authentication
|
from rest_framework import authentication
|
||||||
from rest_framework import exceptions
|
from rest_framework import exceptions
|
||||||
|
|
||||||
# AnsibleWorks
|
# AWX
|
||||||
from ansibleworks.main.models import Job
|
from awx.main.models import Job
|
||||||
|
|
||||||
class JobCallbackAuthentication(authentication.BaseAuthentication):
|
class JobCallbackAuthentication(authentication.BaseAuthentication):
|
||||||
'''
|
'''
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from ansibleworks.main.serializers import *
|
from awx.main.serializers import *
|
||||||
from ansibleworks.main.rbac import *
|
from awx.main.rbac import *
|
||||||
from ansibleworks.main.access import *
|
from awx.main.access import *
|
||||||
from rest_framework.exceptions import PermissionDenied
|
from rest_framework.exceptions import PermissionDenied
|
||||||
from rest_framework import mixins
|
from rest_framework import mixins
|
||||||
from rest_framework import generics
|
from rest_framework import generics
|
||||||
@@ -141,10 +141,10 @@ class BaseSubList(BaseList):
|
|||||||
|
|
||||||
if self.__class__.parent_model == Organization:
|
if self.__class__.parent_model == Organization:
|
||||||
organization = Organization.objects.get(pk=data[inject_primary_key])
|
organization = Organization.objects.get(pk=data[inject_primary_key])
|
||||||
import ansibleworks.main.views
|
import awx.main.views
|
||||||
if self.__class__ == ansibleworks.main.views.OrganizationUsersList:
|
if self.__class__ == awx.main.views.OrganizationUsersList:
|
||||||
organization.users.add(obj)
|
organization.users.add(obj)
|
||||||
elif self.__class__ == ansibleworks.main.views.OrganizationAdminsList:
|
elif self.__class__ == awx.main.views.OrganizationAdminsList:
|
||||||
organization.admins.add(obj)
|
organization.admins.add(obj)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -11,8 +11,8 @@ import yaml
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
# AnsibleWorks
|
# AWX
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
EMPTY_CHOICE = ('', '---------')
|
EMPTY_CHOICE = ('', '---------')
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ from django.db import models
|
|||||||
|
|
||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
'''Complete initial migration for AnsibleWorks 1.2-b1 release.'''
|
'''Complete initial migration for AWX 1.2-b1 release.'''
|
||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
# Adding model 'Tag'
|
# Adding model 'Tag'
|
||||||
@@ -7,7 +7,7 @@ from django.db import models
|
|||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
'''
|
'''
|
||||||
Schema migration for AnsibleWorks 1.2-b2 release.
|
Schema migration for AWX 1.2-b2 release.
|
||||||
- Adds variables field on Host and Group models.
|
- Adds variables field on Host and Group models.
|
||||||
- Adds job_tags and host_config_key fields on JobTemplate.
|
- Adds job_tags and host_config_key fields on JobTemplate.
|
||||||
- Adds job_tags, job_args, job_cwd, job_env fields on Job.
|
- Adds job_tags, job_args, job_cwd, job_env fields on Job.
|
||||||
@@ -7,7 +7,7 @@ from django.db import models
|
|||||||
|
|
||||||
class Migration(DataMigration):
|
class Migration(DataMigration):
|
||||||
'''
|
'''
|
||||||
Data migration for AnsibleWorks 1.2-b2 release.
|
Data migration for AWX 1.2-b2 release.
|
||||||
- Update variables from VariableData.data for Host and Group models.
|
- Update variables from VariableData.data for Host and Group models.
|
||||||
- Update new char/text field values to be empty string if they are null.
|
- Update new char/text field values to be empty string if they are null.
|
||||||
- Update failed flag for existing JobHostSummary models.
|
- Update failed flag for existing JobHostSummary models.
|
||||||
@@ -7,7 +7,7 @@ from django.db import models
|
|||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
'''
|
'''
|
||||||
Schema migration for AnsibleWorks 1.2-b2 release.
|
Schema migration for AWX 1.2-b2 release.
|
||||||
- Remove variable_data field on Host and Group models.
|
- Remove variable_data field on Host and Group models.
|
||||||
- Remove VariableData model.
|
- Remove VariableData model.
|
||||||
- Remove null=True on new char fields previously added.
|
- Remove null=True on new char fields previously added.
|
||||||
@@ -7,7 +7,7 @@ from django.db import models
|
|||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
'''
|
'''
|
||||||
Schema migration for AnsibleWorks 1.2-b2 release.
|
Schema migration for AWX 1.2-b2 release.
|
||||||
- Add has_active_failures field on Inventory, Group and Host models.
|
- Add has_active_failures field on Inventory, Group and Host models.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ from django.db import models
|
|||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
'''
|
'''
|
||||||
Schema migration for AnsibleWorks 1.2-b2 release.
|
Schema migration for AWX 1.2-b2 release.
|
||||||
- Add variables field on Inventory model.
|
- Add variables field on Inventory model.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ class EditHelper(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def illegal_changes(cls, request, obj, model_class):
|
def illegal_changes(cls, request, obj, model_class):
|
||||||
''' have any illegal changes been made (for a PUT request)? '''
|
''' have any illegal changes been made (for a PUT request)? '''
|
||||||
from ansibleworks.main.access import check_user_access
|
from awx.main.access import check_user_access
|
||||||
#can_admin = model_class.can_user_administrate(request.user, obj, request.DATA)
|
#can_admin = model_class.can_user_administrate(request.user, obj, request.DATA)
|
||||||
can_admin = check_user_access(request.user, User, 'change', obj, request.DATA)
|
can_admin = check_user_access(request.user, User, 'change', obj, request.DATA)
|
||||||
if (not can_admin) or (can_admin == 'partial'):
|
if (not can_admin) or (can_admin == 'partial'):
|
||||||
@@ -846,7 +846,7 @@ class Job(CommonModel):
|
|||||||
return bool(self.status == 'new')
|
return bool(self.status == 'new')
|
||||||
|
|
||||||
def start(self, **kwargs):
|
def start(self, **kwargs):
|
||||||
from ansibleworks.main.tasks import RunJob
|
from awx.main.tasks import RunJob
|
||||||
if not self.can_start:
|
if not self.can_start:
|
||||||
return False
|
return False
|
||||||
needed = self.get_passwords_needed_to_start()
|
needed = self.get_passwords_needed_to_start()
|
||||||
@@ -5,10 +5,10 @@ import logging
|
|||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from rest_framework.exceptions import PermissionDenied
|
from rest_framework.exceptions import PermissionDenied
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
from ansibleworks.main.access import *
|
from awx.main.access import *
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
logger = logging.getLogger('ansibleworks.main.rbac')
|
logger = logging.getLogger('awx.main.rbac')
|
||||||
|
|
||||||
# FIXME: this will probably need to be subclassed by object type
|
# FIXME: this will probably need to be subclassed by object type
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ from django.core.exceptions import ObjectDoesNotExist
|
|||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
# AnsibleWorks
|
# AWX
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
BASE_FIELDS = ('id', 'url', 'related', 'summary_fields', 'created', 'name',
|
BASE_FIELDS = ('id', 'url', 'related', 'summary_fields', 'created', 'name',
|
||||||
'description')
|
'description')
|
||||||
@@ -12,11 +12,11 @@ import traceback
|
|||||||
from celery import Task
|
from celery import Task
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import pexpect
|
import pexpect
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
__all__ = ['RunJob']
|
__all__ = ['RunJob']
|
||||||
|
|
||||||
logger = logging.getLogger('ansibleworks.main.tasks')
|
logger = logging.getLogger('awx.main.tasks')
|
||||||
|
|
||||||
class RunJob(Task):
|
class RunJob(Task):
|
||||||
'''
|
'''
|
||||||
11
awx/main/tests/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
from awx.main.tests.organizations import OrganizationsTest
|
||||||
|
from awx.main.tests.users import UsersTest
|
||||||
|
from awx.main.tests.inventory import InventoryTest
|
||||||
|
from awx.main.tests.projects import ProjectsTest
|
||||||
|
from awx.main.tests.scripts import *
|
||||||
|
from awx.main.tests.tasks import RunJobTest
|
||||||
|
from awx.main.tests.jobs import *
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ from django.conf import settings
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
import django.test
|
import django.test
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
|
|
||||||
class BaseTestMixin(object):
|
class BaseTestMixin(object):
|
||||||
'''
|
'''
|
||||||
@@ -6,8 +6,8 @@ import json
|
|||||||
|
|
||||||
from django.contrib.auth.models import User as DjangoUser
|
from django.contrib.auth.models import User as DjangoUser
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseTest
|
from awx.main.tests.base import BaseTest
|
||||||
|
|
||||||
class InventoryTest(BaseTest):
|
class InventoryTest(BaseTest):
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ from django.db import transaction
|
|||||||
import django.test
|
import django.test
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseTestMixin
|
from awx.main.tests.base import BaseTestMixin
|
||||||
|
|
||||||
__all__ = ['JobTemplateTest', 'JobTest', 'JobStartCancelTest']
|
__all__ = ['JobTemplateTest', 'JobTest', 'JobStartCancelTest']
|
||||||
|
|
||||||
@@ -221,9 +221,9 @@ class BaseJobTestMixin(BaseTestMixin):
|
|||||||
self.team_ops_west.users.add(self.user_iris)
|
self.team_ops_west.users.add(self.user_iris)
|
||||||
|
|
||||||
# Each user has his/her own set of credentials.
|
# Each user has his/her own set of credentials.
|
||||||
from ansibleworks.main.tests.tasks import (TEST_SSH_KEY_DATA,
|
from awx.main.tests.tasks import (TEST_SSH_KEY_DATA,
|
||||||
TEST_SSH_KEY_DATA_LOCKED,
|
TEST_SSH_KEY_DATA_LOCKED,
|
||||||
TEST_SSH_KEY_DATA_UNLOCK)
|
TEST_SSH_KEY_DATA_UNLOCK)
|
||||||
self.cred_bob = self.user_bob.credentials.create(
|
self.cred_bob = self.user_bob.credentials.create(
|
||||||
ssh_username='bob',
|
ssh_username='bob',
|
||||||
ssh_password='ASK',
|
ssh_password='ASK',
|
||||||
@@ -824,7 +824,7 @@ class JobStartCancelTest(BaseJobTestMixin, django.test.LiveServerTestCase):
|
|||||||
self.assertEqual(job.status, 'failed')
|
self.assertEqual(job.status, 'failed')
|
||||||
|
|
||||||
# Test with a job that prompts for SSH unlock key, given the right key.
|
# Test with a job that prompts for SSH unlock key, given the right key.
|
||||||
from ansibleworks.main.tests.tasks import TEST_SSH_KEY_DATA_UNLOCK
|
from awx.main.tests.tasks import TEST_SSH_KEY_DATA_UNLOCK
|
||||||
job = self.jt_ops_west_run.create_job(
|
job = self.jt_ops_west_run.create_job(
|
||||||
credential=self.cred_greg,
|
credential=self.cred_greg,
|
||||||
created_by=self.user_sue,
|
created_by=self.user_sue,
|
||||||
@@ -8,8 +8,8 @@ from django.contrib.auth.models import User as DjangoUser
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
import django.test
|
import django.test
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseTest
|
from awx.main.tests.base import BaseTest
|
||||||
|
|
||||||
class OrganizationsTest(BaseTest):
|
class OrganizationsTest(BaseTest):
|
||||||
|
|
||||||
@@ -10,8 +10,8 @@ import django.test
|
|||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseTest
|
from awx.main.tests.base import BaseTest
|
||||||
|
|
||||||
TEST_PLAYBOOK = '''- hosts: mygroup
|
TEST_PLAYBOOK = '''- hosts: mygroup
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
@@ -13,9 +13,9 @@ import tempfile
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
# AnsibleWorks
|
# AWX
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseLiveServerTest
|
from awx.main.tests.base import BaseLiveServerTest
|
||||||
|
|
||||||
__all__ = ['InventoryScriptTest']
|
__all__ = ['InventoryScriptTest']
|
||||||
|
|
||||||
@@ -6,9 +6,9 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseLiveServerTest
|
from awx.main.tests.base import BaseLiveServerTest
|
||||||
from ansibleworks.main.tasks import RunJob
|
from awx.main.tasks import RunJob
|
||||||
|
|
||||||
TEST_PLAYBOOK = '''- hosts: test-group
|
TEST_PLAYBOOK = '''- hosts: test-group
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
@@ -8,8 +8,8 @@ import django.test
|
|||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.tests.base import BaseTest
|
from awx.main.tests.base import BaseTest
|
||||||
|
|
||||||
class UsersTest(BaseTest):
|
class UsersTest(BaseTest):
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
|
|||||||
name = view
|
name = view
|
||||||
return original_url(regex, view, kwargs, name, prefix)
|
return original_url(regex, view, kwargs, name, prefix)
|
||||||
|
|
||||||
organization_urls = patterns('ansibleworks.main.views',
|
organization_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'organization_list'),
|
url(r'^$', 'organization_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'organization_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'organization_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/users/$', 'organization_users_list'),
|
url(r'^(?P<pk>[0-9]+)/users/$', 'organization_users_list'),
|
||||||
@@ -19,7 +19,7 @@ organization_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/teams/$', 'organization_teams_list'),
|
url(r'^(?P<pk>[0-9]+)/teams/$', 'organization_teams_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
user_urls = patterns('ansibleworks.main.views',
|
user_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'user_list'),
|
url(r'^$', 'user_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'user_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'user_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/teams/$', 'user_teams_list'),
|
url(r'^(?P<pk>[0-9]+)/teams/$', 'user_teams_list'),
|
||||||
@@ -30,14 +30,14 @@ user_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/permissions/$', 'user_permissions_list'),
|
url(r'^(?P<pk>[0-9]+)/permissions/$', 'user_permissions_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
project_urls = patterns('ansibleworks.main.views',
|
project_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'project_list'),
|
url(r'^$', 'project_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'project_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'project_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/playbooks/$', 'project_detail_playbooks'),
|
url(r'^(?P<pk>[0-9]+)/playbooks/$', 'project_detail_playbooks'),
|
||||||
url(r'^(?P<pk>[0-9]+)/organizations/$', 'project_organizations_list'),
|
url(r'^(?P<pk>[0-9]+)/organizations/$', 'project_organizations_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
team_urls = patterns('ansibleworks.main.views',
|
team_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'team_list'),
|
url(r'^$', 'team_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'team_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'team_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/projects/$', 'team_projects_list'),
|
url(r'^(?P<pk>[0-9]+)/projects/$', 'team_projects_list'),
|
||||||
@@ -46,7 +46,7 @@ team_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/permissions/$', 'team_permissions_list'),
|
url(r'^(?P<pk>[0-9]+)/permissions/$', 'team_permissions_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
inventory_urls = patterns('ansibleworks.main.views',
|
inventory_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'inventory_list'),
|
url(r'^$', 'inventory_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'inventory_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'inventory_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/hosts/$', 'inventory_hosts_list'),
|
url(r'^(?P<pk>[0-9]+)/hosts/$', 'inventory_hosts_list'),
|
||||||
@@ -56,7 +56,7 @@ inventory_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/script/$', 'inventory_script_view'),
|
url(r'^(?P<pk>[0-9]+)/script/$', 'inventory_script_view'),
|
||||||
)
|
)
|
||||||
|
|
||||||
host_urls = patterns('ansibleworks.main.views',
|
host_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'host_list'),
|
url(r'^$', 'host_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'host_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'host_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/variable_data/$', 'host_variable_detail'),
|
url(r'^(?P<pk>[0-9]+)/variable_data/$', 'host_variable_detail'),
|
||||||
@@ -66,7 +66,7 @@ host_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'host_job_host_summaries_list'),
|
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'host_job_host_summaries_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
group_urls = patterns('ansibleworks.main.views',
|
group_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'group_list'),
|
url(r'^$', 'group_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'group_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'group_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/children/$', 'group_children_list'),
|
url(r'^(?P<pk>[0-9]+)/children/$', 'group_children_list'),
|
||||||
@@ -77,23 +77,23 @@ group_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'group_job_host_summaries_list'),
|
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'group_job_host_summaries_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
credential_urls = patterns('ansibleworks.main.views',
|
credential_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'credential_list'),
|
url(r'^$', 'credential_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'credential_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'credential_detail'),
|
||||||
# See also credentials resources on users/teams.
|
# See also credentials resources on users/teams.
|
||||||
)
|
)
|
||||||
|
|
||||||
permission_urls = patterns('ansibleworks.main.views',
|
permission_urls = patterns('awx.main.views',
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'permission_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'permission_detail'),
|
||||||
)
|
)
|
||||||
|
|
||||||
job_template_urls = patterns('ansibleworks.main.views',
|
job_template_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'job_template_list'),
|
url(r'^$', 'job_template_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'job_template_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'job_template_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/jobs/$', 'job_template_jobs_list'),
|
url(r'^(?P<pk>[0-9]+)/jobs/$', 'job_template_jobs_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
job_urls = patterns('ansibleworks.main.views',
|
job_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'job_list'),
|
url(r'^$', 'job_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'job_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'job_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/start/$', 'job_start'),
|
url(r'^(?P<pk>[0-9]+)/start/$', 'job_start'),
|
||||||
@@ -102,18 +102,18 @@ job_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^(?P<pk>[0-9]+)/job_events/$', 'job_job_events_list'),
|
url(r'^(?P<pk>[0-9]+)/job_events/$', 'job_job_events_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
job_host_summary_urls = patterns('ansibleworks.main.views',
|
job_host_summary_urls = patterns('awx.main.views',
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'job_host_summary_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'job_host_summary_detail'),
|
||||||
)
|
)
|
||||||
|
|
||||||
job_event_urls = patterns('ansibleworks.main.views',
|
job_event_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'job_event_list'),
|
url(r'^$', 'job_event_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', 'job_event_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', 'job_event_detail'),
|
||||||
url(r'^(?P<pk>[0-9]+)/children/$', 'job_event_children_list'),
|
url(r'^(?P<pk>[0-9]+)/children/$', 'job_event_children_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/hosts/$', 'job_event_hosts_list'),
|
url(r'^(?P<pk>[0-9]+)/hosts/$', 'job_event_hosts_list'),
|
||||||
)
|
)
|
||||||
|
|
||||||
v1_urls = patterns('ansibleworks.main.views',
|
v1_urls = patterns('awx.main.views',
|
||||||
url(r'^$', 'api_v1_root_view'),
|
url(r'^$', 'api_v1_root_view'),
|
||||||
url(r'^config/$', 'api_v1_config_view'),
|
url(r'^config/$', 'api_v1_config_view'),
|
||||||
url(r'^authtoken/$', 'auth_token_view'),
|
url(r'^authtoken/$', 'auth_token_view'),
|
||||||
@@ -133,7 +133,7 @@ v1_urls = patterns('ansibleworks.main.views',
|
|||||||
url(r'^job_events/', include(job_event_urls)),
|
url(r'^job_events/', include(job_event_urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns = patterns('ansibleworks.main.views',
|
urlpatterns = patterns('awx.main.views',
|
||||||
url(r'^$', 'api_root_view'),
|
url(r'^$', 'api_root_view'),
|
||||||
url(r'^v1/', include(v1_urls)),
|
url(r'^v1/', include(v1_urls)),
|
||||||
)
|
)
|
||||||
@@ -24,13 +24,13 @@ from rest_framework.response import Response
|
|||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
# AnsibleWorks
|
# AWX
|
||||||
from ansibleworks.main.access import *
|
from awx.main.access import *
|
||||||
from ansibleworks.main.authentication import JobCallbackAuthentication
|
from awx.main.authentication import JobCallbackAuthentication
|
||||||
from ansibleworks.main.base_views import *
|
from awx.main.base_views import *
|
||||||
from ansibleworks.main.models import *
|
from awx.main.models import *
|
||||||
from ansibleworks.main.rbac import *
|
from awx.main.rbac import *
|
||||||
from ansibleworks.main.serializers import *
|
from awx.main.serializers import *
|
||||||
|
|
||||||
def handle_error(request, status=404):
|
def handle_error(request, status=404):
|
||||||
context = {}
|
context = {}
|
||||||
@@ -53,7 +53,7 @@ def handle_500(request):
|
|||||||
|
|
||||||
class ApiRootView(APIView):
|
class ApiRootView(APIView):
|
||||||
'''
|
'''
|
||||||
This resource is the root of the AnsibleWorks REST API and provides
|
This resource is the root of the AWX REST API and provides
|
||||||
information about the available API versions.
|
information about the available API versions.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ class ApiRootView(APIView):
|
|||||||
|
|
||||||
current = reverse('main:api_v1_root_view', args=[])
|
current = reverse('main:api_v1_root_view', args=[])
|
||||||
data = dict(
|
data = dict(
|
||||||
description = 'AnsibleWorks REST API',
|
description = 'AWX REST API',
|
||||||
current_version = current,
|
current_version = current,
|
||||||
available_versions = dict(
|
available_versions = dict(
|
||||||
v1 = current
|
v1 = current
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
# This file is a utility Ansible plugin that is not part of the AnsibleWorks
|
# This file is a utility Ansible plugin that is not part of the AWX or Ansible
|
||||||
# or Ansible packages. It does not import any code from either package, nor
|
# packages. It does not import any code from either package, nor does its
|
||||||
# does its license apply to Ansible or AnsibleWorks.
|
# license apply to Ansible or AWX.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
@@ -1,7 +1,35 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# Copyright (c) 2013 AnsibleWorks, Inc.
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
# All Rights Reserved.
|
# This file is a utility script that is not part of the AWX or Ansible
|
||||||
|
# packages. It does not import any code from either package, nor does its
|
||||||
|
# license apply to Ansible or AWX.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# Neither the name of the <ORGANIZATION> nor the names of its contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
import json
|
import json
|
||||||
@@ -26,9 +26,9 @@ MANAGERS = ADMINS
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'acom.sqlite3'),
|
'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'),
|
||||||
# Test database cannot be :memory: for celery/inventory tests to work.
|
# Test database cannot be :memory: for celery/inventory tests to work.
|
||||||
'TEST_NAME': os.path.join(BASE_DIR, 'acom_test.sqlite3'),
|
'TEST_NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ ALLOWED_HOSTS = []
|
|||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||||
'django.core.context_processors.request',
|
'django.core.context_processors.request',
|
||||||
'ansibleworks.ui.context_processors.settings',
|
'awx.ui.context_processors.settings',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES += (
|
MIDDLEWARE_CLASSES += (
|
||||||
'ansibleworks.middleware.exceptions.ExceptionMiddleware',
|
'awx.middleware.exceptions.ExceptionMiddleware',
|
||||||
'django.middleware.transaction.TransactionMiddleware',
|
'django.middleware.transaction.TransactionMiddleware',
|
||||||
# middleware loaded after this point will be subject to transactions
|
# middleware loaded after this point will be subject to transactions
|
||||||
)
|
)
|
||||||
@@ -107,9 +107,9 @@ TEMPLATE_DIRS = (
|
|||||||
os.path.join(BASE_DIR, 'templates'),
|
os.path.join(BASE_DIR, 'templates'),
|
||||||
)
|
)
|
||||||
|
|
||||||
ROOT_URLCONF = 'ansibleworks.urls'
|
ROOT_URLCONF = 'awx.urls'
|
||||||
|
|
||||||
WSGI_APPLICATION = 'ansibleworks.wsgi.application'
|
WSGI_APPLICATION = 'awx.wsgi.application'
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
@@ -126,14 +126,14 @@ INSTALLED_APPS = (
|
|||||||
'djcelery',
|
'djcelery',
|
||||||
'kombu.transport.django',
|
'kombu.transport.django',
|
||||||
'taggit',
|
'taggit',
|
||||||
'ansibleworks.main',
|
'awx.main',
|
||||||
'ansibleworks.ui',
|
'awx.ui',
|
||||||
)
|
)
|
||||||
|
|
||||||
INTERNAL_IPS = ('127.0.0.1',)
|
INTERNAL_IPS = ('127.0.0.1',)
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'ansibleworks.main.pagination.PaginationSerializer',
|
'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'awx.main.pagination.PaginationSerializer',
|
||||||
'PAGINATE_BY': 25,
|
'PAGINATE_BY': 25,
|
||||||
'PAGINATE_BY_PARAM': 'page_size',
|
'PAGINATE_BY_PARAM': 'page_size',
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
@@ -142,7 +142,7 @@ REST_FRAMEWORK = {
|
|||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
),
|
),
|
||||||
'DEFAULT_FILTER_BACKENDS': (
|
'DEFAULT_FILTER_BACKENDS': (
|
||||||
'ansibleworks.main.custom_filters.CustomFilterBackend',
|
'awx.main.custom_filters.CustomFilterBackend',
|
||||||
),
|
),
|
||||||
'DEFAULT_PARSER_CLASSES': (
|
'DEFAULT_PARSER_CLASSES': (
|
||||||
'rest_framework.parsers.JSONParser',
|
'rest_framework.parsers.JSONParser',
|
||||||
@@ -151,7 +151,7 @@ REST_FRAMEWORK = {
|
|||||||
),
|
),
|
||||||
'DEFAULT_RENDERER_CLASSES': (
|
'DEFAULT_RENDERER_CLASSES': (
|
||||||
'rest_framework.renderers.JSONRenderer',
|
'rest_framework.renderers.JSONRenderer',
|
||||||
'ansibleworks.main.renderers.BrowsableAPIRenderer',
|
'awx.main.renderers.BrowsableAPIRenderer',
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ DEFAULT_FROM_EMAIL = 'webmaster@localhost'
|
|||||||
|
|
||||||
# Subject-line prefix for email messages send with django.core.mail.mail_admins
|
# Subject-line prefix for email messages send with django.core.mail.mail_admins
|
||||||
# or ...mail_managers. Make sure to include the trailing space.
|
# or ...mail_managers. Make sure to include the trailing space.
|
||||||
EMAIL_SUBJECT_PREFIX = '[AnsibleWorks] '
|
EMAIL_SUBJECT_PREFIX = '[AWX] '
|
||||||
|
|
||||||
# The email backend to use. For possible shortcuts see django.core.mail.
|
# The email backend to use. For possible shortcuts see django.core.mail.
|
||||||
# The default is to use the SMTP backend.
|
# The default is to use the SMTP backend.
|
||||||
@@ -252,7 +252,7 @@ LOGGING = {
|
|||||||
'()': 'django.utils.log.RequireDebugFalse',
|
'()': 'django.utils.log.RequireDebugFalse',
|
||||||
},
|
},
|
||||||
'require_debug_true': {
|
'require_debug_true': {
|
||||||
'()': 'ansibleworks.main.compat.RequireDebugTrue',
|
'()': 'awx.main.compat.RequireDebugTrue',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'formatters': {
|
'formatters': {
|
||||||
@@ -298,16 +298,16 @@ LOGGING = {
|
|||||||
'py.warnings': {
|
'py.warnings': {
|
||||||
'handlers': ['console'],
|
'handlers': ['console'],
|
||||||
},
|
},
|
||||||
'ansibleworks': {
|
'awx': {
|
||||||
'handlers': ['console', 'file', 'syslog'],
|
'handlers': ['console', 'file', 'syslog'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
'ansibleworks.main.rbac': {
|
'awx.main.rbac': {
|
||||||
'handlers': ['null'],
|
'handlers': ['null'],
|
||||||
# Comment the line below to show lots of permissions logging.
|
# Comment the line below to show lots of permissions logging.
|
||||||
'propagate': False,
|
'propagate': False,
|
||||||
},
|
},
|
||||||
'ansibleworks.main.access': {
|
'awx.main.access': {
|
||||||
'handlers': ['null'],
|
'handlers': ['null'],
|
||||||
# Comment the line below to show lots of permissions logging.
|
# Comment the line below to show lots of permissions logging.
|
||||||
'propagate': False,
|
'propagate': False,
|
||||||
20
awx/settings/development.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
# Development settings for AWX project.
|
||||||
|
|
||||||
|
from defaults import *
|
||||||
|
|
||||||
|
# If a local_settings.py file is present in awx/settings/, use it to override
|
||||||
|
# default settings for development. If not present, we can still run using
|
||||||
|
# the defaults.
|
||||||
|
try:
|
||||||
|
local_settings_file = os.path.join(os.path.dirname(__file__),
|
||||||
|
'local_settings.py')
|
||||||
|
execfile(local_settings_file)
|
||||||
|
# Hack so that the autoreload will detect changes to local_settings.py.
|
||||||
|
class dummymodule(str):
|
||||||
|
__file__ = property(lambda self: self)
|
||||||
|
sys.modules['local_settings'] = dummymodule(local_settings_file)
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
84
awx/settings/local_settings.py.example
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
# Local Django settings for AWX project. Rename to "local_settings.py" and
|
||||||
|
# edit as needed for your development environment.
|
||||||
|
|
||||||
|
ADMINS = (
|
||||||
|
# ('Your Name', 'your_email@domain.com'),
|
||||||
|
)
|
||||||
|
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
# Database settings to use PostgreSQL for development.
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
'NAME': 'awx',
|
||||||
|
'USER': 'awx',
|
||||||
|
'PASSWORD': 'AWXsome!',
|
||||||
|
'HOST': '',
|
||||||
|
'PORT': '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Continue to use SQLite for unit tests instead of PostgreSQL.
|
||||||
|
if 'test' in sys.argv:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'),
|
||||||
|
# Test database cannot be :memory: for celery/inventory tests to work.
|
||||||
|
'TEST_NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory to host projects (with playbooks).
|
||||||
|
# This directory should NOT be web-accessible.
|
||||||
|
PROJECTS_ROOT = os.path.join(BASE_DIR, 'projects')
|
||||||
|
|
||||||
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
# although not all choices may be available on all operating systems.
|
||||||
|
# On Unix systems, a value of None will cause Django to use the same
|
||||||
|
# timezone as the operating system.
|
||||||
|
# If running in a Windows environment this must be set to the same as your
|
||||||
|
# system time zone.
|
||||||
|
TIME_ZONE = 'America/New_York'
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
# Hardcoded values can leak through source control. Consider loading
|
||||||
|
# the secret key from an environment variable or a file instead.
|
||||||
|
SECRET_KEY = 'p7z7g1ql4%6+(6nlebb6hdk7sd^&fnjpal308%n%+p^_e6vo1y'
|
||||||
|
|
||||||
|
# Email address that error messages come from.
|
||||||
|
SERVER_EMAIL = 'root@localhost'
|
||||||
|
|
||||||
|
# The email backend to use. For possible shortcuts see django.core.mail.
|
||||||
|
# The default is to use the SMTP backend.
|
||||||
|
# Third-party backends can be specified by providing a Python path
|
||||||
|
# to a module that defines an EmailBackend class.
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
|
|
||||||
|
# Host for sending email.
|
||||||
|
EMAIL_HOST = 'localhost'
|
||||||
|
|
||||||
|
# Port for sending email.
|
||||||
|
EMAIL_PORT = 25
|
||||||
|
|
||||||
|
# Optional SMTP authentication information for EMAIL_HOST.
|
||||||
|
EMAIL_HOST_USER = ''
|
||||||
|
EMAIL_HOST_PASSWORD = ''
|
||||||
|
EMAIL_USE_TLS = False
|
||||||
|
|
||||||
|
# Default email address to use for various automated correspondence from
|
||||||
|
# the site managers.
|
||||||
|
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
|
||||||
|
|
||||||
|
# Subject-line prefix for email messages send with django.core.mail.mail_admins
|
||||||
|
# or ...mail_managers. Make sure to include the trailing space.
|
||||||
|
EMAIL_SUBJECT_PREFIX = '[AWX] '
|
||||||
36
awx/settings/production.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
# Production settings for AWX project.
|
||||||
|
|
||||||
|
from defaults import *
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
|
# Clear database settings to force production environment to define them.
|
||||||
|
DATABASES = {}
|
||||||
|
|
||||||
|
# Clear the secret key to force production environment to define it.
|
||||||
|
SECRET_KEY = None
|
||||||
|
|
||||||
|
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
||||||
|
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
# Production should only use minified JS for UI.
|
||||||
|
# CLH 6/20/13 - leave the following set to False until we actually have minified js ready
|
||||||
|
USE_MINIFIED_JS = False
|
||||||
|
|
||||||
|
INTERNAL_API_URL = 'http://127.0.0.1:80'
|
||||||
|
|
||||||
|
# Load remaining settings from the global settings file specified in the
|
||||||
|
# environment, defaulting to /etc/awx/settings.py.
|
||||||
|
settings_file = os.environ.get('AWX_SETTINGS_FILE',
|
||||||
|
'/etc/awx/settings.py')
|
||||||
|
try:
|
||||||
|
execfile(settings_file)
|
||||||
|
except IOError:
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
raise ImproperlyConfigured('No AWX configuration found in %s'\
|
||||||
|
% settings_file)
|
||||||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
@@ -2,7 +2,7 @@
|
|||||||
{% extends "admin/base.html" %}
|
{% extends "admin/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{{ title }} | {% trans 'AnsibleWorks Admin' %}{% endblock %}
|
{% block title %}{{ title }} | {% trans 'AWX Admin' %}{% endblock %}
|
||||||
|
|
||||||
{% block extrastyle %}
|
{% block extrastyle %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
@@ -172,7 +172,7 @@ if (django.jQuery) {
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block branding %}
|
{% block branding %}
|
||||||
<h1 id="site-name">{% trans 'AnsibleWorks Admin' %}</h1>
|
<h1 id="site-name">{% trans 'AWX Admin' %}</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block userlinks %}
|
{% block userlinks %}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends 'rest_framework/base.html' %}
|
{% extends 'rest_framework/base.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans 'AnsibleWorks REST API' %}{% endblock %}
|
{% block title %}{% trans 'AWX REST API' %}{% endblock %}
|
||||||
|
|
||||||
{% block style %}
|
{% block style %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
2
awx/ui/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 333 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |