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 some issues with context handling at deployment time #1716

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
✨ Add option to dump remote config to local file
  • Loading branch information
jemrobinson committed Jan 24, 2024
commit a33390385221821a479ca052ad6abdf4d5f125f8
12 changes: 9 additions & 3 deletions data_safe_haven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Install the following requirements before starting
> dsh deploy shm
```

You will be prompted for various settings.
Run `dsh deploy shm -h` to see the necessary command line flags and provide them as arguments.

- Add one or more users from a CSV file with columns named (`GivenName`, `Surname`, `Phone`, `Email`, `CountryCode`).
Expand All @@ -40,13 +39,20 @@ Run `dsh deploy shm -h` to see the necessary command line flags and provide them
> dsh admin add-users <my CSV users file>
```

- Next deploy the infrastructure for one or more Secure Research Environments (SREs) [approx 30 minutes]:
- Create the configuration for one or more Secure Research Environments (SREs)

```console
> dsh config show --file config.yaml
> vim config.yaml
> dsh config upload config.yaml
```

- Next deploy the infrastructure [approx 30 minutes]:

```console
> dsh deploy sre <SRE name>
```

You will be prompted for various settings.
Run `dsh deploy sre -h` to see the necessary command line flags and provide them as arguments.

- Next add one or more existing users to your SRE
Expand Down
13 changes: 11 additions & 2 deletions data_safe_haven/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,17 @@ def upload(


@config_command_group.command()
def show() -> None:
def show(
file: Annotated[
Optional[Path], # noqa: UP007
typer.Option(help="File path to write configuration template to."),
] = None
) -> None:
"""Print the configuration for the selected Data Safe Haven context"""
context = ContextSettings.from_file().assert_context()
config = Config.from_remote(context)
print(config.to_yaml())
if file:
with open(file, "w") as outfile:
outfile.write(config.to_yaml())
else:
print(config.to_yaml())