containers / containers/podlet

CLI inappropriately suggests `--file` flag when `--skip-services-check` is needed

Open
#212 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.6k
Forks
48
Avg merge
1d 9h
Merged PRs (30d)
1

Description

TL;DR: CLI suggests `--name` regardless of where the conflict occurs. For usability, it would be nice to get additional information like:
> Use `--skip-services-check` if you plan to replace the existing service file at [PATH]

Attempting to create Quadlet files from existing objects, but file conflicts get in the way even when specifying the file location. This is confusing when the `--file` flag specifies a path that should not conflict, and the services check purpose isn't obvious from the output.

```bash
for container in $(sudo podman ps --format {{.Names}}); do
sudo $(which podlet) --file . generate container $container
done
```

replacing that flag with `--file /home/me/podlet` (which should be the same as `.`) didn't make a difference, of course. Output includes (for [`nginx-proxy`](https://github.com/nginx-proxy/nginx-proxy)/[`acme-companion`](https://github.com/nginx-proxy/acme-companion)):

```
Error:
0: File name `nginx-proxy` conflicts with existing unit file: /etc/systemd/system/container-nginx-proxy.service

Location:
src/cli.rs:809

Suggestion: Change the generated file's name with `--file` or `--name`. Alternatively, use `--skip-services-check` if this is ok.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error:
0: File name `nginx-proxy-acme` conflicts with existing unit file: /etc/systemd/system/container-nginx-proxy-acme.service

Location:
src/cli.rs:809

Suggestion: Change the generated file's name with `--file` or `--name`. Alternatively, use `--skip-services-check` if this is ok.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.