Skip to content

Commit

Permalink
add logs to restore
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr committed Nov 30, 2018
1 parent 785b047 commit 94349a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func run(cmd *cobra.Command, args []string) error {
func Backup(namespace string) error {
log.Println("getting tiller storage")
storage := utils.GetTillerStorage(tillerNamespace)
log.Printf("found tiller storage: \"%s\"", storage)
log.Printf("found tiller storage: %s", storage)
log.Printf("getting releases in namespace \"%s\"", namespace)
inReleases, err := utils.ListReleaseNamesInNamespace(namespace)
if err != nil {
Expand Down Expand Up @@ -112,7 +112,7 @@ func Restore(namespace string) error {
return err
}
log.Println("reading backup data")
releasesToRestore, err := ioutil.ReadFile(releasesFileName)
releases, err := ioutil.ReadFile(releasesFileName)
if err != nil {
return err
}
Expand All @@ -121,8 +121,10 @@ func Restore(namespace string) error {
"--namespace", tillerNamespace,
"apply", "-f", manifestsFileName,
}
log.Println("applying backup data to tiller")
output := utils.Execute(restoreCmd)
releasesToRestore := (string)(releases)
log.Printf("releases found to restore: %s", prettyPrint(releasesToRestore))
log.Println("applying backup data to tiller (this command will fail if releases exist)")
output := utils.ExecuteCombined(restoreCmd)
log.Print((string)(output))

label += ",STATUS=DEPLOYED"
Expand All @@ -132,7 +134,7 @@ func Restore(namespace string) error {
}

os.RemoveAll(untarDir)
log.Printf("restore file %s to namespace \"%s\" complete (found releases: %s)\n", tarGzName, namespace, prettyPrint(releasesToRestore))
log.Printf("restore file %s to namespace \"%s\" complete", tarGzName, namespace)
return nil
}

Expand Down

0 comments on commit 94349a5

Please sign in to comment.