mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 18:07:33 -02:30
Merge pull request #2451 from matburt/fixup_test_userlaunch
Force openshift user behavior for uids over 2500 Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -9,7 +9,6 @@ import copy
|
|||||||
from urlparse import urljoin
|
from urlparse import urljoin
|
||||||
import os.path
|
import os.path
|
||||||
import six
|
import six
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -42,7 +41,7 @@ from awx.main.models.notifications import (
|
|||||||
NotificationTemplate,
|
NotificationTemplate,
|
||||||
JobNotificationMixin,
|
JobNotificationMixin,
|
||||||
)
|
)
|
||||||
from awx.main.utils import _inventory_updates, get_ansible_version, region_sorting
|
from awx.main.utils import _inventory_updates, region_sorting
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Inventory', 'Host', 'Group', 'InventorySource', 'InventoryUpdate',
|
__all__ = ['Inventory', 'Host', 'Group', 'InventorySource', 'InventoryUpdate',
|
||||||
@@ -1578,12 +1577,6 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions, RelatedJobsMix
|
|||||||
"Instead, configure the corresponding source project to update on launch."))
|
"Instead, configure the corresponding source project to update on launch."))
|
||||||
return self.update_on_launch
|
return self.update_on_launch
|
||||||
|
|
||||||
def clean_overwrite_vars(self): # TODO: remove when Ansible 2.4 becomes unsupported, obviously
|
|
||||||
if self.source == 'scm' and not self.overwrite_vars:
|
|
||||||
if get_ansible_version() < LooseVersion('2.5'):
|
|
||||||
raise ValidationError(_("SCM type sources must set `overwrite_vars` to `true` until Ansible 2.5."))
|
|
||||||
return self.overwrite_vars
|
|
||||||
|
|
||||||
def clean_source_path(self):
|
def clean_source_path(self):
|
||||||
if self.source != 'scm' and self.source_path:
|
if self.source != 'scm' and self.source_path:
|
||||||
raise ValidationError(_("Cannot set source_path if not SCM type."))
|
raise ValidationError(_("Cannot set source_path if not SCM type."))
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import tempfile
|
|||||||
import shutil
|
import shutil
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from six.moves import xrange
|
from six.moves import xrange
|
||||||
|
from mock import PropertyMock
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.core.urlresolvers import resolve
|
from django.core.urlresolvers import resolve
|
||||||
@@ -752,3 +753,8 @@ def sqlite_copy_expert(request):
|
|||||||
request.addfinalizer(lambda: delattr(SQLiteCursorWrapper, 'copy_expert'))
|
request.addfinalizer(lambda: delattr(SQLiteCursorWrapper, 'copy_expert'))
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def disable_database_settings(mocker):
|
||||||
|
m = mocker.patch('awx.conf.settings.SettingsWrapper.all_supported_settings', new_callable=PropertyMock)
|
||||||
|
m.return_value = []
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class SlowResultWriter(BaseWorker):
|
|||||||
super(SlowResultWriter, self).perform_work(body, result_queue)
|
super(SlowResultWriter, self).perform_work(body, result_queue)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("disable_database_settings")
|
||||||
class TestPoolWorker:
|
class TestPoolWorker:
|
||||||
|
|
||||||
def setup_method(self, test_method):
|
def setup_method(self, test_method):
|
||||||
@@ -247,6 +248,7 @@ class TestAutoScaling:
|
|||||||
assert len(self.pool) == 2
|
assert len(self.pool) == 2
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("disable_database_settings")
|
||||||
class TestTaskDispatcher:
|
class TestTaskDispatcher:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -73,17 +73,6 @@ def test_invalid_kind_clean_insights_credential():
|
|||||||
|
|
||||||
|
|
||||||
class TestControlledBySCM():
|
class TestControlledBySCM():
|
||||||
@pytest.mark.parametrize('source', [
|
|
||||||
'scm',
|
|
||||||
'ec2',
|
|
||||||
'manual',
|
|
||||||
])
|
|
||||||
def test_clean_overwrite_vars_valid(self, source):
|
|
||||||
inv_src = InventorySource(overwrite_vars=True,
|
|
||||||
source=source)
|
|
||||||
|
|
||||||
inv_src.clean_overwrite_vars()
|
|
||||||
|
|
||||||
def test_clean_source_path_valid(self):
|
def test_clean_source_path_valid(self):
|
||||||
inv_src = InventorySource(source_path='/not_real/',
|
inv_src = InventorySource(source_path='/not_real/',
|
||||||
source='scm')
|
source='scm')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set +x
|
set +x
|
||||||
|
|
||||||
if [ `id -u` -ge 500 ]; then
|
if [ `id -u` -ge 500 ]; then
|
||||||
echo "awx:x:`id -u`:`id -g`:,,,:/var/lib/awx:/bin/bash" >> /tmp/passwd
|
echo "awx:x:`id -u`:`id -g`:,,,:/tmp:/bin/bash" >> /tmp/passwd
|
||||||
cat /tmp/passwd > /etc/passwd
|
cat /tmp/passwd > /etc/passwd
|
||||||
rm /tmp/passwd
|
rm /tmp/passwd
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set +x
|
set +x
|
||||||
|
|
||||||
if [ `id -u` -ge 500 ]; then
|
if [ `id -u` -ge 500 ]; then
|
||||||
echo "awx:x:`id -u`:`id -g`:,,,:/var/lib/awx:/bin/bash" >> /tmp/passwd
|
echo "awx:x:`id -u`:`id -g`:,,,:/tmp:/bin/bash" >> /tmp/passwd
|
||||||
cat /tmp/passwd > /etc/passwd
|
cat /tmp/passwd > /etc/passwd
|
||||||
rm /tmp/passwd
|
rm /tmp/passwd
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user