From 8ce1421c6a6bb513238b85aebd7add36722556f6 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 24 Jul 2017 16:03:58 -0400 Subject: [PATCH] fix tower-expect -> awx-expect for isolated tower builds --- awx/main/isolated/isolated_manager.py | 2 +- awx/playbooks/check_isolated.yml | 2 +- awx/playbooks/clean_isolated.yml | 2 +- awx/playbooks/run_isolated.yml | 2 +- awx/plugins/isolated/tower_capacity.py | 2 +- awx/plugins/isolated/tower_isolated_cleanup.py | 2 +- setup.py | 2 +- tools/docker-isolated-override.yml | 8 ++++---- tools/docker-isolated/Dockerfile | 2 +- tools/docker-isolated/README.md | 8 ++++---- tools/docker-isolated/awx-expect | 3 +++ tools/docker-isolated/tower-expect | 3 --- tools/scripts/awx-expect | 4 ++++ tools/scripts/tower-expect | 4 ---- 14 files changed, 23 insertions(+), 23 deletions(-) create mode 100755 tools/docker-isolated/awx-expect delete mode 100755 tools/docker-isolated/tower-expect create mode 100755 tools/scripts/awx-expect delete mode 100755 tools/scripts/tower-expect diff --git a/awx/main/isolated/isolated_manager.py b/awx/main/isolated/isolated_manager.py index dfdbed34d1..c20e61f2f2 100644 --- a/awx/main/isolated/isolated_manager.py +++ b/awx/main/isolated/isolated_manager.py @@ -170,7 +170,7 @@ class IsolatedManager(object): # - sets up a temporary directory for proot/bwrap (if necessary) # - copies encrypted job data from the controlling host to the isolated host (with rsync) # - writes the encryption secret to a named pipe on the isolated host - # - launches the isolated playbook runner via `tower-expect start ` + # - launches the isolated playbook runner via `awx-expect start ` args = self._build_args('run_isolated.yml', '%s,' % self.host, extra_vars) if self.instance.verbosity: args.append('-%s' % ('v' * min(5, self.instance.verbosity))) diff --git a/awx/playbooks/check_isolated.yml b/awx/playbooks/check_isolated.yml index 60ccfd1ddf..69018a6ed2 100644 --- a/awx/playbooks/check_isolated.yml +++ b/awx/playbooks/check_isolated.yml @@ -10,7 +10,7 @@ tasks: - name: Determine if daemon process is alive. - shell: "tower-expect is-alive {{src}}" + shell: "awx-expect is-alive {{src}}" register: is_alive ignore_errors: true diff --git a/awx/playbooks/clean_isolated.yml b/awx/playbooks/clean_isolated.yml index 0945411318..e40e780396 100644 --- a/awx/playbooks/clean_isolated.yml +++ b/awx/playbooks/clean_isolated.yml @@ -11,7 +11,7 @@ tasks: - name: cancel the job - command: "tower-expect stop {{private_data_dir}}" + command: "awx-expect stop {{private_data_dir}}" ignore_errors: yes - name: remove build artifacts diff --git a/awx/playbooks/run_isolated.yml b/awx/playbooks/run_isolated.yml index 5233f63dd1..bdcc798339 100644 --- a/awx/playbooks/run_isolated.yml +++ b/awx/playbooks/run_isolated.yml @@ -29,7 +29,7 @@ command: "mkfifo {{src}}/env" - name: spawn the playbook - command: "tower-expect start {{src}}" + command: "awx-expect start {{src}}" - name: write the secret environment data mkfifo: diff --git a/awx/plugins/isolated/tower_capacity.py b/awx/plugins/isolated/tower_capacity.py index 9ef879b423..cc69d02a3b 100644 --- a/awx/plugins/isolated/tower_capacity.py +++ b/awx/plugins/isolated/tower_capacity.py @@ -26,7 +26,7 @@ def main(): ) try: version = subprocess.check_output( - ['tower-expect', '--version'], + ['awx-expect', '--version'], stderr=subprocess.STDOUT ).strip() except subprocess.CalledProcessError as e: diff --git a/awx/plugins/isolated/tower_isolated_cleanup.py b/awx/plugins/isolated/tower_isolated_cleanup.py index 529a24fd9d..ac9a0cd101 100644 --- a/awx/plugins/isolated/tower_isolated_cleanup.py +++ b/awx/plugins/isolated/tower_isolated_cleanup.py @@ -51,7 +51,7 @@ def main(): try: re_match = re.match(r'\/tmp\/ansible_tower_\d+_.+', path) if re_match is not None: - if subprocess.check_call(['tower-expect', 'is-alive', path]) == 0: + if subprocess.check_call(['awx-expect', 'is-alive', path]) == 0: continue else: module.debug('Deleting path {} its job has completed.'.format(path)) diff --git a/setup.py b/setup.py index a36e5be153..5aa7b36447 100755 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ class sdist_isolated(sdist): 'include Makefile', 'include awx/__init__.py', 'include awx/main/isolated/run.py', - 'include tools/scripts/tower-expect', + 'include tools/scripts/awx-expect', 'include requirements/requirements_isolated.txt', 'recursive-include awx/lib *.py', ] diff --git a/tools/docker-isolated-override.yml b/tools/docker-isolated-override.yml index 2e2613fb82..140f13de7a 100644 --- a/tools/docker-isolated-override.yml +++ b/tools/docker-isolated-override.yml @@ -1,17 +1,17 @@ version: '3' services: # Primary Tower Development Container link - tower: + awx: environment: EXTRA_GROUP_QUEUES: thepentagon links: - isolated # Isolated Rampart Container isolated: - image: gcr.io/ansible-tower-engineering/tower_isolated:${TAG} + image: gcr.io/ansible-tower-engineering/awx_isolated:${TAG} hostname: isolated volumes: - - "../awx/main/isolated:/tower_devel" - - "../awx/lib:/tower_lib" + - "../awx/main/isolated:/awx_devel" + - "../awx/lib:/awx_lib" - "/sys/fs/cgroup:/sys/fs/cgroup:ro" privileged: true diff --git a/tools/docker-isolated/Dockerfile b/tools/docker-isolated/Dockerfile index b9ab6ea047..b08a33e1ed 100644 --- a/tools/docker-isolated/Dockerfile +++ b/tools/docker-isolated/Dockerfile @@ -17,7 +17,7 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 WORKDIR / EXPOSE 22 -ADD tools/docker-isolated/tower-expect /usr/local/bin/tower-expect +ADD tools/docker-isolated/awx-expect /usr/local/bin/awx-expect RUN rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_ecdsa_key diff --git a/tools/docker-isolated/README.md b/tools/docker-isolated/README.md index 9a2ae470c2..e2574fd6ca 100644 --- a/tools/docker-isolated/README.md +++ b/tools/docker-isolated/README.md @@ -1,7 +1,7 @@ ## Instructions on using an isolated node The building of the isolated node is done in the `make docker-compose-build` -target. Its image uses a different tag from the tools_tower container. +target. Its image uses a different tag from the tools_awx container. Given that the images are built, you can run the combined docker compose target. This uses the base `docker-compose.yml` with modifications found in `docker-isolated-override.yml`. @@ -12,7 +12,7 @@ base branch is. For example: make docker-isolated COMPOSE_TAG=devel ``` -This will automatically exchange the keys in order for the `tools_tower_1` +This will automatically exchange the keys in order for the `tools_awx_1` container to access the `tools_isolated_1` container over ssh. After that, it will bring up all the containers like the normal docker-compose workflow. @@ -61,7 +61,7 @@ Example location of a private data directory: The following command would run the playbook corresponding to that job. ```bash -tower-expect start /tmp/ansible_tower_29_OM6Mnx/ +awx-expect start /tmp/ansible_tower_29_OM6Mnx/ ``` -Other tower-expect commands include `start`, `is-alive`, and `stop`. +Other awx-expect commands include `start`, `is-alive`, and `stop`. diff --git a/tools/docker-isolated/awx-expect b/tools/docker-isolated/awx-expect new file mode 100755 index 0000000000..0ceb7a629c --- /dev/null +++ b/tools/docker-isolated/awx-expect @@ -0,0 +1,3 @@ +#!/bin/bash +. /venv/awx/bin/activate +exec env TOWER_LIB_DIRECTORY=/awx_lib /awx_devel/run.py "$@" diff --git a/tools/docker-isolated/tower-expect b/tools/docker-isolated/tower-expect deleted file mode 100755 index bfe543dd85..0000000000 --- a/tools/docker-isolated/tower-expect +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -. /venv/tower/bin/activate -exec env TOWER_LIB_DIRECTORY=/tower_lib /tower_devel/run.py "$@" diff --git a/tools/scripts/awx-expect b/tools/scripts/awx-expect new file mode 100755 index 0000000000..bd3364e666 --- /dev/null +++ b/tools/scripts/awx-expect @@ -0,0 +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 "$@" diff --git a/tools/scripts/tower-expect b/tools/scripts/tower-expect deleted file mode 100755 index c682aa7e9f..0000000000 --- a/tools/scripts/tower-expect +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -AWX_LIB=`/var/lib/awx/venv/tower/bin/python -c 'import os, awx; print os.path.dirname(awx.__file__)'` -. /var/lib/awx/venv/tower/bin/activate -exec env TOWER_LIB_DIRECTORY=$AWX_LIB/lib /var/lib/awx/venv/tower/bin/python $AWX_LIB/main/isolated/run.pyc "$@"