Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion command/state_mv.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,11 @@ func (c *StateMvCommand) Run(args []string) int {

if moved == 0 {
c.Ui.Output("No matching objects found.")
return 1
} else {
c.Ui.Output(fmt.Sprintf("Successfully moved %d object(s).", moved))
return 0
}
return 0
}

// sourceObjectAddrs takes a single source object address and expands it to
Expand Down
3 changes: 2 additions & 1 deletion command/state_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ func (c *StateRmCommand) Run(args []string) int {

if isCount == 0 {
c.Ui.Output("No matching resource instances found.")
return 1
} else {
c.Ui.Output(fmt.Sprintf("Successfully removed %d resource instance(s).", isCount))
return 0
}
return 0
}

func (c *StateRmCommand) Help() string {
Expand Down
4 changes: 2 additions & 2 deletions command/state_rm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ func TestStateRmNonExist(t *testing.T) {
"-state", statePath,
"test_instance.baz", // doesn't exist in the state constructed above
}
if code := c.Run(args); code != 0 {
t.Fatalf("expected exit status %d, got: %d", 0, code)
if code := c.Run(args); code != 1 {
t.Fatalf("expected exit status %d, got: %d", 1, code)
}

if msg := ui.OutputWriter.String(); !strings.Contains(msg, "No matching resource instances found") {
Expand Down