fix: выход если ошибка в Ansible
This commit is contained in:
@@ -21,7 +21,7 @@ var (
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "playbookctl",
|
||||
Short: "Ansible Playbook Dedic2 Control",
|
||||
Version: "4.0.2",
|
||||
Version: "4.0.3",
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return cmd.Help()
|
||||
},
|
||||
|
||||
@@ -38,7 +38,10 @@ func (app *SpaceWorker) Restore(targetHost string, timestamp string, inventory s
|
||||
app.log.Info(fmt.Sprintf("Target Host: %s", host))
|
||||
|
||||
app.log.Info("Pre restore Ansible")
|
||||
_ = command.Run()
|
||||
err = command.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app.log.Info("Send files")
|
||||
command = exec.Command("/bin/bash", "-c", preRestoreFile)
|
||||
@@ -59,7 +62,10 @@ func (app *SpaceWorker) Restore(targetHost string, timestamp string, inventory s
|
||||
command.Stdin = os.Stdin
|
||||
command.Stdout = os.Stdout
|
||||
command.Stderr = os.Stderr
|
||||
_ = command.Run()
|
||||
err = command.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app.log.Info("Clean temp files")
|
||||
command = exec.Command("/bin/bash", "-c", preRestoreFile+"_clean")
|
||||
@@ -67,7 +73,10 @@ func (app *SpaceWorker) Restore(targetHost string, timestamp string, inventory s
|
||||
command.Stdin = os.Stdin
|
||||
command.Stdout = os.Stdout
|
||||
command.Stderr = os.Stderr
|
||||
_ = command.Run()
|
||||
err = command.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = utils.RemoveFile(preRestoreFile); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user