Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized var when security groups stack not configured with … #294

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 39 additions & 34 deletions source/cdk/cdk_slurm_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,51 +710,56 @@ def update_config_for_res(self):
logger.error(f"RES VDC controller security group not found.")
exit(1)

self.config['ExternalLoginNodes'] = self.config.get('ExternalLoginNodes', [])
self.config['ExternalLoginNodes'].append(
{
if 'AdditionalSecurityGroupsStackName' not in self.config:
logger.warning(f"Can't automatically configure RES ExternalLoginNodes or DomainJoinedInstance because AdditionalSecurityGroupsStackName not configured.")

if 'AdditionalSecurityGroupsStackName' in self.config:
self.config['ExternalLoginNodes'] = self.config.get('ExternalLoginNodes', [])
self.config['ExternalLoginNodes'].append(
{
'Tags': [
{
'Key': 'res:EnvironmentName',
'Values': [self.res_environment_name]
},
{
'Key': 'res:NodeType',
'Values': ['virtual-desktop-dcv-host']
}
],
'SecurityGroupId': self.slurm_login_node_sg_id
}
)

if 'DomainJoinedInstance' in self.config:
logger.error(f"Can't specify both DomainJoinedInstance and RESStackName in config file.")
exit(1)
if 'AdditionalSecurityGroupsStackName' in self.config:
self.config['DomainJoinedInstance'] = {
'Tags': [
{
'Key': 'Name',
'Values': [f"{self.res_environment_name}-cluster-manager",]
},
{
'Key': 'res:EnvironmentName',
'Values': [self.res_environment_name]
},
{
'Key': 'res:ModuleName',
'Values': ['cluster-manager']
},
{
'Key': 'res:ModuleId',
'Values': ['cluster-manager']
},
{
'Key': 'res:NodeType',
'Values': ['virtual-desktop-dcv-host']
'Values': ['app']
}
],
'SecurityGroupId': self.slurm_login_node_sg_id
}
)

if 'DomainJoinedInstance' in self.config:
logger.error(f"Can't specify both DomainJoinedInstance and RESStackName in config file.")
exit(1)
self.config['DomainJoinedInstance'] = {
'Tags': [
{
'Key': 'Name',
'Values': [f"{self.res_environment_name}-cluster-manager",]
},
{
'Key': 'res:EnvironmentName',
'Values': [self.res_environment_name]
},
{
'Key': 'res:ModuleName',
'Values': ['cluster-manager']
},
{
'Key': 'res:ModuleId',
'Values': ['cluster-manager']
},
{
'Key': 'res:NodeType',
'Values': ['app']
}
],
'SecurityGroupId': self.slurm_login_node_sg_id
}

# Configure the /home mount from RES if /home not already configured
home_mount_found = False
Expand Down