1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge branch 'release_2.4.2' into stable

* release_2.4.2: (23 commits)
  Updating 2.4.2 changelogs
  fix the connection check fix
  more robust check added to mongo db connection
  Adding a body to our OPTIONS requests fixes 415 error responses in IE11 and Edge.
  Don't hard-fail if default isn't defined on survey
  fixed custom login info bug
  Allow an org admin to delete project updates
  Disable elasticache instance gathering for aws
  Fix DEB builds by adding 2.4.2 to reprepro conf
  When the panel lists were consolidated down the list name was changed to 'all_jobs.'  When a job is clicked from the activity stream it should show the job list filtered down by ID.
  Rolled back job url change
  track modules on system tracking page by index
  correct spelling of consisting in help text
  Fixing up flake8
  The "job" href links in the activity stream don't point to the job details page.  This is an update to the jobs href to point to /#/jobs/(job.id).
  Wrapped the SourceChange call in a function so that it can be called without clearing the credential.  This fixes a bug where the credential was not showing up in the initial edit dialog even though the data was sent properly via the API.
  Revert change to Makefile, which was causing old .deb versions to be dropped from the repo
  Refactor scan_packages for os detection
  Remove stray debugging lines
  Add SUSE, OpenSuse and Debian to scan_packages
  ...
This commit is contained in:
Matthew Jones 2015-12-09 13:01:58 -05:00
commit f7e5ffee27
17 changed files with 66 additions and 29 deletions

View File

@ -651,7 +651,7 @@ reprepro: deb-build/$(DEB_NVRA).deb reprepro/conf
$(REPREPRO_BIN) $(REPREPRO_OPTS) clearvanished
for COMPONENT in non-free $(VERSION); do \
$(REPREPRO_BIN) $(REPREPRO_OPTS) -C $$COMPONENT remove $(DEB_DIST) $(NAME) ; \
$(REPREPRO_BIN) $(REPREPRO_OPTS) -C $$COMPONENT --ignore=brokenold includedeb $(DEB_DIST) deb-build/$(DEB_NVRA).deb ; \
$(REPREPRO_BIN) $(REPREPRO_OPTS) -C $$COMPONENT --keepunreferencedfiles --ignore=brokenold includedeb $(DEB_DIST) deb-build/$(DEB_NVRA).deb ; \
done

View File

@ -6,7 +6,7 @@ import sys
import warnings
import site
__version__ = '2.4.1'
__version__ = '2.4.2'
__all__ = ['__version__']

View File

@ -1505,7 +1505,7 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer):
else:
d['can_copy'] = False
d['can_edit'] = False
d['recent_jobs'] = [{'id': x.id, 'status': x.status, 'finished': x.finished} for x in obj.jobs.filter(active=True).order_by('-started')[:10]]
d['recent_jobs'] = [{'id': x.id, 'status': x.status, 'finished': x.finished} for x in obj.jobs.filter(active=True).order_by('-created')[:10]]
return d
def validate_survey_enabled(self, attrs, source):

View File

@ -4,6 +4,7 @@
from django.conf import settings
from mongoengine import connect
from mongoengine.connection import ConnectionError
from pymongo.errors import AutoReconnect
def test_mongo_connection():
# Connect to Mongo
@ -14,13 +15,14 @@ def test_mongo_connection():
raise ConnectionError
# Attempt to connect to the MongoDB database.
connect(settings.MONGO_DB,
host=settings.MONGO_HOST,
port=int(settings.MONGO_PORT),
username=settings.MONGO_USERNAME,
password=settings.MONGO_PASSWORD,
tz_aware=settings.USE_TZ)
db = connect(settings.MONGO_DB,
host=settings.MONGO_HOST,
port=int(settings.MONGO_PORT),
username=settings.MONGO_USERNAME,
password=settings.MONGO_PASSWORD,
tz_aware=settings.USE_TZ)
db[settings.MONGO_DB].command('ping')
return True
except ConnectionError:
except (ConnectionError, AutoReconnect):
return False

View File

@ -750,6 +750,9 @@ class ProjectUpdateAccess(BaseAccess):
def can_cancel(self, obj):
return self.can_change(obj, {}) and obj.can_cancel
def can_delete(self, obj):
return obj and self.user.can_access(Project, 'delete', obj.project)
class PermissionAccess(BaseAccess):
'''
I can see a permission when:

View File

@ -5,7 +5,7 @@ import logging
import threading
import uuid
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import IntegrityError
from django.http import HttpResponseRedirect

View File

@ -293,7 +293,7 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
# Overwrite with job template extra vars with survey default vars
if self.survey_enabled and 'spec' in self.survey_spec:
for survey_element in self.survey_spec.get("spec", []):
if survey_element['default']:
if 'default' in survey_element and survey_element['default']:
extra_vars[survey_element['variable']] = survey_element['default']
# transform to dict

View File

@ -1101,6 +1101,7 @@ class RunInventoryUpdate(BaseTask):
ec2_opts.setdefault('all_rds_instances', 'False')
ec2_opts.setdefault('rds', 'False')
ec2_opts.setdefault('nested_groups', 'True')
ec2_opts.setdefault('elasticache', 'False')
if inventory_update.instance_filters:
ec2_opts.setdefault('instance_filters', inventory_update.instance_filters)
group_by = [x.strip().lower() for x in inventory_update.group_by.split(',') if x.strip()]

View File

@ -1321,6 +1321,28 @@ class ProjectUpdatesTest(BaseTransactionTest):
with self.current_user(self.super_django_user):
self.post(projects_url, project_data, expect=201)
def test_delete_project_update_as_org_admin(self):
scm_url = getattr(settings, 'TEST_GIT_PUBLIC_HTTPS',
'https://github.com/ansible/ansible.github.com.git')
if not all([scm_url]):
self.skipTest('no public git repo defined for https!')
projects_url = reverse('api:project_list')
project_data = {
'name': 'my public git project over https',
'scm_type': 'git',
'scm_url': scm_url,
}
org = self.make_organizations(self.super_django_user, 1)[0]
org.admins.add(self.normal_django_user)
with self.current_user(self.super_django_user):
del_proj = self.post(projects_url, project_data, expect=201)
del_proj = Project.objects.get(pk=del_proj["id"])
org.projects.add(del_proj)
pu = self.check_project_update(del_proj)
pu_url = reverse('api:project_update_detail', args=(pu.id,))
self.delete(pu_url, expect=403, auth=self.get_other_credentials())
self.delete(pu_url, expect=204, auth=self.get_normal_credentials())
def test_public_git_project_over_https(self):
scm_url = getattr(settings, 'TEST_GIT_PUBLIC_HTTPS',
'https://github.com/ansible/ansible.github.com.git')

View File

@ -4,6 +4,7 @@
scan_use_recursive: false
tasks:
- scan_packages:
os_family: '{{ ansible_os_family }}'
- scan_services:
- scan_files:
paths: '{{ scan_file_paths }}'

View File

@ -1,6 +1,5 @@
#!/usr/bin/env python
import os
from ansible.module_utils.basic import * # noqa
DOCUMENTATION = '''
@ -70,16 +69,20 @@ def deb_package_list():
def main():
module = AnsibleModule(
argument_spec = dict())
packages = []
# TODO: module_utils/basic.py in ansible contains get_distribution() and get_distribution_version()
# which can be used here and is accessible by this script instead of this basic detector.
if os.path.exists("/etc/redhat-release"):
argument_spec = dict(os_family=dict(required=True))
)
ans_os = module.params['os_family']
if ans_os in ('RedHat', 'Suse', 'openSUSE Leap'):
packages = rpm_package_list()
elif os.path.exists("/etc/os-release"):
elif ans_os == 'Debian':
packages = deb_package_list()
results = dict(ansible_facts=dict(packages=packages))
else:
packages = None
if packages is not None:
results = dict(ansible_facts=dict(packages=packages))
else:
results = dict(skipped=True, msg="Unsupported Distribution")
module.exit_json(**results)
main()

View File

@ -205,7 +205,7 @@ export default
column: 2,
awPopOver: "<p>Provide a comma separated list of tags.</p>\n" +
"<p>Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.</p>" +
"<p>For example, you might have a task consisiting of a long list of actions. Tag values can be assigned to each action. " +
"<p>For example, you might have a task consisting of a long list of actions. Tag values can be assigned to each action. " +
"Suppose the actions have been assigned tag values of &quot;configuration&quot;, &quot;packages&quot; and &quot;install&quot;.</p>" +
"<p>If you just want to run the &quot;configuration&quot; and &quot;packages&quot; actions, you would enter the following here " +
"in the Job Tags field:</p>\n<blockquote>configuration,packages</blockquote>\n",

View File

@ -790,6 +790,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
ParseTypeChange({ scope: properties_scope, field_id: textareaID, onReady: waitStop });
}
function initSourceChange() {
parent_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value!=="manual") ? true : false;
SourceChange({ scope: sources_scope, form: SourceForm });
}
// Set modal dimensions based on viewport width
ww = $(document).width();
wh = $('body').height();
@ -1058,7 +1063,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
}
}
sources_scope.sourceChange(); //set defaults that rely on source value
initSourceChange();
if (data.source_regions) {
if (data.source === 'ec2' ||
@ -1470,8 +1475,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
if (sources_scope.credential_name_api_error) {
delete sources_scope.credential_name_api_error;
}
parent_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value!=="manual") ? true : false;
SourceChange({ scope: sources_scope, form: SourceForm });
initSourceChange();
};
};

View File

@ -428,7 +428,7 @@ export default
// }, 300);
});
if (base === 'jobs' && list.name === 'completed_jobs') {
if (base === 'jobs' && list.name === 'all_jobs') {
if ($routeParams.id__int) {
scope[list.iterator + 'SearchField'] = 'id';
scope[list.iterator + 'SearchValue'] = $routeParams.id__int;

View File

@ -115,7 +115,7 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
scope.customLogo = ($AnsibleConfig.custom_logo) ? "custom_console_logo.png" : "tower_console_logo.png";
scope.customLoginInfo = $AnsibleConfig.custom_login_info;
scope.customLoginInfoPresent = ($AnsibleConfig.customLoginInfo) ? true : false;
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
});
// Reset the login form

View File

@ -258,7 +258,8 @@ export default
return $http({
method: 'OPTIONS',
url: this.url,
headers: this.headers
headers: this.headers,
data: ''
});
} else {
return this.createResponse({

View File

@ -54,7 +54,7 @@
'is-active': module.isActive,
}"
ng-click="setActiveModule(module.name)"
ng-repeat="module in modules | orderBy: 'sortKey'">
ng-repeat="module in modules | orderBy: 'sortKey' track by $index">
{{module.displayName}}
</button>
</nav>