mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix the security groups selection for developer created VMs
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
68e5428d6b
commit
c12bbd1995
1 changed files with 20 additions and 5 deletions
25
tools/vm.py
25
tools/vm.py
|
@ -984,7 +984,6 @@ class VM:
|
|||
else:
|
||||
# This is a developer running
|
||||
log.info("Starting Developer configured VM")
|
||||
# Get the develpers security group
|
||||
security_group_filters = [
|
||||
{
|
||||
"Name": "vpc-id",
|
||||
|
@ -994,10 +993,6 @@ class VM:
|
|||
"Name": "tag:spb:project",
|
||||
"Values": ["salt-project"],
|
||||
},
|
||||
{
|
||||
"Name": "tag:spb:developer",
|
||||
"Values": ["true"],
|
||||
},
|
||||
]
|
||||
response = client.describe_security_groups(Filters=security_group_filters)
|
||||
if not response.get("SecurityGroups"):
|
||||
|
@ -1008,6 +1003,26 @@ class VM:
|
|||
self.ctx.exit(1)
|
||||
# Override the launch template network interfaces config
|
||||
security_group_ids = [sg["GroupId"] for sg in response["SecurityGroups"]]
|
||||
security_group_filters = [
|
||||
{
|
||||
"Name": "vpc-id",
|
||||
"Values": [vpc.id],
|
||||
},
|
||||
{
|
||||
"Name": "tag:Name",
|
||||
"Values": [f"saltproject-{environment}-client-vpn-remote-access"],
|
||||
},
|
||||
]
|
||||
response = client.describe_security_groups(Filters=security_group_filters)
|
||||
if not response.get("SecurityGroups"):
|
||||
self.ctx.error(
|
||||
"Could not find the right VPN access security group. "
|
||||
f"Filters:\n{pprint.pformat(security_group_filters)}"
|
||||
)
|
||||
self.ctx.exit(1)
|
||||
security_group_ids.extend(
|
||||
[sg["GroupId"] for sg in response["SecurityGroups"]]
|
||||
)
|
||||
|
||||
progress = create_progress_bar()
|
||||
create_task = progress.add_task(
|
||||
|
|
Loading…
Add table
Reference in a new issue