Skip to content

Commit d75f12c

Browse files
authored
Merge pull request #437 from oasisprotocol/matevz/feature/rofl-machine-renamings
cmd/rofl/machine: Rename terminate/cancel -> stop/remove
2 parents 699be2e + a13041b commit d75f12c

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

cmd/rofl/machine/machine.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var Cmd = &cobra.Command{
1313
func init() {
1414
Cmd.AddCommand(showCmd)
1515
Cmd.AddCommand(restartCmd)
16-
Cmd.AddCommand(terminateCmd)
17-
Cmd.AddCommand(cancelCmd)
16+
Cmd.AddCommand(stopCmd)
17+
Cmd.AddCommand(removeCmd)
1818
Cmd.AddCommand(topUpCmd)
1919
}

cmd/rofl/machine/mgmt.go

+20-18
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ var (
161161

162162
restartCmd = &cobra.Command{
163163
Use: "restart [<machine-name>]",
164-
Short: "Restart a machine",
164+
Short: "Restart a running machine or start a stopped one",
165165
Args: cobra.MaximumNArgs(1),
166166
Run: func(_ *cobra.Command, args []string) {
167167
queueCommand(
@@ -175,10 +175,11 @@ var (
175175
},
176176
}
177177

178-
terminateCmd = &cobra.Command{
179-
Use: "terminate [<machine-name>]",
180-
Short: "Terminate a machine",
181-
Args: cobra.MaximumNArgs(1),
178+
stopCmd = &cobra.Command{
179+
Use: "stop [<machine-name>]",
180+
Short: "Stop a machine",
181+
Aliases: []string{"terminate"},
182+
Args: cobra.MaximumNArgs(1),
182183
Run: func(_ *cobra.Command, args []string) {
183184
queueCommand(
184185
args,
@@ -191,10 +192,11 @@ var (
191192
},
192193
}
193194

194-
cancelCmd = &cobra.Command{
195-
Use: "cancel [<machine-name>]",
196-
Short: "Cancel a machine",
197-
Args: cobra.MaximumNArgs(1),
195+
removeCmd = &cobra.Command{
196+
Use: "remove [<machine-name>]",
197+
Short: "Cancel rental and remove the machine",
198+
Aliases: []string{"cancel", "rm"},
199+
Args: cobra.MaximumNArgs(1),
198200
Run: func(_ *cobra.Command, args []string) {
199201
cfg := cliConfig.Global()
200202
npa := common.GetNPASelection(cfg)
@@ -223,7 +225,7 @@ var (
223225

224226
fmt.Printf("Using provider: %s (%s)\n", machine.Provider, providerAddr)
225227
fmt.Printf("Canceling machine: %s [%s]\n", machineName, machine.ID)
226-
fmt.Printf("WARNING: Canceling a machine will permanently destroy it!\n")
228+
fmt.Printf("WARNING: Canceling a machine will permanently destroy it including any persistent storage!\n")
227229

228230
// Prepare transaction.
229231
tx := roflmarket.NewInstanceCancelTx(nil, &roflmarket.InstanceCancel{
@@ -239,7 +241,7 @@ var (
239241
return
240242
}
241243

242-
fmt.Printf("Machine cancelled.\n")
244+
fmt.Printf("Machine removed.\n")
243245

244246
// Update manifest to clear the machine ID as it has been cancelled.
245247
machine.ID = ""
@@ -429,14 +431,14 @@ func init() {
429431
restartCmd.Flags().AddFlagSet(deploymentFlags)
430432
restartCmd.Flags().AddFlagSet(wipeFlags)
431433

432-
terminateCmd.Flags().AddFlagSet(common.SelectorFlags)
433-
terminateCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
434-
terminateCmd.Flags().AddFlagSet(deploymentFlags)
435-
terminateCmd.Flags().AddFlagSet(wipeFlags)
434+
stopCmd.Flags().AddFlagSet(common.SelectorFlags)
435+
stopCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
436+
stopCmd.Flags().AddFlagSet(deploymentFlags)
437+
stopCmd.Flags().AddFlagSet(wipeFlags)
436438

437-
cancelCmd.Flags().AddFlagSet(common.SelectorFlags)
438-
cancelCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
439-
cancelCmd.Flags().AddFlagSet(deploymentFlags)
439+
removeCmd.Flags().AddFlagSet(common.SelectorFlags)
440+
removeCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
441+
removeCmd.Flags().AddFlagSet(deploymentFlags)
440442

441443
topUpCmd.Flags().AddFlagSet(common.SelectorFlags)
442444
topUpCmd.Flags().AddFlagSet(common.RuntimeTxFlags)

0 commit comments

Comments
 (0)