Merge pull request #4534 from mitchellh/chefclean
provisioner/chef-client: only upload knife config if we're cleaning
This commit is contained in:
commit
6894f93085
|
@ -280,20 +280,25 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||
|
||||
err = p.executeChef(ui, comm, configPath, jsonPath)
|
||||
|
||||
knifeConfigPath, err2 := p.createKnifeConfig(
|
||||
ui, comm, nodeName, serverUrl, p.config.ClientKey, p.config.SslVerifyMode)
|
||||
if err2 != nil {
|
||||
return fmt.Errorf("Error creating knife config on node: %s", err2)
|
||||
}
|
||||
if !p.config.SkipCleanNode {
|
||||
if err2 := p.cleanNode(ui, comm, nodeName, knifeConfigPath); err2 != nil {
|
||||
return fmt.Errorf("Error cleaning up chef node: %s", err2)
|
||||
}
|
||||
}
|
||||
if !(p.config.SkipCleanNode && p.config.SkipCleanClient) {
|
||||
|
||||
if !p.config.SkipCleanClient {
|
||||
if err2 := p.cleanClient(ui, comm, nodeName, knifeConfigPath); err2 != nil {
|
||||
return fmt.Errorf("Error cleaning up chef client: %s", err2)
|
||||
knifeConfigPath, knifeErr := p.createKnifeConfig(
|
||||
ui, comm, nodeName, serverUrl, p.config.ClientKey, p.config.SslVerifyMode)
|
||||
|
||||
if knifeErr != nil {
|
||||
return fmt.Errorf("Error creating knife config on node: %s", knifeErr)
|
||||
}
|
||||
|
||||
if !p.config.SkipCleanNode {
|
||||
if err := p.cleanNode(ui, comm, nodeName, knifeConfigPath); err != nil {
|
||||
return fmt.Errorf("Error cleaning up chef node: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !p.config.SkipCleanClient {
|
||||
if err := p.cleanClient(ui, comm, nodeName, knifeConfigPath); err != nil {
|
||||
return fmt.Errorf("Error cleaning up chef client: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue