mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Merge pull request #2200 from ryanpetrello/custom_venv_allow_bundled
allow the bundled `ansible` virtualenv to be selected on JT/Project
This commit is contained in:
commit
b4c30576af
@ -173,11 +173,15 @@ def test_extract_ansible_vars():
|
||||
|
||||
|
||||
def test_get_custom_venv_choices():
|
||||
assert common.get_custom_venv_choices() == []
|
||||
bundled_venv = os.path.join(settings.BASE_VENV_PATH, 'ansible', '')
|
||||
assert common.get_custom_venv_choices() == [bundled_venv]
|
||||
|
||||
with TemporaryDirectory(dir=settings.BASE_VENV_PATH) as temp_dir:
|
||||
with TemporaryDirectory(dir=settings.BASE_VENV_PATH, prefix='tmp') as temp_dir:
|
||||
os.makedirs(os.path.join(temp_dir, 'bin', 'activate'))
|
||||
assert common.get_custom_venv_choices() == [os.path.join(temp_dir, '')]
|
||||
assert sorted(common.get_custom_venv_choices()) == [
|
||||
bundled_venv,
|
||||
os.path.join(temp_dir, '')
|
||||
]
|
||||
|
||||
|
||||
def test_region_sorting():
|
||||
|
||||
@ -928,7 +928,7 @@ def get_custom_venv_choices():
|
||||
return [
|
||||
os.path.join(custom_venv_path, x.decode('utf-8'), '')
|
||||
for x in os.listdir(custom_venv_path)
|
||||
if x not in ('awx', 'ansible') and
|
||||
if x != 'awx' and
|
||||
os.path.isdir(os.path.join(custom_venv_path, x)) and
|
||||
os.path.exists(os.path.join(custom_venv_path, x, 'bin', 'activate'))
|
||||
]
|
||||
|
||||
@ -26,7 +26,10 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
|
||||
function init(){
|
||||
// @issue What is this doing, why
|
||||
$scope.$emit("HideOrgListHeader");
|
||||
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||
$scope.custom_virtualenvs_visible = ConfigData.custom_virtualenvs.length > 1;
|
||||
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs.filter(
|
||||
v => !/\/ansible\/$/.test(v)
|
||||
);
|
||||
CreateSelect2({
|
||||
element: '#organization_custom_virtualenv',
|
||||
multiple: false,
|
||||
|
||||
@ -34,7 +34,10 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
||||
|
||||
$scope.$emit("HideOrgListHeader");
|
||||
$scope.instance_groups = InstanceGroupsData;
|
||||
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||
$scope.custom_virtualenvs_visible = ConfigData.custom_virtualenvs.length > 1;
|
||||
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs.filter(
|
||||
v => !/\/ansible\/$/.test(v)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ export default ['NotificationsList', 'i18n',
|
||||
},
|
||||
custom_virtualenv: {
|
||||
label: i18n._('Ansible Environment'),
|
||||
defaultText: i18n._('Default Environment'),
|
||||
defaultText: i18n._('Use Default Environment'),
|
||||
type: 'select',
|
||||
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this organization to run on.") + "</p>",
|
||||
@ -53,7 +53,7 @@ export default ['NotificationsList', 'i18n',
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
ngDisabled: '!(organization_obj.summary_fields.user_capabilities.edit || canAdd)',
|
||||
ngShow: 'custom_virtualenvs_options.length > 0'
|
||||
ngShow: 'custom_virtualenvs_visible'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -206,14 +206,14 @@ export default ['i18n', 'NotificationsList', 'TemplateList',
|
||||
custom_virtualenv: {
|
||||
label: i18n._('Ansible Environment'),
|
||||
type: 'select',
|
||||
defaultText: i18n._('Default Environment'),
|
||||
defaultText: i18n._('Use Default Environment'),
|
||||
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this project to run on.") + "</p>",
|
||||
dataTitle: i18n._('Ansible Environment'),
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)',
|
||||
ngShow: 'custom_virtualenvs_options.length > 0'
|
||||
ngShow: 'custom_virtualenvs_options.length > 1'
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@ -234,14 +234,15 @@ function(NotificationsList, i18n) {
|
||||
custom_virtualenv: {
|
||||
label: i18n._('Ansible Environment'),
|
||||
type: 'select',
|
||||
defaultText: i18n._('Default Environment'),
|
||||
defaultText: i18n._('Use Default Environment'),
|
||||
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||
|
||||
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this job template to run on.") + "</p>",
|
||||
dataTitle: i18n._('Ansible Environment'),
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAdd)',
|
||||
ngShow: 'custom_virtualenvs_options.length > 0'
|
||||
ngShow: 'custom_virtualenvs_options.length > 1'
|
||||
},
|
||||
instance_groups: {
|
||||
label: i18n._('Instance Groups'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user