Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
ac75d532
Commit
ac75d532
authored
Jul 17, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2463 from mitchellh/b-2373
Make manifest_file work as either file.pp or a directory
parents
dec1b65a
37c20e2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
19 deletions
+41
-19
provisioner/puppet-masterless/provisioner.go
provisioner/puppet-masterless/provisioner.go
+31
-16
website/source/docs/provisioners/puppet-masterless.html.markdown
.../source/docs/provisioners/puppet-masterless.html.markdown
+10
-3
No files found.
provisioner/puppet-masterless/provisioner.go
View file @
ac75d532
...
...
@@ -270,28 +270,43 @@ func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (s
return
""
,
fmt
.
Errorf
(
"Error creating manifests directory: %s"
,
err
)
}
// Upload the main manifest
f
,
err
:=
os
.
Open
(
p
.
config
.
ManifestFile
)
// NOTE! manifest_file may either be a directory or a file, as puppet apply
// now accepts either one.
fi
,
err
:=
os
.
Stat
(
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
err
return
""
,
fmt
.
Errorf
(
"Error inspecting manifest file: %s"
,
err
)
}
defer
f
.
Close
()
manifestFilename
:=
p
.
config
.
ManifestFile
if
fi
,
err
:=
os
.
Stat
(
p
.
config
.
ManifestFile
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error inspecting manifest file: %s"
,
err
)
}
else
if
!
fi
.
IsDir
()
{
manifestFilename
=
filepath
.
Base
(
manifestFilename
)
if
fi
.
IsDir
()
{
// If manifest_file is a directory we'll upload the whole thing
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading manifest directory from: %s"
,
p
.
config
.
ManifestFile
))
remoteManifestDir
:=
fmt
.
Sprintf
(
"%s/manifests"
,
p
.
config
.
StagingDir
)
err
:=
p
.
uploadDirectory
(
ui
,
comm
,
remoteManifestDir
,
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error uploading manifest dir: %s"
,
err
)
}
return
remoteManifestDir
,
nil
}
else
{
ui
.
Say
(
"WARNING: manifest_file should be a file. Use manifest_dir for directories"
)
}
// Otherwise manifest_file is a file and we'll upload it
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading manifest file from: %s"
,
p
.
config
.
ManifestFile
))
remoteManifestFile
:=
fmt
.
Sprintf
(
"%s/%s"
,
remoteManifestsPath
,
manifestFilename
)
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
f
,
err
:=
os
.
Open
(
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
err
}
defer
f
.
Close
()
return
remoteManifestFile
,
nil
manifestFilename
:=
filepath
.
Base
(
p
.
config
.
ManifestFile
)
remoteManifestFile
:=
fmt
.
Sprintf
(
"%s/%s"
,
remoteManifestsPath
,
manifestFilename
)
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
return
remoteManifestFile
,
nil
}
}
func
(
p
*
Provisioner
)
createDir
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
dir
string
)
error
{
...
...
website/source/docs/provisioners/puppet-masterless.html.markdown
View file @
ac75d532
...
...
@@ -40,9 +40,12 @@ The reference of available configuration options is listed below.
Required parameters:
*
`manifest_file`
(string) - The manifest file for Puppet to use in order
to compile and run a catalog. This file must exist on your local system
and will be uploaded to the remote machine.
*
`manifest_file`
(string) - This is either a path to a puppet manifest (
`.pp`
file) _or_ a directory containing multiple manifests that puppet will apply
(the
[
"main manifest"
][
1
]
). These file(s) must exist on your local system and
will be uploaded to the remote machine.
[
1
]:
https://docs.puppetlabs.com/puppet/latest/reference/dirs_manifest.html
Optional parameters:
...
...
@@ -64,6 +67,10 @@ Optional parameters:
the
`manifest_file`
. It is a separate directory that will be set as
the "manifestdir" setting on Puppet.
~>
`manifest_dir`
is passed to
`puppet apply`
as the
`--manifestdir`
option.
This option was deprecated in puppet 3.6, and removed in puppet 4.0. If you
have multiple manifests you should use
`manifest_file`
instead.
*
`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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment