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

Use YAML safe command versions in server start CLI command #2352

Merged
merged 5 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ These changes are available in the [master branch](https://github.com/PrefectHQ/
- Add option to connect containers created by Docker agent to an existing Docker network - [#2334](https://github.com/PrefectHQ/prefect/pull/2334)
- Expose `datefmt` as a configurable logging option in Prefect configuration - [#2340](https://github.com/PrefectHQ/prefect/pull/2340)
- The Docker agent configures containers to auto-remove on completion - [#2347](https://github.com/PrefectHQ/prefect/pull/2347)
- Use YAML's safe load and dump commands for the `server start` CLI command - [#2352](https://github.com/PrefectHQ/prefect/pull/2352)

### Task Library

Expand Down
4 changes: 2 additions & 2 deletions src/prefect/cli/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def start(
shutil.copy2(os.path.join(docker_dir, "docker-compose.yml"), temp_path)

with open(temp_path, "r") as file:
y = yaml.load(file)
y = yaml.safe_load(file)

if no_postgres_port:
del y["services"]["postgres"]["ports"]
Expand All @@ -260,7 +260,7 @@ def start(
]

with open(temp_path, "w") as f:
y = yaml.dump(y, f)
y = yaml.safe_dump(y, f)

compose_dir_path = temp_dir

Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_server_start_linux_host(monkeypatch, linux_platform):
monkeypatch.setattr("prefect.cli.server.get_docker_ip", get_docker_ip)

yaml_dump = MagicMock()
monkeypatch.setattr("yaml.dump", yaml_dump)
monkeypatch.setattr("yaml.safe_dump", yaml_dump)

runner = CliRunner()
result = runner.invoke(server, ["start", "--skip-pull",],)
Expand Down