Skip to content

Commit

Permalink
Don't throw CLI warning until after past errors
Browse files Browse the repository at this point in the history
  • Loading branch information
digivava committed Mar 23, 2022
1 parent 9efc7f0 commit e5f4408
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions command/policy_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ func (c *PolicyWriteCommand) Run(args []string) int {
formattedName := strings.TrimSpace(strings.ToLower(name))
path := strings.TrimSpace(args[1])

if name != formattedName {
c.UI.Warn(fmt.Sprintf("Policy name was converted to %s", formattedName))
}

// Get the policy contents, either from stdin of a file
var reader io.Reader
if path == "-" {
Expand Down Expand Up @@ -129,6 +125,10 @@ func (c *PolicyWriteCommand) Run(args []string) int {
return 2
}

if name != formattedName {
c.UI.Warn(fmt.Sprintf("Policy name was converted to %s", formattedName))
}

c.UI.Output(fmt.Sprintf("Success! Uploaded policy: %s", formattedName))
return 0
}

0 comments on commit e5f4408

Please sign in to comment.