From 8727b3b6e29262ab8a0258890782041ae1202fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Thu, 5 Feb 2026 13:23:50 +0100 Subject: [PATCH 1/2] docs: Document --replace-machine switch --- docs/rofl.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/rofl.md b/docs/rofl.md index f4b08d0e..590d3a15 100644 --- a/docs/rofl.md +++ b/docs/rofl.md @@ -223,6 +223,8 @@ offer: - `--term ` specifies the base rent period. It takes the first available provider term by default. - `--term-count ` specifies the multiplier. Default is `1`. +- `--replace-machine` if the existing machine in the manifest file expired, + rent a new machine and replace the existing machine ID. ![code shell](../examples/rofl/deploy.in.static) From aa0d41889b44bf8190fcfab4cfad05bbe9648656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Wed, 4 Feb 2026 17:38:29 +0100 Subject: [PATCH 2/2] cmd/rofl/machine: Pretty print metadata --- cmd/rofl/machine/show.go | 49 +++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/cmd/rofl/machine/show.go b/cmd/rofl/machine/show.go index 75ba04de..aa94feed 100644 --- a/cmd/rofl/machine/show.go +++ b/cmd/rofl/machine/show.go @@ -2,10 +2,12 @@ package machine import ( "context" + "encoding/base64" "encoding/binary" "encoding/json" "fmt" "net" + "sort" "strings" "time" @@ -132,9 +134,7 @@ func prettyPrintMachine(mCfg *machineCfg, out *machineShowOutput) { if len(out.Machine.Metadata) > 0 { fmt.Printf("Metadata:\n") - for key, value := range out.Machine.Metadata { - fmt.Printf(" %s: %s\n", key, value) - } + prettyPrintMachineMetadata(out.Machine.Metadata, " ", " ") } fmt.Printf("Resources:\n") @@ -169,9 +169,7 @@ func prettyPrintMachine(mCfg *machineCfg, out *machineShowOutput) { if len(out.Machine.Deployment.Metadata) > 0 { fmt.Printf(" Metadata:\n") - for key, value := range out.Machine.Deployment.Metadata { - fmt.Printf(" %s: %s\n", key, value) - } + prettyPrintMachineMetadata(out.Machine.Deployment.Metadata, " ", " ") } case nil: fmt.Printf("Deployment: \n") @@ -239,6 +237,45 @@ func prettyPrintMachinePorts(extraCfg *roflCmdBuild.AppExtraConfig, appID rofl.A } } +func prettyPrintMachineMetadata(metadata map[string]string, prefix, indent string) { + fallBackPrint := func(key, value, prefix string) { + fmt.Printf("%s%s: %s\n", prefix, key, value) + } + + // Sort metadata keys for consistent output. + keys := make([]string, 0, len(metadata)) + for key := range metadata { + keys = append(keys, key) + } + sort.Strings(keys) + + for _, key := range keys { + value := metadata[key] + switch key { + case scheduler.MetadataKeyPermissions: + cborValue, err := base64.StdEncoding.DecodeString(value) + if err != nil { + fallBackPrint(key, value, prefix) + continue + } + var permissions map[string][]types.Address + if err = cbor.Unmarshal(cborValue, &permissions); err != nil { + fallBackPrint(key, value, prefix) + continue + } + fmt.Printf("%s%s:\n", prefix, key) + for p, addresses := range permissions { + fmt.Printf("%s%s:\n", prefix+indent, p) + for _, a := range addresses { + fmt.Printf("%s- %s\n", prefix+indent+indent, common.PrettyAddress(a.String())) + } + } + default: + fallBackPrint(key, value, prefix) + } + } +} + func init() { common.AddSelectorFlags(showCmd) showCmd.Flags().AddFlagSet(common.FormatFlag)