mirror of
https://github.com/ansible/awx.git
synced 2026-02-21 13:10:11 -03:30
AC-403 changed Host add/update to stringify variable data and include it directly in the Post or Put operation, bypassing use of host/N/variables. Now host names can include a :port.
This commit is contained in:
committed by
Chris Church
parent
7f7140ccda
commit
778fe07179
@@ -145,25 +145,20 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data['inventory'] = inventory_id;
|
data['inventory'] = inventory_id;
|
||||||
|
|
||||||
|
if ($.isEmptyObject(json_data)) {
|
||||||
|
data['variables'] = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data['variables'] = JSON.stringify(json_data, undefined, '\t');
|
||||||
|
}
|
||||||
|
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
if (scope.variables) {
|
finished();
|
||||||
Rest.setUrl(data.related.variable_data);
|
|
||||||
Rest.put(json_data)
|
|
||||||
.success( function(data, status, headers, config) {
|
|
||||||
finished();
|
|
||||||
})
|
|
||||||
.error( function(data, status, headers, config) {
|
|
||||||
ProcessErrors(scope, data, status, form,
|
|
||||||
{ hdr: 'Error!', msg: 'Failed to add host varaibles. PUT returned status: ' + status });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
finished();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
scope.formModalActionDisabled = false;
|
scope.formModalActionDisabled = false;
|
||||||
@@ -306,24 +301,18 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
data['inventory'] = inventory_id;
|
data['inventory'] = inventory_id;
|
||||||
|
|
||||||
|
if ($.isEmptyObject(json_data)) {
|
||||||
|
data['variables'] = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data['variables'] = JSON.stringify(json_data, undefined, '\t');
|
||||||
|
}
|
||||||
|
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.put(data)
|
Rest.put(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
if (scope.variables) {
|
finished();
|
||||||
//update host variables
|
|
||||||
Rest.setUrl(GetBasePath('hosts') + data.id + '/variable_data/');
|
|
||||||
Rest.put(json_data)
|
|
||||||
.success( function(data, status, headers, config) {
|
|
||||||
finished();
|
|
||||||
})
|
|
||||||
.error( function(data, status, headers, config) {
|
|
||||||
ProcessErrors(scope, data, status, form,
|
|
||||||
{ hdr: 'Error!', msg: 'Failed to update host varaibles. PUT returned status: ' + status });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
finished();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, form,
|
ProcessErrors(scope, data, status, form,
|
||||||
|
|||||||
Reference in New Issue
Block a user