mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
In progress: Adding GCE to inventory source.
This commit is contained in:
@@ -736,6 +736,7 @@ class InventorySourceOptions(BaseModel):
|
|||||||
('file', _('Local File, Directory or Script')),
|
('file', _('Local File, Directory or Script')),
|
||||||
('rax', _('Rackspace Cloud Servers')),
|
('rax', _('Rackspace Cloud Servers')),
|
||||||
('ec2', _('Amazon EC2')),
|
('ec2', _('Amazon EC2')),
|
||||||
|
('gce', _('Google Compute Engine')),
|
||||||
]
|
]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -826,13 +827,15 @@ class InventorySourceOptions(BaseModel):
|
|||||||
return None
|
return None
|
||||||
cred = self.credential
|
cred = self.credential
|
||||||
if cred:
|
if cred:
|
||||||
if self.source == 'ec2' and cred.kind != 'aws':
|
# If a credential was provided, it's important that it matches
|
||||||
raise ValidationError('Credential kind must be "aws" for an '
|
# the actual inventory source being used (Amazon requires Amazon
|
||||||
'"ec2" source')
|
# credentials; Rackspace requires Rackspace credentials; etc...)
|
||||||
if self.source == 'rax' and cred.kind != 'rax':
|
if self.source.replace('ec2', 'awx') != cred.kind:
|
||||||
raise ValidationError('Credential kind must be "rax" for a '
|
raise ValidationError(
|
||||||
'"rax" source')
|
'Cloud-based inventory sources (such as %s) require '
|
||||||
elif self.source in ('ec2', 'rax'):
|
'credentials for the matching cloud service.' % self.source
|
||||||
|
)
|
||||||
|
elif self.source in ('ec2', 'rax', 'gce'):
|
||||||
raise ValidationError('Credential is required for a cloud source')
|
raise ValidationError('Credential is required for a cloud source')
|
||||||
return cred
|
return cred
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ angular.module('SourceFormDefinition', [])
|
|||||||
source_regions: {
|
source_regions: {
|
||||||
label: 'Regions',
|
label: 'Regions',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
ngShow: "source && (source.value == 'rax' || source.value == 'ec2')",
|
ngShow: "source && (source.value == 'rax' || source.value == 'ec2' || source.value == 'gce')",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
awMultiselect: 'source_region_choices',
|
awMultiselect: 'source_region_choices',
|
||||||
@@ -155,4 +155,4 @@ angular.module('SourceFormDefinition', [])
|
|||||||
|
|
||||||
related: { }
|
related: { }
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1027,6 +1027,15 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
callback: 'choicesReadyGroup'
|
callback: 'choicesReadyGroup'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
GetChoices({
|
||||||
|
scope: sources_scope,
|
||||||
|
url: GetBasePath('inventory_sources'),
|
||||||
|
field: 'source_regions',
|
||||||
|
variable: 'gce_regions',
|
||||||
|
choice_name: 'gce_region_choices',
|
||||||
|
callback: 'choicesReadyGroup'
|
||||||
|
});
|
||||||
|
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
|
||||||
if (parent_scope.removeAddTreeRefreshed) {
|
if (parent_scope.removeAddTreeRefreshed) {
|
||||||
@@ -1864,4 +1873,4 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user