Skip to content

Commit

Permalink
Make sure the tool throws an error if anything fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nabsul committed Jun 10, 2020
1 parent ee4c209 commit 0b24754
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"fmt"
"os"
"time"
Expand Down Expand Up @@ -40,15 +41,21 @@ func main() {
namespaces, err := getNamespaces(namespaceList)
checkErr(err)

failed := false
for _, ns := range namespaces {
fmt.Printf("Updating secret [%s] in namespace [%s]... ", name, ns)
err = updatePassword(name, username, password, server, ns)
if nil != err {
fmt.Printf("failed: %s\n", err)
failed = true
} else {
fmt.Println("success")
}
}

if failed {
panic(errors.New("failed to create one of more Docker login secrets"))
}

fmt.Println("Job complete.")
}

0 comments on commit 0b24754

Please sign in to comment.