Skip to content

Commit

Permalink
Fixed bugs with update/create
Browse files Browse the repository at this point in the history
  • Loading branch information
Stan Bondi committed Oct 2, 2017
1 parent 078ca70 commit e0f5f8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,20 @@ func ensureSecretsForRepo(client drone.Client, manifestSecret *mfst.SecretDef, r
secret.Value = string(out)
}

_, err = client.Secret(owner, name, secret.Name)
if err != nil {
_, serr := client.Secret(owner, name, secret.Name)
if serr == nil {
_, uerr := client.SecretUpdate(owner, name, secret)
if uerr != nil {
fmt.Printf("%s %s\n", Green("✓"), Bold(secret.Name))
if uerr == nil {
fmt.Printf("%s Updated %s\n", Green("✓"), Bold(secret.Name))
} else {
fmt.Printf("%s %s.\n", Red("✕"), Bold(secret.Name))
return uerr
}
} else {
fmt.Printf("creating new secret %s\n", Bold(secret.Name))
_, uerr := client.SecretCreate(owner, name, secret)
if uerr != nil {
fmt.Printf("%s %s\n", Green("✓"), Bold(secret.Name))
if uerr == nil {
fmt.Printf("%s Created: %s\n", Green("✓"), Bold(secret.Name))
} else {
fmt.Printf("%s %s.\n", Red("✕"), Bold(secret.Name))
return uerr
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/urfave/cli"
)

const version string = "0.0.4"
const version string = "0.0.5"

func main() {
app := cli.NewApp()
Expand Down Expand Up @@ -52,6 +52,7 @@ func main() {
}

if err := app.Run(os.Args); err != nil {
log.Println("Fatal Error")
log.Fatal(err)
}
}

0 comments on commit e0f5f8d

Please sign in to comment.