Mass rename from ansible_(awx|tower) -> (awx|tower)

This commit is contained in:
Matthew Jones 2017-07-26 10:58:46 -04:00
parent 22e1e14c4f
commit c7a85d9738
35 changed files with 74 additions and 74 deletions

View File

@ -7,7 +7,7 @@ import warnings
from pkg_resources import get_distribution
__version__ = get_distribution('ansible-awx').version
__version__ = get_distribution('awx').version
__all__ = ['__version__']

View File

@ -20,7 +20,7 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import ParseError, PermissionDenied
from rest_framework.filters import BaseFilterBackend
# Ansible Tower
# AWX
from awx.main.utils import get_type_for_model, to_python_boolean
from awx.main.models.credential import CredentialType
from awx.main.models.rbac import RoleAncestorEntry

View File

@ -16,7 +16,7 @@ from rest_framework import serializers
from rest_framework.relations import RelatedField, ManyRelatedField
from rest_framework.request import clone_request
# Ansible Tower
# AWX
from awx.main.models import InventorySource, NotificationTemplate

View File

@ -1,4 +1,4 @@
The root of the Ansible Tower REST API.
The root of the REST API.
Make a GET request to this resource to obtain information about the available
API versions.

View File

@ -1,4 +1,4 @@
Version 2 of the Ansible Tower REST API.
Version 2 of the REST API.
Make a GET request to this resource to obtain a list of all child resources
available via the API.

View File

@ -180,10 +180,10 @@ def run_isolated_job(private_data_dir, secrets, logfile=sys.stdout):
pexpect_timeout = secrets.get('pexpect_timeout', 5)
# Use local callback directory
callback_dir = os.getenv('TOWER_LIB_DIRECTORY')
callback_dir = os.getenv('AWX_LIB_DIRECTORY')
if callback_dir is None:
raise RuntimeError('Location for Tower Ansible callbacks must be specified '
'by environment variable TOWER_LIB_DIRECTORY.')
raise RuntimeError('Location for callbacks must be specified '
'by environment variable AWX_LIB_DIRECTORY.')
env['ANSIBLE_CALLBACK_PLUGINS'] = os.path.join(callback_dir, 'isolated_callbacks')
if 'AD_HOC_COMMAND_ID' in env:
env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal'

View File

@ -20,7 +20,7 @@ from taggit.managers import TaggableManager
# Django-CRUM
from crum import get_current_user
# Ansible Tower
# AWX
from awx.main.utils import encrypt_field
__all__ = ['prevent_search', 'VarsDictProperty', 'BaseModel', 'CreatedModifiedModel',

View File

@ -19,7 +19,7 @@ __all__ = ('Instance', 'InstanceGroup', 'JobOrigin', 'TowerScheduleState',)
class Instance(models.Model):
"""A model representing an Ansible Tower instance running against this database."""
"""A model representing an AWX instance running against this database."""
objects = InstanceManager()
uuid = models.CharField(max_length=40)
@ -51,11 +51,11 @@ class Instance(models.Model):
@property
def role(self):
# NOTE: TODO: Likely to repurpose this once standalone ramparts are a thing
return "tower"
return "awx"
class InstanceGroup(models.Model):
"""A model representing a Queue/Group of Tower Instances."""
"""A model representing a Queue/Group of AWX Instances."""
name = models.CharField(max_length=250, unique=True)
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)

View File

@ -194,11 +194,11 @@ class JobNotificationMixin(object):
def _build_notification_message(self, status_str):
notification_body = self.notification_data()
notification_subject = u"{} #{} '{}' {} on Ansible Tower: {}".format(self.get_notification_friendly_name(),
self.id,
self.name,
status_str,
notification_body['url'])
notification_subject = u"{} #{} '{}' {}: {}".format(self.get_notification_friendly_name(),
self.id,
self.name,
status_str,
notification_body['url'])
notification_body['friendly_name'] = self.get_notification_friendly_name()
return (notification_subject, notification_body)

View File

@ -14,7 +14,7 @@ class TowerBaseEmailBackend(BaseEmailBackend):
if "body" in body:
body_actual = body['body']
else:
body_actual = smart_text(_("{} #{} had status {} on Ansible Tower, view details at {}\n\n").format(
body_actual = smart_text(_("{} #{} had status {}, view details at {}\n\n").format(
body['friendly_name'], body['id'], body['status'], body['url'])
)
body_actual += json.dumps(body, indent=4)

View File

@ -43,8 +43,8 @@ from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
# AWX
from awx import __version__ as tower_application_version
from awx.main.constants import CLOUD_PROVIDERS, PRIVILEGE_ESCALATION_METHODS
from awx import __version__ as awx_application_version
from awx.main.constants import CLOUD_PROVIDERS
from awx.main.models import * # noqa
from awx.main.models.unified_jobs import ACTIVE_STATES
from awx.main.queue import CallbackQueueDispatcher
@ -188,7 +188,7 @@ def cluster_node_heartbeat(self):
if inst.exists():
inst = inst[0]
inst.capacity = get_system_task_capacity()
inst.version = tower_application_version
inst.version = awx_application_version
inst.save()
else:
raise RuntimeError("Cluster Host Not Found: {}".format(settings.CLUSTER_HOST_ID))
@ -197,7 +197,7 @@ def cluster_node_heartbeat(self):
for other_inst in recent_inst:
if other_inst.version == "":
continue
if Version(other_inst.version.split('-', 1)[0]) > Version(tower_application_version) and not settings.DEBUG:
if Version(other_inst.version.split('-', 1)[0]) > Version(awx_application_version) and not settings.DEBUG:
logger.error("Host {} reports version {}, but this node {} is at {}, shutting down".format(other_inst.hostname,
other_inst.version,
inst.hostname,
@ -478,7 +478,7 @@ class BaseTask(LogErrorsTask):
'''
Create a temporary directory for job-related files.
'''
path = tempfile.mkdtemp(prefix='ansible_awx_%s_' % instance.pk, dir=settings.AWX_PROOT_BASE_PATH)
path = tempfile.mkdtemp(prefix='awx_%s_' % instance.pk, dir=settings.AWX_PROOT_BASE_PATH)
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
self.cleanup_paths.append(path)
return path
@ -541,7 +541,7 @@ class BaseTask(LogErrorsTask):
'': '',
}
def add_ansible_venv(self, env, add_tower_lib=True):
def add_ansible_venv(self, env, add_awx_lib=True):
env['VIRTUAL_ENV'] = settings.ANSIBLE_VENV_PATH
env['PATH'] = os.path.join(settings.ANSIBLE_VENV_PATH, "bin") + ":" + env['PATH']
venv_libdir = os.path.join(settings.ANSIBLE_VENV_PATH, "lib")
@ -551,11 +551,11 @@ class BaseTask(LogErrorsTask):
env['PYTHONPATH'] = os.path.join(venv_libdir, python_ver, "site-packages") + ":"
break
# Add awx/lib to PYTHONPATH.
if add_tower_lib:
if add_awx_lib:
env['PYTHONPATH'] = env.get('PYTHONPATH', '') + self.get_path_to('..', 'lib') + ':'
return env
def add_tower_venv(self, env):
def add_awx_venv(self, env):
env['VIRTUAL_ENV'] = settings.AWX_VENV_PATH
env['PATH'] = os.path.join(settings.AWX_VENV_PATH, "bin") + ":" + env['PATH']
return env
@ -576,7 +576,7 @@ class BaseTask(LogErrorsTask):
# callbacks to work.
# Update PYTHONPATH to use local site-packages.
# NOTE:
# Derived class should call add_ansible_venv() or add_tower_venv()
# Derived class should call add_ansible_venv() or add_awx_venv()
if self.should_use_proot(instance, **kwargs):
env['PROOT_TMP_DIR'] = settings.AWX_PROOT_BASE_PATH
return env
@ -612,7 +612,7 @@ class BaseTask(LogErrorsTask):
# For isolated jobs, we have to interact w/ the REST API from the
# controlling node and ship the static JSON inventory to the
# isolated host (because the isolated host itself can't reach the
# Tower REST API to fetch the inventory).
# REST API to fetch the inventory).
path = os.path.join(kwargs['private_data_dir'], 'inventory')
if os.path.exists(path):
return path
@ -932,7 +932,7 @@ class RunJob(BaseTask):
plugin_dirs.extend(settings.AWX_ANSIBLE_CALLBACK_PLUGINS)
plugin_path = ':'.join(plugin_dirs)
env = super(RunJob, self).build_env(job, **kwargs)
env = self.add_ansible_venv(env, add_tower_lib=kwargs.get('isolated', False))
env = self.add_ansible_venv(env, add_awx_lib=kwargs.get('isolated', False))
# Set environment variables needed for inventory and job event
# callbacks to work.
env['JOB_ID'] = str(job.pk)
@ -1073,7 +1073,7 @@ class RunJob(BaseTask):
if job.start_at_task:
args.append('--start-at-task=%s' % job.start_at_task)
# Define special extra_vars for Tower, combine with job.extra_vars.
# Define special extra_vars for AWX, combine with job.extra_vars.
extra_vars = {
'tower_job_id': job.pk,
'tower_job_launch_type': job.launch_type,
@ -1738,7 +1738,7 @@ class RunInventoryUpdate(BaseTask):
"""
env = super(RunInventoryUpdate, self).build_env(inventory_update,
**kwargs)
env = self.add_tower_venv(env)
env = self.add_awx_venv(env)
# Pass inventory source ID to inventory script.
env['INVENTORY_SOURCE_ID'] = str(inventory_update.inventory_source_id)
env['INVENTORY_UPDATE_ID'] = str(inventory_update.pk)
@ -1748,7 +1748,7 @@ class RunInventoryUpdate(BaseTask):
# These are set here and then read in by the various Ansible inventory
# modules, which will actually do the inventory sync.
#
# The inventory modules are vendored in Tower in the
# The inventory modules are vendored in AWX in the
# `awx/plugins/inventory` directory; those files should be kept in
# sync with those in Ansible core at all times.
passwords = kwargs.get('passwords', {})
@ -1820,9 +1820,9 @@ class RunInventoryUpdate(BaseTask):
src = inventory_update.source
# Add several options to the shell arguments based on the
# inventory-source-specific setting in the Tower configuration.
# inventory-source-specific setting in the AWX configuration.
# These settings are "per-source"; it's entirely possible that
# they will be different between cloud providers if a Tower user
# they will be different between cloud providers if an AWX user
# actively uses more than one.
if getattr(settings, '%s_ENABLED_VAR' % src.upper(), False):
args.extend(['--enabled-var',
@ -1852,7 +1852,7 @@ class RunInventoryUpdate(BaseTask):
elif src == 'scm':
args.append(inventory_update.get_actual_source_path())
elif src == 'custom':
runpath = tempfile.mkdtemp(prefix='ansible_awx_inventory_', dir=settings.AWX_PROOT_BASE_PATH)
runpath = tempfile.mkdtemp(prefix='awx_inventory_', dir=settings.AWX_PROOT_BASE_PATH)
handle, path = tempfile.mkstemp(dir=runpath)
f = os.fdopen(handle, 'w')
if inventory_update.source_script is None:
@ -2139,7 +2139,7 @@ class RunSystemJob(BaseTask):
def build_env(self, instance, **kwargs):
env = super(RunSystemJob, self).build_env(instance,
**kwargs)
env = self.add_tower_venv(env)
env = self.add_awx_venv(env)
return env
def build_cwd(self, instance, **kwargs):

View File

@ -37,10 +37,10 @@ class BaseJobTestMixin(BaseTestMixin):
return inventory
def populate(self):
# Here's a little story about the Ansible Bread Company, or ABC. They
# Here's a little story about the AWX Bread Company, or ABC. They
# make machines that make bread - bakers, slicers, and packagers - and
# these machines are each controlled by a Linux boxes, which is in turn
# managed by Ansible Commander.
# managed by AWX.
# Sue is the super user. You don't mess with Sue or you're toast. Ha.
self.user_sue = self.make_user('sue', super_user=True)

View File

@ -181,7 +181,7 @@ class TestJobExecution:
EXAMPLE_PRIVATE_KEY = '-----BEGIN PRIVATE KEY-----\nxyz==\n-----END PRIVATE KEY-----'
def setup_method(self, method):
self.project_path = tempfile.mkdtemp(prefix='ansible_awx_project_')
self.project_path = tempfile.mkdtemp(prefix='awx_project_')
with open(os.path.join(self.project_path, 'helloworld.yml'), 'w') as f:
f.write('---')
@ -312,7 +312,7 @@ class TestIsolatedExecution(TestJobExecution):
credential.inputs['password'] = encrypt_field(credential, 'password')
self.instance.credential = credential
private_data = tempfile.mkdtemp(prefix='ansible_awx_')
private_data = tempfile.mkdtemp(prefix='awx_')
self.task.build_private_data_dir = mock.Mock(return_value=private_data)
inventory = json.dumps({"all": {"hosts": ["localhost"]}})
@ -351,7 +351,7 @@ class TestIsolatedExecution(TestJobExecution):
extra_vars = json.loads(extra_vars)
assert extra_vars['dest'] == '/tmp'
assert extra_vars['src'] == private_data
assert extra_vars['proot_temp_dir'].startswith('/tmp/ansible_awx_proot_')
assert extra_vars['proot_temp_dir'].startswith('/tmp/awx_proot_')
def test_systemctl_failure(self):
# If systemctl fails, read the contents of `artifacts/systemctl_logs`
@ -364,7 +364,7 @@ class TestIsolatedExecution(TestJobExecution):
)
self.instance.credential = credential
private_data = tempfile.mkdtemp(prefix='ansible_awx_')
private_data = tempfile.mkdtemp(prefix='awx_')
self.task.build_private_data_dir = mock.Mock(return_value=private_data)
inventory = json.dumps({"all": {"hosts": ["localhost"]}})
@ -464,7 +464,7 @@ class TestJobCredentials(TestJobExecution):
)
return ['successful', 0]
private_data = tempfile.mkdtemp(prefix='ansible_awx_')
private_data = tempfile.mkdtemp(prefix='awx_')
self.task.build_private_data_dir = mock.Mock(return_value=private_data)
self.run_pexpect.side_effect = partial(run_pexpect_side_effect, private_data)
self.task.run(self.pk, private_data_dir=private_data)
@ -1145,7 +1145,7 @@ class TestProjectUpdateCredentials(TestJobExecution):
assert 'bob' in kwargs.get('expect_passwords').values()
return ['successful', 0]
private_data = tempfile.mkdtemp(prefix='ansible_awx_')
private_data = tempfile.mkdtemp(prefix='awx_')
self.task.build_private_data_dir = mock.Mock(return_value=private_data)
self.run_pexpect.side_effect = partial(run_pexpect_side_effect, private_data)
self.task.run(self.pk)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ansible Tower by Red Hat
# Copyright (c) 2017 Ansible by Red Hat
# All Rights Reserved.
# AWX

View File

@ -152,12 +152,12 @@ def get_ssh_version():
def get_awx_version():
'''
Return Ansible Tower version as reported by setuptools.
Return AWX version as reported by setuptools.
'''
from awx import __version__
try:
import pkg_resources
return pkg_resources.require('ansible-awx')[0].version
return pkg_resources.require('awx')[0].version
except:
return __version__
@ -655,7 +655,7 @@ def build_proot_temp_dir():
Create a temporary directory for proot to use.
'''
from django.conf import settings
path = tempfile.mkdtemp(prefix='ansible_awx_proot_', dir=settings.AWX_PROOT_BASE_PATH)
path = tempfile.mkdtemp(prefix='awx_proot_', dir=settings.AWX_PROOT_BASE_PATH)
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
return path

View File

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ansible Tower by Red Hat
# Copyright (c) 2017 Ansible by Red Hat
# All Rights Reserved.
# Python
@ -134,7 +134,7 @@ class BaseHandler(logging.Handler):
# Don't send handler-related records.
if logger_name == logger.name:
return True
# Tower log emission is only turned off by enablement setting
# AWX log emission is only turned off by enablement setting
if not logger_name.startswith('awx.analytics'):
return False
return self.enabled_loggers is None or logger_name[len('awx.analytics.'):] not in self.enabled_loggers
@ -216,7 +216,7 @@ class BaseHTTPSHandler(BaseHandler):
logger = logging.getLogger(__file__)
fn, lno, func = logger.findCaller()
record = logger.makeRecord('awx', 10, fn, lno,
'Ansible Tower Connection Test', tuple(),
'AWX Connection Test', tuple(),
None, func)
futures = handler.emit(record)
for future in futures:

View File

@ -95,7 +95,7 @@ class MemHost(MemObject):
self.instance_id = None
self.name = name
if port:
# was `ansible_ssh_port` in older Ansible/Tower versions
# was `ansible_ssh_port` in older Ansible versions
self.variables['ansible_port'] = port
logger.debug('Loaded host: %s', self.name)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ansible Tower by Red Hat
# Copyright (c) 2017 Ansible by Red Hat
# All Rights Reserved.
# Python

View File

@ -16,7 +16,7 @@ from django.utils.encoding import smart_text
# Django REST Framework
from rest_framework.renderers import JSONRenderer
# Ansible Tower
# AWX
from awx.main.models import AuthToken
from awx.api.serializers import UserSerializer

View File

@ -1,7 +1,7 @@
{% extends "rest_framework/api.html" %}
{% load i18n staticfiles %}
{% block title %}{{ name }} · {% trans 'Ansible Tower' %}{% endblock %}
{% block title %}{{ name }} · {% trans 'AWX' %}{% endblock %}
{% block style %}
{{ block.super }}

View File

@ -1,7 +1,7 @@
{% extends 'rest_framework/base.html' %}
{% load i18n staticfiles %}
{% block title %}{{ name }} · {% trans 'Ansible Tower REST API' %}{% endblock %}
{% block title %}{{ name }} · {% trans 'AWX REST API' %}{% endblock %}
{% block bootstrap_theme %}
<link rel="stylesheet" type="text/css" href="{% static 'rest_framework/css/bootstrap.min.css' %}" />

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
{# Copy of base.html from rest_framework with minor Ansible Tower change. #}
{# Copy of base.html from rest_framework with minor AWX change. #}
{% load staticfiles %}
{% load rest_framework %}
{% load i18n %}

View File

@ -123,12 +123,12 @@ def proc_data_files(data_files):
setup(
name=os.getenv('NAME', 'ansible-awx'),
name=os.getenv('NAME', 'awx'),
version=get_version(),
author='Ansible, Inc.',
author_email='info@ansible.com',
description='ansible-awx: API, UI and Task Engine for Ansible',
long_description='Ansible AWX provides a web-based user interface, REST API and '
description='awx: API, UI and Task Engine for Ansible',
long_description='AWX provides a web-based user interface, REST API and '
'task engine built on top of Ansible',
license='MIT',
keywords='ansible',

View File

@ -20,9 +20,9 @@ RUN /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa
RUN mkdir -p /data/db
RUN pip2 install honcho
RUN pip2 install supervisor
ADD tools/docker-compose/ansible-awx.egg-link /tmp/ansible-awx.egg-link
ADD tools/docker-compose/awx.egg-link /tmp/awx.egg-link
ADD tools/docker-compose/awx-manage /usr/local/bin/awx-manage
ADD tools/docker-compose/ansible_awx.egg-info /tmp/ansible_awx.egg-info
ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info
RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.conf /etc/nginx/nginx.conf
RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.vh.default.conf /etc/nginx/conf.d/nginx.vh.default.conf
RUN ln -s /awx_devel/tools/docker-compose/start_development.sh /start_development.sh

View File

@ -1,10 +1,10 @@
#!/venv/awx/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ansible-awx','console_scripts','awx-manage'
__requires__ = 'ansible-awx'
# EASY-INSTALL-ENTRY-SCRIPT: 'awx','console_scripts','awx-manage'
import sys
from pkg_resources import load_entry_point
__requires__ = 'awx'
if __name__ == '__main__':
sys.exit(
load_entry_point('ansible-awx', 'console_scripts', 'awx-manage')()
load_entry_point('awx', 'console_scripts', 'awx-manage')()
)

View File

@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: ansible-awx
Name: awx
Version: placeholder
Summary: ansible-awx: API, UI and Task Engine for Ansible
Home-page: http://github.com/ansible/ansible-awx
Summary: awx: API, UI and Task Engine for Ansible
Home-page: http://github.com/ansible/awx
Author: Ansible, Inc.
Author-email: info@ansible.com
License: Proprietary
Description: Ansible AWXprovides a web-based user interface, REST API and task engine built on top of Ansible
Description: Ansible AWX provides a web-based user interface, REST API and task engine built on top of Ansible
Keywords: ansible
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable

View File

@ -21,9 +21,9 @@ else
echo "Failed to find awx source tree, map your development tree volume"
fi
cp -R /tmp/ansible_awx.egg-info /awx_devel/ || true
sed -i "s/placeholder/$(git describe --long | sed 's/\./\\./g')/" /awx_devel/ansible_awx.egg-info/PKG-INFO
cp /tmp/ansible-awx.egg-link /venv/awx/lib/python2.7/site-packages/ansible-awx.egg-link
cp -R /tmp/awx.egg-info /awx_devel/ || true
sed -i "s/placeholder/$(git describe --long | sed 's/\./\\./g')/" /awx_devel/awx.egg-info/PKG-INFO
cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link
ln -s /awx_devel/tools/rdb.py /venv/awx/lib/python2.7/site-packages/rdb.py || true
yes | cp -rf /awx_devel/tools/docker-compose/supervisor.conf /supervisor.conf

View File

@ -1,3 +1,3 @@
#!/bin/bash
. /venv/awx/bin/activate
exec env TOWER_LIB_DIRECTORY=/awx_lib /awx_devel/run.py "$@"
exec env AWX_LIB_DIRECTORY=/awx_lib /awx_devel/run.py "$@"

View File

@ -1,4 +1,4 @@
#!/bin/bash
AWX_LIB=`/var/lib/awx/venv/awx/bin/python -c 'import os, awx; print os.path.dirname(awx.__file__)'`
. /var/lib/awx/venv/awx/bin/activate
exec env TOWER_LIB_DIRECTORY=$AWX_LIB/lib /var/lib/awx/venv/awx/bin/python $AWX_LIB/main/isolated/run.pyc "$@"
exec env AWX_LIB_DIRECTORY=$AWX_LIB/lib /var/lib/awx/venv/awx/bin/python $AWX_LIB/main/isolated/run.pyc "$@"