From 5a6f1a342fd0e1a26d3cc2d0da537212c8e6ba15 Mon Sep 17 00:00:00 2001 From: adamscmRH Date: Fri, 7 Sep 2018 14:59:33 -0400 Subject: [PATCH 01/18] rm network ui from changelog --- docs/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 10f8668888..620fa088d5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -36,8 +36,6 @@ [[#196](https://github.com/ansible/awx/issues/196)]. * Add additional organization roles [[#166](https://github.com/ansible/awx/issues/166)]. * Support fact caching for isolated instances [[#198](https://github.com/ansible/awx/issues/198)]. -* Graphical UI for network inventory [[#611](https://github.com/ansible/awx/issues/611)]. -* Restrict viewing and editing network UI canvas to users with inventory `admin_role`. * Implement per-template, project, organization `custom_virtualenv`, a field that allows users to select one of multiple virtual environments set up on the filesystem [[#34](https://github.com/ansible/awx/issues/34)]. @@ -68,6 +66,7 @@ queue for the specific instance job is targeted to run on [[#1873](https://github.com/ansible/awx/issues/1873)]. * Switched authentication to Django sessions. +* Deprecated AuthToken endpoint, will be removed in 3.4.0. * Implemented OAuth2 support for token based authentication [[#21](https://github.com/ansible/awx/issues/21)]. * Added the ability to forcibly expire sessions through `awx-manage expire_sessions`. * Disallowed using HTTP PUT/PATCH methods to modify existing jobs in Job Details API endpoint. From f82f4a9993c9b28599daf7a1bc52f947372ebef1 Mon Sep 17 00:00:00 2001 From: chris meyers Date: Fri, 7 Sep 2018 17:40:11 -0400 Subject: [PATCH 02/18] deprecate fact endpoints and commands --- awx/api/views.py | 2 ++ awx/main/management/commands/cleanup_facts.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/awx/api/views.py b/awx/api/views.py index ac5e693527..3492396477 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -2358,6 +2358,7 @@ class HostFactVersionsList(SystemTrackingEnforcementMixin, ParentMixin, ListAPIV serializer_class = FactVersionSerializer parent_model = Host search_fields = ('facts',) + deprecated = True def get_queryset(self): from_spec = self.request.query_params.get('from', None) @@ -2383,6 +2384,7 @@ class HostFactCompareView(SystemTrackingEnforcementMixin, SubDetailAPIView): model = Fact parent_model = Host serializer_class = FactSerializer + deprecated = True def retrieve(self, request, *args, **kwargs): datetime_spec = request.query_params.get('datetime', None) diff --git a/awx/main/management/commands/cleanup_facts.py b/awx/main/management/commands/cleanup_facts.py index f60dbc0f03..76bc4190fb 100644 --- a/awx/main/management/commands/cleanup_facts.py +++ b/awx/main/management/commands/cleanup_facts.py @@ -3,6 +3,7 @@ # Python import re +import sys from dateutil.relativedelta import relativedelta # Django @@ -129,6 +130,7 @@ class Command(BaseCommand): @transaction.atomic def handle(self, *args, **options): + sys.stderr.write("This command has been deprecated and will be removed in a future release.\n") if not feature_enabled('system_tracking'): raise CommandError("The System Tracking feature is not enabled for your instance") cleanup_facts = CleanupFacts() From 27c06a728545302c2330b32b9ce17dee9b207e9d Mon Sep 17 00:00:00 2001 From: mabashian Date: Mon, 10 Sep 2018 13:12:19 -0400 Subject: [PATCH 03/18] Fixes bug in wfjt node form where rows weren't remaining selected after being clicked --- awx/ui/client/src/templates/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js index a7890c288b..61d04b6b82 100644 --- a/awx/ui/client/src/templates/main.js +++ b/awx/ui/client/src/templates/main.js @@ -499,7 +499,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p $scope.$watch('selectedTemplate', () => { $scope.job_templates.forEach(function(row, i) { - if(_.has($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { + if(_.hasIn($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { $scope.job_templates[i].checked = 1; } else { @@ -576,7 +576,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p $scope.$watch('selectedTemplate', () => { $scope.workflow_inventory_sources.forEach(function(row, i) { - if(_.has($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { + if(_.hasIn($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { $scope.workflow_inventory_sources[i].checked = 1; } else { @@ -653,7 +653,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p $scope.$watch('selectedTemplate', () => { $scope.projects.forEach(function(row, i) { - if(_.has($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { + if(_.hasIn($scope, 'selectedTemplate.id') && row.id === $scope.selectedTemplate.id) { $scope.projects[i].checked = 1; } else { From 593ab90f9246c4a250e6851f8ace3455faafa1e1 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 12 Sep 2018 10:54:17 -0400 Subject: [PATCH 04/18] update syntax of lodash find call --- .../src/instance-groups/instances/instances.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/instance-groups/instances/instances.controller.js b/awx/ui/client/src/instance-groups/instances/instances.controller.js index 0c9e82228a..2f956ae634 100644 --- a/awx/ui/client/src/instance-groups/instances/instances.controller.js +++ b/awx/ui/client/src/instance-groups/instances/instances.controller.js @@ -51,7 +51,7 @@ function InstancesController ($scope, $state, $http, models, strings, Dataset, P }; vm.toggle = (toggled) => { - const instance = _.find(vm.instances, 'id', toggled.id); + const instance = _.find(vm.instances, ['id', toggled.id]); instance.enabled = !instance.enabled; const data = { From 90bd27f5a8683a03aff6f6f3cc8493c15ec29831 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Wed, 12 Sep 2018 13:41:56 -0400 Subject: [PATCH 05/18] Whitespace fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m not actually this pedantic, I just need something to tag. --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 2f444a3c89..d625ea9e0f 100644 --- a/Makefile +++ b/Makefile @@ -613,7 +613,6 @@ docker-compose-cluster-elk: docker-auth minishift-dev: ansible-playbook -i localhost, -e devtree_directory=$(CURWD) tools/clusterdevel/start_minishift_dev.yml - clean-elk: docker stop tools_kibana_1 docker stop tools_logstash_1 From 1d8bb47726a5f66c8365b642232478d35dcf36db Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 12 Sep 2018 17:31:10 -0400 Subject: [PATCH 06/18] fix filter page size selector --- awx/ui/client/src/shared/paginate/paginate.controller.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/src/shared/paginate/paginate.controller.js b/awx/ui/client/src/shared/paginate/paginate.controller.js index 28be44eeae..6da86f4880 100644 --- a/awx/ui/client/src/shared/paginate/paginate.controller.js +++ b/awx/ui/client/src/shared/paginate/paginate.controller.js @@ -15,12 +15,11 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q "\n"); if ($scope.querySet){ - let origQuerySet = _.cloneDeep($scope.querySet); - queryset = _.merge(origQuerySet, { page_size: pageSize }); + $scope.querySet = _.merge($scope.querySet, { page_size: `${pageSize}`}); } else { - queryset = _.merge($stateParams[`${$scope.iterator}_search`], { page_size: pageSize, page: 1 }); + $scope.querySet = _.merge($stateParams[`${$scope.iterator}_search`], { page_size: `${pageSize}`}); } - $scope.toPage(); + $scope.toPage(1); }; $scope.toPage = function(page) { From 9de63832ce34ea6a57a65a08af3b3bc6a4ee0605 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 20 Sep 2018 15:14:33 -0400 Subject: [PATCH 07/18] properly support deprecated `Authorization: Token xyz` --- awx/main/middleware.py | 3 +++ awx/main/tests/functional/api/test_oauth.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/awx/main/middleware.py b/awx/main/middleware.py index 3baeaa5d32..fb681639b5 100644 --- a/awx/main/middleware.py +++ b/awx/main/middleware.py @@ -257,6 +257,9 @@ class DeprecatedAuthTokenMiddleware(object): 'be replaced with OAuth2.0 in the next version of Ansible Tower ' '(see /api/o/ for more details).' ) + elif request.environ.get('HTTP_AUTHORIZATION', '').startswith('Token '): + token = request.environ['HTTP_AUTHORIZATION'].split(' ', 1)[-1].strip() + request.environ['HTTP_AUTHORIZATION'] = six.text_type('Bearer {}').format(token) class MigrationRanCheckMiddleware(object): diff --git a/awx/main/tests/functional/api/test_oauth.py b/awx/main/tests/functional/api/test_oauth.py index b497a7d45f..dc7de68fd7 100644 --- a/awx/main/tests/functional/api/test_oauth.py +++ b/awx/main/tests/functional/api/test_oauth.py @@ -380,6 +380,15 @@ def test_deprecated_authtoken_support(alice, fmt): assert resp.data['refresh_token'] is None assert resp.data['scope'] == 'write' + for _type in ('Token', 'Bearer'): + request = getattr(APIRequestFactory(), 'get')( + '/api/v2/me/', + HTTP_AUTHORIZATION=' '.join([_type, resp.data['token']]) + ) + DeprecatedAuthTokenMiddleware().process_request(request) + view, view_args, view_kwargs = resolve(request.path) + assert view(request, *view_args, **view_kwargs).status_code == 200 + @pytest.mark.django_db def test_deprecated_authtoken_invalid_username(alice): From 0a0cdc2e21238f5e9ef3ac801f1a64629b5f2542 Mon Sep 17 00:00:00 2001 From: chris meyers Date: Thu, 27 Sep 2018 12:18:39 -0400 Subject: [PATCH 08/18] at migration time, validate ldap group type params * Previously, we have logic in the API to ensure that ldap group type params, when changed, align with ldap group type Class init expectations. However, we did not have this logic in the migrations. This PR adds the validation check to migrations. --- .../migrations/0006_v331_ldap_group_type.py | 18 +++++++++++ awx/conf/migrations/_ldap_group_type.py | 30 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 awx/conf/migrations/0006_v331_ldap_group_type.py create mode 100644 awx/conf/migrations/_ldap_group_type.py diff --git a/awx/conf/migrations/0006_v331_ldap_group_type.py b/awx/conf/migrations/0006_v331_ldap_group_type.py new file mode 100644 index 0000000000..8bfe3ef0e2 --- /dev/null +++ b/awx/conf/migrations/0006_v331_ldap_group_type.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +# AWX +from awx.conf.migrations._ldap_group_type import fill_ldap_group_type_params + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('conf', '0005_v330_rename_two_session_settings'), + ] + + operations = [ + migrations.RunPython(fill_ldap_group_type_params), + ] diff --git a/awx/conf/migrations/_ldap_group_type.py b/awx/conf/migrations/_ldap_group_type.py new file mode 100644 index 0000000000..479b12cdb7 --- /dev/null +++ b/awx/conf/migrations/_ldap_group_type.py @@ -0,0 +1,30 @@ + +import inspect + +from django.conf import settings +from django.utils.timezone import now + + +def fill_ldap_group_type_params(apps, schema_editor): + group_type = settings.AUTH_LDAP_GROUP_TYPE + Setting = apps.get_model('conf', 'Setting') + + group_type_params = {'name_attr': 'cn', 'member_attr': 'member'} + qs = Setting.objects.filter(key='AUTH_LDAP_GROUP_TYPE_PARAMS') + entry = None + if qs.exists(): + entry = qs[0] + group_type_params = entry.value + else: + entry = Setting(key='AUTH_LDAP_GROUP_TYPE_PARAMS', + value=group_type_params, + created=now(), + modified=now()) + + init_attrs = set(inspect.getargspec(group_type.__init__).args[1:]) + for k in group_type_params.keys(): + if k not in init_attrs: + del group_type_params[k] + + entry.value = group_type_params + entry.save() From 8aec4ed72e1eb4a5cad97e4bf9ec36caa3a0f486 Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 27 Sep 2018 16:30:10 -0400 Subject: [PATCH 09/18] Fixes bug where schedule extra vars were not being displayed in the edit form --- .../src/scheduler/schedulerEdit.controller.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/awx/ui/client/src/scheduler/schedulerEdit.controller.js b/awx/ui/client/src/scheduler/schedulerEdit.controller.js index 4aa3044adf..512df41aee 100644 --- a/awx/ui/client/src/scheduler/schedulerEdit.controller.js +++ b/awx/ui/client/src/scheduler/schedulerEdit.controller.js @@ -316,13 +316,13 @@ function($filter, $state, $stateParams, Wait, $scope, moment, // the extra vars codemirror is ONLY shown if the // schedule is for a JT and the JT has // ask_variables_on_launch = true. - $scope.extraVars = ParentObject.extra_vars === '' ? '---' : ParentObject.extra_vars; $scope.noVars = false; ParseTypeChange({ scope: $scope, variable: 'extraVars', parse_variable: 'parseType', - field_id: 'SchedulerForm-extraVars' + field_id: 'SchedulerForm-extraVars', + readOnly: !$scope.schedule_obj.summary_fields.user_capabilities.edit }); } else { $scope.noVars = true; @@ -366,16 +366,6 @@ function($filter, $state, $stateParams, Wait, $scope, moment, $scope.missingSurveyValue = processed.missingSurveyValue; - $scope.extraVars = (processed.extra_data === '' || _.isEmpty(processed.extra_data)) ? '---' : '---\n' + jsyaml.safeDump(processed.extra_data); - - ParseTypeChange({ - scope: $scope, - variable: 'extraVars', - parse_variable: 'parseType', - field_id: 'SchedulerForm-extraVars', - readOnly: !$scope.schedule_obj.summary_fields.user_capabilities.edit - }); - $scope.promptData = { launchConf: launchConf, launchOptions: launchOptions, From 6c98e6c3a008ef814bd29c45637cffec3a6faac4 Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 27 Sep 2018 16:49:23 -0400 Subject: [PATCH 10/18] Actually fix extra vars on edit schedule. This commit takes into account survey question answers which need to get pulled out of extra vars and displayed in the prompt. --- .../src/scheduler/schedulerEdit.controller.js | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/awx/ui/client/src/scheduler/schedulerEdit.controller.js b/awx/ui/client/src/scheduler/schedulerEdit.controller.js index 512df41aee..0e27408c1f 100644 --- a/awx/ui/client/src/scheduler/schedulerEdit.controller.js +++ b/awx/ui/client/src/scheduler/schedulerEdit.controller.js @@ -243,6 +243,15 @@ function($filter, $state, $stateParams, Wait, $scope, moment, let jobTemplate = new JobTemplate(); + const codeMirrorExtraVars = () => { + ParseTypeChange({ + scope: $scope, + variable: 'extraVars', + parse_variable: 'parseType', + field_id: 'SchedulerForm-extraVars' + }); + }; + Rest.setUrl(scheduleResolve.related.credentials); $q.all([jobTemplate.optionsLaunch(ParentObject.id), jobTemplate.getLaunch(ParentObject.id), Rest.get()]) @@ -312,21 +321,10 @@ function($filter, $state, $stateParams, Wait, $scope, moment, prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials); - if (launchConf.ask_variables_on_launch) { - // the extra vars codemirror is ONLY shown if the - // schedule is for a JT and the JT has - // ask_variables_on_launch = true. - $scope.noVars = false; - ParseTypeChange({ - scope: $scope, - variable: 'extraVars', - parse_variable: 'parseType', - field_id: 'SchedulerForm-extraVars', - readOnly: !$scope.schedule_obj.summary_fields.user_capabilities.edit - }); - } else { - $scope.noVars = true; - } + // the extra vars codemirror is ONLY shown if the + // schedule is for a JT and the JT has + // ask_variables_on_launch = true + $scope.noVars = !launchConf.ask_variables_on_launch; if (!launchConf.survey_enabled && !launchConf.ask_inventory_on_launch && @@ -343,6 +341,10 @@ function($filter, $state, $stateParams, Wait, $scope, moment, launchConf.passwords_needed_to_start.length === 0 && launchConf.variables_needed_to_start.length === 0) { $scope.showPromptButton = false; + + if (launchConf.ask_variables_on_launch) { + codeMirrorExtraVars(); + } } else { $scope.showPromptButton = true; @@ -366,6 +368,10 @@ function($filter, $state, $stateParams, Wait, $scope, moment, $scope.missingSurveyValue = processed.missingSurveyValue; + $scope.extraVars = (processed.extra_data === '' || _.isEmpty(processed.extra_data)) ? '---' : '---\n' + jsyaml.safeDump(processed.extra_data); + + codeMirrorExtraVars(); + $scope.promptData = { launchConf: launchConf, launchOptions: launchOptions, @@ -387,6 +393,7 @@ function($filter, $state, $stateParams, Wait, $scope, moment, watchForPromptChanges(); }); } else { + codeMirrorExtraVars(); $scope.promptData = { launchConf: launchConf, launchOptions: launchOptions, From 5994c359759fe5a0a433a4acda43a882e899721a Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Wed, 10 Oct 2018 11:33:11 -0400 Subject: [PATCH 11/18] Use latest version of asgi_amqp --- requirements/requirements.in | 2 +- requirements/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/requirements.in b/requirements/requirements.in index adef6e865f..c396508a6e 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -1,6 +1,6 @@ apache-libcloud==2.2.1 appdirs==1.4.2 -asgi-amqp==1.1.1 +asgi-amqp==1.1.2 asgiref==1.1.2 azure==3.0.0 backports.ssl-match-hostname==3.5.0.1 diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 45abe6ba80..4124fd5de2 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -10,7 +10,7 @@ anyjson==0.3.3 # via kombu apache-libcloud==2.2.1 appdirs==1.4.2 argparse==1.4.0 # via uwsgitop -asgi-amqp==1.1.1 +asgi-amqp==1.1.2 asgiref==1.1.2 asn1crypto==0.24.0 # via cryptography attrs==17.4.0 # via automat, service-identity From cfb58eb14572149a6cc26563d96d23fb67a03ffd Mon Sep 17 00:00:00 2001 From: chris meyers Date: Wed, 10 Oct 2018 12:32:27 -0400 Subject: [PATCH 12/18] fix issue with ldap queries containing unicode --- awx/sso/ldap_group_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/sso/ldap_group_types.py b/awx/sso/ldap_group_types.py index b155ab99c8..69c655e040 100644 --- a/awx/sso/ldap_group_types.py +++ b/awx/sso/ldap_group_types.py @@ -42,7 +42,7 @@ class PosixUIDGroupType(LDAPGroupType): ) search = group_search.search_with_additional_term_string(filterstr) - search.attrlist = [self.name_attr] + search.attrlist = [str(self.name_attr)] groups = search.execute(ldap_user.connection) except (KeyError, IndexError): pass From d4e3127fb461c64f4451a3564605a62abe7063c4 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 12 Oct 2018 12:29:46 -0400 Subject: [PATCH 13/18] properly handle AnsibleVaultEncryptedUnicode objects in the callback --- awx/main/queue.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/awx/main/queue.py b/awx/main/queue.py index 8f5b680f84..57a784321e 100644 --- a/awx/main/queue.py +++ b/awx/main/queue.py @@ -2,6 +2,7 @@ # All Rights Reserved. # Python +import json import logging import os @@ -12,10 +13,31 @@ from django.conf import settings # Kombu from kombu import Connection, Exchange, Producer +from kombu.serialization import registry __all__ = ['CallbackQueueDispatcher'] +# use a custom JSON serializer so we can properly handle !unsafe and !vault +# objects that may exist in events emitted by the callback plugin +# see: https://github.com/ansible/ansible/pull/38759 +class AnsibleJSONEncoder(json.JSONEncoder): + + def default(self, o): + if getattr(o, 'yaml_tag') == '!vault': + return o.data + return super(AnsibleJSONEncoder, self).default(o) + + +registry.register( + 'json-ansible', + lambda obj: json.dumps(obj, cls=AnsibleJSONEncoder), + lambda obj: json.loads(obj), + content_type='application/json', + content_encoding='utf-8' +) + + class CallbackQueueDispatcher(object): def __init__(self): @@ -41,7 +63,7 @@ class CallbackQueueDispatcher(object): producer = Producer(self.connection) producer.publish(obj, - serializer='json', + serializer='json-ansible', compression='bzip2', exchange=self.exchange, declare=[self.exchange], From 867ff5da7196a4d9554ac7b83b5c1716f84fa2a0 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 12 Oct 2018 16:17:14 -0400 Subject: [PATCH 14/18] minor nit for https://github.com/ansible/tower/pull/3060 --- awx/main/queue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/queue.py b/awx/main/queue.py index 57a784321e..d8306c05ba 100644 --- a/awx/main/queue.py +++ b/awx/main/queue.py @@ -24,7 +24,7 @@ __all__ = ['CallbackQueueDispatcher'] class AnsibleJSONEncoder(json.JSONEncoder): def default(self, o): - if getattr(o, 'yaml_tag') == '!vault': + if getattr(o, 'yaml_tag', None) == '!vault': return o.data return super(AnsibleJSONEncoder, self).default(o) From d5626a4f3e28ac7b04a2069bacb570f9ac61ec5e Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Mon, 15 Oct 2018 11:40:51 +0900 Subject: [PATCH 15/18] [3.3.1] Add files and output of commands to gather with sosreport - Fixed issue #3064 --- tools/sosreport/tower.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/sosreport/tower.py b/tools/sosreport/tower.py index 20fef80ea1..6d4aec0c02 100644 --- a/tools/sosreport/tower.py +++ b/tools/sosreport/tower.py @@ -11,17 +11,22 @@ SOSREPORT_TOWER_COMMANDS = [ "supervisorctl status", # tower process status "rabbitmqctl status", "rabbitmqctl cluster_status", - "/var/lib/awx/venv/awx/bin/pip freeze", # pip package list - "/var/lib/awx/venv/ansible/bin/pip freeze", # pip package list + "/var/lib/awx/venv/awx/bin/pip freeze", # pip package list + "/var/lib/awx/venv/awx/bin/pip freeze -l", # pip package list without globally-installed packages + "/var/lib/awx/venv/ansible/bin/pip freeze", # pip package list + "/var/lib/awx/venv/ansible/bin/pip freeze -l", # pip package list without globally-installed packages "tree -d /var/lib/awx", # show me the dirs "ls -ll /var/lib/awx", # check permissions "ls -ll /var/lib/awx/venv", # list all venvs - "ls -ll /etc/tower" + "ls -ll /etc/tower", + "umask -p" # check current umask ] SOSREPORT_TOWER_DIRS = [ "/etc/tower/", "/etc/ansible/", + "/etc/supervisord.d/", + "/etc/nginx/", "/var/log/tower", "/var/log/nginx", "/var/log/rabbitmq", From 9d81727d16635b354e8e91ca3802a34fb46e855d Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 15 Oct 2018 10:58:21 -0400 Subject: [PATCH 16/18] fix a typo on the JT add page that breaks the custom venv field --- awx/ui/client/src/templates/job_templates/job-template.form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/templates/job_templates/job-template.form.js b/awx/ui/client/src/templates/job_templates/job-template.form.js index 7b75e16415..54bbe2c70d 100644 --- a/awx/ui/client/src/templates/job_templates/job-template.form.js +++ b/awx/ui/client/src/templates/job_templates/job-template.form.js @@ -245,7 +245,7 @@ function(NotificationsList, i18n) { dataTitle: i18n._('Ansible Environment'), dataContainer: 'body', dataPlacement: 'right', - ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAdd)', + ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)', ngShow: 'custom_virtualenvs_options.length > 1' }, instance_groups: { From 6e3b2a5c2dfa75fc0ed1e8d2e51fe41e9a2ce637 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Mon, 15 Oct 2018 13:18:50 -0400 Subject: [PATCH 17/18] better error handling when over limit --- awx/api/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/api/views.py b/awx/api/views.py index 3492396477..0b4da2f21d 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -4335,6 +4335,11 @@ class JobRelaunch(RetrieveAPIView): 'Cannot relaunch because previous job had 0 {status_value} hosts.' ).format(status_value=retry_hosts)}, status=status.HTTP_400_BAD_REQUEST) copy_kwargs['limit'] = ','.join(retry_host_list) + limit_length = len(copy_kwargs['limit']) + if limit_length > 1024: + return Response({'limit': _( + 'Cannot relaunch because the limit length {limit_length} exceeds the max of {limit_max}.' + ).format(limit_length=limit_lengh, limit_max=1024)}, status=status.HTTP_400_BAD_REQUEST) new_job = obj.copy_unified_job(**copy_kwargs) result = new_job.signal_start(**serializer.validated_data['credential_passwords']) From f2cec03900749b5d147128c5a17c2fdf2b223e5b Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Wed, 17 Oct 2018 16:34:24 -0400 Subject: [PATCH 18/18] fix typo in length --- awx/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/views.py b/awx/api/views.py index 0b4da2f21d..d8b66e0cca 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -4339,7 +4339,7 @@ class JobRelaunch(RetrieveAPIView): if limit_length > 1024: return Response({'limit': _( 'Cannot relaunch because the limit length {limit_length} exceeds the max of {limit_max}.' - ).format(limit_length=limit_lengh, limit_max=1024)}, status=status.HTTP_400_BAD_REQUEST) + ).format(limit_length=limit_length, limit_max=1024)}, status=status.HTTP_400_BAD_REQUEST) new_job = obj.copy_unified_job(**copy_kwargs) result = new_job.signal_start(**serializer.validated_data['credential_passwords'])