Commit b4b68bce authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge branch 'fix-minion-config-with-non-tmp-dir' of...

Merge branch 'fix-minion-config-with-non-tmp-dir' of https://github.com/rach/packer into rach-fix-minion-config-with-non-tmp-dir

Conflicts:
	provisioner/salt-masterless/provisioner.go
parents b9d73aae 40af1e68
...@@ -118,26 +118,31 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { ...@@ -118,26 +118,31 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
} }
} }
if p.config.MinionConfig != "" { ui.Message(fmt.Sprintf("Creating remote directory: %s", p.config.TempConfigDir))
ui.Message(fmt.Sprintf("Uploading minion config: %s", p.config.MinionConfig)) cmd := &packer.RemoteCmd{Command: fmt.Sprintf("mkdir -p %s", p.config.TempConfigDir)}
err := uploadMinionConfig(comm, "/etc/salt/minion", p.config.MinionConfig) if err = cmd.StartWithUi(comm, ui); err != nil || cmd.ExitStatus != 0 {
if err != nil { if err == nil {
return err err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus)
} }
return fmt.Errorf("Error creating remote salt state directory: %s", err)
} }
if err = UploadLocalDirectory(p.config.LocalStateTree, p.config.TempConfigDir, comm, ui); err != nil { if p.config.MinionConfig != "" {
return fmt.Errorf("Error uploading local state tree to remote: %s", err) ui.Message(fmt.Sprintf("Uploading minion config: %s", p.config.MinionConfig))
if err = uploadMinionConfig(comm, fmt.Sprintf("%s/minion", p.config.TempConfigDir), p.config.MinionConfig); err != nil {
return fmt.Errorf("Error uploading local minion config file to remote: %s", err)
} }
ui.Message(fmt.Sprintf("Creating remote states directory: %s/states", p.config.TempConfigDir)) ui.Message(fmt.Sprintf("Moving %s/minion to /etc/salt/minion", p.config.TempConfigDir))
cmd := &packer.RemoteCmd{Command: fmt.Sprintf("mkdir -p %s/states", p.config.TempConfigDir)} cmd = &packer.RemoteCmd{Command: fmt.Sprintf("sudo mv %s/minion /etc/salt/minion", p.config.TempConfigDir)}
if err = cmd.StartWithUi(comm, ui); err != nil || cmd.ExitStatus != 0 { if err = cmd.StartWithUi(comm, ui); err != nil || cmd.ExitStatus != 0 {
if err == nil { if err == nil {
err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus) err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus)
} }
return fmt.Errorf("Error creating remote salt state directory: %s", err) return fmt.Errorf("Unable to move %s/minion to /etc/salt/minion: %d", p.config.TempConfigDir, err)
}
} }
ui.Message(fmt.Sprintf("Uploading local state tree: %s", p.config.LocalStateTree)) ui.Message(fmt.Sprintf("Uploading local state tree: %s", p.config.LocalStateTree))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment