mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Make it so that we take source_vars with the custom inventory script
when defining the inventory source. Slight modification to the UI to make that possible
This commit is contained in:
parent
8b8fb2403c
commit
c43a7be99e
@ -1044,6 +1044,10 @@ class RunInventoryUpdate(BaseTask):
|
||||
elif inventory_update.source == 'file':
|
||||
# FIXME: Parse source_env to dict, update env.
|
||||
pass
|
||||
elif inventory_update.source == 'custom':
|
||||
for env_k in inventory_update.source_vars_dict:
|
||||
if env_k not in os.environ:
|
||||
env[env_k] = inventory_update.source_vars_dict[env_k]
|
||||
return env
|
||||
|
||||
def build_args(self, inventory_update, **kwargs):
|
||||
|
||||
@ -42,7 +42,7 @@ angular.module('SourceFormDefinition', [])
|
||||
credential: {
|
||||
label: 'Cloud Credential',
|
||||
type: 'lookup',
|
||||
ngShow: "source && source.value !== ''",
|
||||
ngShow: "source && source.value !== '' && source.value !== 'custom'",
|
||||
sourceModel: 'credential',
|
||||
sourceField: 'name',
|
||||
ngClick: 'lookUpCredential()',
|
||||
@ -65,7 +65,7 @@ angular.module('SourceFormDefinition', [])
|
||||
},
|
||||
source_vars: {
|
||||
label: 'Source Variables',
|
||||
ngShow: "source && (source.value == 'file' || source.value == 'ec2')",
|
||||
ngShow: "source && (source.value == 'file' || source.value == 'ec2' || source.value == 'custom')",
|
||||
type: 'textarea',
|
||||
addRequired: false,
|
||||
editRequird: false,
|
||||
|
||||
@ -268,7 +268,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
field: 'credential',
|
||||
input_type: "radio"
|
||||
});
|
||||
if ($('#group_tabs .active a').text() === 'Source' && scope.source.value === 'ec2') {
|
||||
if ($('#group_tabs .active a').text() === 'Source' && (scope.source.value === 'ec2' || scope.source.value == 'custom')) {
|
||||
callback = function(){ Wait('stop'); };
|
||||
Wait('start');
|
||||
scope.source_vars = (Empty(scope.source_vars)) ? "---" : scope.source_vars;
|
||||
@ -831,7 +831,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
||||
setTimeout(function(){ textareaResize('group_variables'); }, 300);
|
||||
}
|
||||
else if ($(e.target).text() === 'Source') {
|
||||
if (sources_scope.source && sources_scope.source.value === 'ec2') {
|
||||
if (sources_scope.source && (sources_scope.source.value === 'ec2' || sources_scope.source.value === 'custom')) {
|
||||
Wait('start');
|
||||
ParseTypeChange({ scope: sources_scope, variable: 'source_vars', parse_variable: SourceForm.fields.source_vars.parseTypeName,
|
||||
field_id: 'source_source_vars', onReady: waitStop });
|
||||
@ -1141,7 +1141,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
||||
}
|
||||
data.source_regions = r.join();
|
||||
|
||||
if (sources_scope.source && sources_scope.source.value === 'ec2') {
|
||||
if (sources_scope.source && (sources_scope.source.value === 'ec2' || sources_scope.source.value === 'custom')) {
|
||||
// for ec2, validate variable data
|
||||
data.source_vars = ToJSON(sources_scope.envParseType, sources_scope.source_vars, true);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user