Skip to content

Commit

Permalink
Update docstring and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Oct 17, 2024
1 parent 98942dc commit b16256f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion data_safe_haven/infrastructure/project_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,22 @@ def destroy(self) -> None:
raise DataSafeHavenPulumiError(msg) from exc

def ensure_config(self, name: str, value: str, *, secret: bool) -> None:
"""Ensure that config values have been set, setting them if they do not exist"""
"""
Ensure that config values have been set.
Values will be set if they do not exist.
If the value is already set and does not match the `value` argument,
`DataSafeHavenPulumiError` will be raised.
"""
try:
existing_value = self.stack.get_config(name).value
except automation.CommandError:
# Set value if it does not already exist
self.set_config(name, value, secret=secret)

# If the value does already exist, ensure it is consistent with the declared
# value
if existing_value != value:
msg = (
f"Unchangeable configuration option '{name}' not consistent, "
Expand Down

0 comments on commit b16256f

Please sign in to comment.