diff --git a/CHANGELOG.md b/CHANGELOG.md index df5ce60..b1aca37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project uses [Semantic Versioning](https://semver.org/). - Internal: the four near-identical product command trees were unified into one `ProductProfile`-parameterized implementation — the `gcp`/`az`/`oci` command classes are now thin subclasses of the root commands, eliminating the copy-drift bug class - **Snapshot commands are now real API calls in every product tree.** `floci gcp|az|oci snapshot save/load/list/delete` call the product server's `/snapshots` control-plane endpoints and degrade gracefully when the server doesn't support them yet — previously they printed a "not yet available" note and exited 0. `snapshot export`/`import` now exit 1 with an error in all four trees (previously exit 0 with a note on gcp/az/oci); CI scripts that relied on the silent success of stubbed snapshot commands will now see failures. Snapshot error messages point at the product's GitHub issue tracker instead of the maintainer-only TODO.md - `floci gcp|az|oci logs` gained the `--service` flag and `services` gained `--mode`, matching the AWS tree (they had drifted apart); `version` on the AWS tree now prints the port-auto-detected endpoint in its "not reachable" hint like the other trees +- `services` and `snapshot save/load/list/delete` now auto-detect the endpoint from the running container's port mapping in every tree (like `status`/`wait`/`env` always did), so a container started with `--port ` is found without passing `--endpoint` - Global `--endpoint`/`--container` help text now shows each product's default value - The AWS tree now brands itself **Floci AWS** in banners, messages, and help text ("Starting Floci AWS container...", "Floci AWS Doctor", "Show Floci AWS container and server status"), matching the Floci GCP / Floci Azure / Floci OCI naming diff --git a/src/main/java/io/floci/cli/commands/snapshot/SnapshotDeleteCommand.java b/src/main/java/io/floci/cli/commands/snapshot/SnapshotDeleteCommand.java index 3585a9e..f63e302 100644 --- a/src/main/java/io/floci/cli/commands/snapshot/SnapshotDeleteCommand.java +++ b/src/main/java/io/floci/cli/commands/snapshot/SnapshotDeleteCommand.java @@ -2,6 +2,7 @@ package io.floci.cli.commands.snapshot; import io.floci.cli.GlobalOptions; import io.floci.cli.ProductProfile; +import io.floci.cli.docker.DockerClient; import io.floci.cli.http.FlociException; import io.floci.cli.http.FlociHttpClient; import io.floci.cli.output.Ansi; @@ -37,7 +38,10 @@ public class SnapshotDeleteCommand implements Callable { @Override public Integer call() { Printer printer = global.printer(); - FlociHttpClient client = new FlociHttpClient(global.endpoint, profile.controlPrefix()); + // Resolve the endpoint from the container's port mapping, like status/services/wait do, + // so a container started with --port is still found without --endpoint. + String effectiveEndpoint = global.resolvedEndpoint(new DockerClient()); + FlociHttpClient client = new FlociHttpClient(effectiveEndpoint, profile.controlPrefix()); try { client.deleteSnapshot(name); printer.println(Ansi.green("Snapshot deleted:") + " " + name); diff --git a/src/main/java/io/floci/cli/commands/snapshot/SnapshotListCommand.java b/src/main/java/io/floci/cli/commands/snapshot/SnapshotListCommand.java index 5ef0761..1f0ebf8 100644 --- a/src/main/java/io/floci/cli/commands/snapshot/SnapshotListCommand.java +++ b/src/main/java/io/floci/cli/commands/snapshot/SnapshotListCommand.java @@ -2,6 +2,7 @@ package io.floci.cli.commands.snapshot; import io.floci.cli.GlobalOptions; import io.floci.cli.ProductProfile; +import io.floci.cli.docker.DockerClient; import io.floci.cli.http.FlociException; import io.floci.cli.http.FlociHttpClient; import io.floci.cli.output.Ansi; @@ -35,7 +36,10 @@ public class SnapshotListCommand implements Callable { @Override public Integer call() { Printer printer = global.printer(); - FlociHttpClient client = new FlociHttpClient(global.endpoint, profile.controlPrefix()); + // Resolve the endpoint from the container's port mapping, like status/services/wait do, + // so a container started with --port is still found without --endpoint. + String effectiveEndpoint = global.resolvedEndpoint(new DockerClient()); + FlociHttpClient client = new FlociHttpClient(effectiveEndpoint, profile.controlPrefix()); try { var node = client.listSnapshots(); if (printer.format() != OutputFormat.text) { diff --git a/src/main/java/io/floci/cli/commands/snapshot/SnapshotLoadCommand.java b/src/main/java/io/floci/cli/commands/snapshot/SnapshotLoadCommand.java index cc559b6..82ab9f5 100644 --- a/src/main/java/io/floci/cli/commands/snapshot/SnapshotLoadCommand.java +++ b/src/main/java/io/floci/cli/commands/snapshot/SnapshotLoadCommand.java @@ -2,6 +2,7 @@ package io.floci.cli.commands.snapshot; import io.floci.cli.GlobalOptions; import io.floci.cli.ProductProfile; +import io.floci.cli.docker.DockerClient; import io.floci.cli.http.FlociException; import io.floci.cli.http.FlociHttpClient; import io.floci.cli.output.Ansi; @@ -37,7 +38,10 @@ public class SnapshotLoadCommand implements Callable { @Override public Integer call() { Printer printer = global.printer(); - FlociHttpClient client = new FlociHttpClient(global.endpoint, profile.controlPrefix()); + // Resolve the endpoint from the container's port mapping, like status/services/wait do, + // so a container started with --port is still found without --endpoint. + String effectiveEndpoint = global.resolvedEndpoint(new DockerClient()); + FlociHttpClient client = new FlociHttpClient(effectiveEndpoint, profile.controlPrefix()); try { client.loadSnapshot(name); printer.println(Ansi.green("Snapshot loaded:") + " " + name); diff --git a/src/main/java/io/floci/cli/commands/snapshot/SnapshotSaveCommand.java b/src/main/java/io/floci/cli/commands/snapshot/SnapshotSaveCommand.java index 65c1354..5aaa60c 100644 --- a/src/main/java/io/floci/cli/commands/snapshot/SnapshotSaveCommand.java +++ b/src/main/java/io/floci/cli/commands/snapshot/SnapshotSaveCommand.java @@ -2,6 +2,7 @@ package io.floci.cli.commands.snapshot; import io.floci.cli.GlobalOptions; import io.floci.cli.ProductProfile; +import io.floci.cli.docker.DockerClient; import io.floci.cli.http.FlociException; import io.floci.cli.http.FlociHttpClient; import io.floci.cli.output.Ansi; @@ -40,7 +41,10 @@ public class SnapshotSaveCommand implements Callable { @Override public Integer call() { Printer printer = global.printer(); - FlociHttpClient client = new FlociHttpClient(global.endpoint, profile.controlPrefix()); + // Resolve the endpoint from the container's port mapping, like status/services/wait do, + // so a container started with --port is still found without --endpoint. + String effectiveEndpoint = global.resolvedEndpoint(new DockerClient()); + FlociHttpClient client = new FlociHttpClient(effectiveEndpoint, profile.controlPrefix()); try { client.postSnapshot(name); printer.println(Ansi.green("Snapshot saved:") + " " + name);