mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 14:36:00 -03:30
Update EC2 inventory import to use any variables defined in source_vars. Fix AC-565 by setting default regions_exclude to us-gov-west1 (same as default ec2.ini). Fix AC-566 by stripping extra whitespace from comma-separated region names.
This commit is contained in:
@@ -649,6 +649,7 @@ class InventorySource(PrimordialModel):
|
||||
source_vars = models.TextField(
|
||||
blank=True,
|
||||
default='',
|
||||
help_text=_('Inventory source variables in YAML or JSON format.'),
|
||||
)
|
||||
source_username = models.CharField(
|
||||
max_length=1024,
|
||||
@@ -760,6 +761,13 @@ class InventorySource(PrimordialModel):
|
||||
if update_fields:
|
||||
self.save(update_fields=update_fields)
|
||||
|
||||
@property
|
||||
def source_vars_dict(self):
|
||||
try:
|
||||
return json.loads(self.source_vars.strip() or '{}')
|
||||
except ValueError:
|
||||
return yaml.safe_load(self.source_vars)
|
||||
|
||||
@property
|
||||
def needs_source_password(self):
|
||||
return self.source and self.source_password == 'ASK'
|
||||
|
||||
Reference in New Issue
Block a user