diff --git a/provisioner/puppet-masterless/provisioner.go b/provisioner/puppet-masterless/provisioner.go index 4c19526d2..1fb2d4bc6 100644 --- a/provisioner/puppet-masterless/provisioner.go +++ b/provisioner/puppet-masterless/provisioner.go @@ -31,7 +31,8 @@ type Config struct { // The main manifest file to apply to kick off the entire thing. ManifestFile string `mapstructure:"manifest_file"` - // The manifest dir, e.g. for includes + // A directory of manifest files that will be uploaded to the remote + // machine. ManifestDir string `mapstructure:"manifest_dir"` // If true, `sudo` will NOT be used to execute Puppet. @@ -214,8 +215,10 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { // Upload manifest dir if set remoteManifestDir := "" if p.config.ManifestDir != "" { - var err error - remoteManifestDir, err = p.uploadManifestDir(ui, comm) + ui.Message(fmt.Sprintf( + "Uploading manifest directory from: %s", p.config.ManifestDir)) + remoteManifestDir = fmt.Sprintf("%s/manifests", p.config.StagingDir) + err := p.uploadDirectory(ui, comm, remoteManifestDir, p.config.ManifestDir) if err != nil { return fmt.Errorf("Error uploading manifest dir: %s", err) } @@ -298,22 +301,6 @@ func (p *Provisioner) uploadHieraConfig(ui packer.Ui, comm packer.Communicator) return path, nil } -func (p *Provisioner) uploadManifestDir(ui packer.Ui, comm packer.Communicator) (string, error) { - ui.Message("Uploading manifest dir...") - path, err := os.Open(p.config.ManifestDir) - if err != nil { - return "", err - } - defer path.Close() - - targetPath := fmt.Sprintf("%s/manifests", p.config.StagingDir) - if err := p.uploadDirectory(ui, comm, targetPath, p.config.ManifestDir); err != nil { - return "", fmt.Errorf("Error uploading manifest dir: %s", err) - } - - return targetPath, nil -} - func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (string, error) { // Create the remote manifests directory... ui.Message("Uploading manifests...") diff --git a/website/source/docs/provisioners/puppet-masterless.html.markdown b/website/source/docs/provisioners/puppet-masterless.html.markdown index 85a1d5f89..b35bea711 100644 --- a/website/source/docs/provisioners/puppet-masterless.html.markdown +++ b/website/source/docs/provisioners/puppet-masterless.html.markdown @@ -58,13 +58,14 @@ Optional parameters: configuration to be uploaded to the remote machine. Hiera data directories must be uploaded using the file provisioner separately. +* `manifest_dir` (string) - The path to a local directory with manifests + to be uploaded to the remote machine. This is useful if your main + manifest file uses imports. + * `module_paths` (array of strings) - This is an array of paths to module directories on your local filesystem. These will be uploaded to the remote machine. By default, this is empty. -* `manifest_dir` (string) - The path to a local directory with - manifests to be uploaded to the remote machine. - * `prevent_sudo` (boolean) - By default, the configured commands that are executed to run Puppet are executed with `sudo`. If this is true, then the sudo will be omitted.