standardize across both puppet-{masterless,server}
This commit is contained in:
parent
5eb497a2c5
commit
913ad33a11
|
@ -71,8 +71,9 @@ type Config struct {
|
|||
}
|
||||
|
||||
type guestOSTypeConfig struct {
|
||||
tempDir string
|
||||
stagingDir string
|
||||
executeCommand string
|
||||
executeCommand string
|
||||
facterVarsFmt string
|
||||
facterVarsJoiner string
|
||||
modulePathJoiner string
|
||||
|
@ -80,6 +81,8 @@ type guestOSTypeConfig struct {
|
|||
|
||||
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
||||
provisioner.UnixOSType: {
|
||||
#FIXME assumes both Packer host and target are same OS
|
||||
tempDir: "/tmp",
|
||||
stagingDir: "/tmp/packer-puppet-masterless",
|
||||
executeCommand: "cd {{.WorkingDir}} && " +
|
||||
`{{if ne .FacterVars ""}}{{.FacterVars}} {{end}}` +
|
||||
|
@ -97,9 +100,11 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||
modulePathJoiner: ":",
|
||||
},
|
||||
provisioner.WindowsOSType: {
|
||||
stagingDir: "C:/Windows/Temp/packer-puppet-masterless",
|
||||
#FIXME assumes both Packer host and target are same OS
|
||||
tempDir: path.filepath.ToSlash(os.Getenv("TEMP")),
|
||||
stagingDir: path.filepath.ToSlash(os.Getenv("SYSTEMROOT")) + "/Temp/packer-puppet-masterless",
|
||||
executeCommand: "cd {{.WorkingDir}} && " +
|
||||
"{{.FacterVars}} && " +
|
||||
`{{if ne .FacterVars ""}}{{.FacterVars}} && {{end}}` +
|
||||
`{{if ne .PuppetBinDir ""}}{{.PuppetBinDir}}/{{end}}` +
|
||||
"puppet apply --detailed-exitcodes " +
|
||||
"{{if .Debug}}--debug {{end}}" +
|
||||
|
@ -121,24 +126,23 @@ type Provisioner struct {
|
|||
}
|
||||
|
||||
type ExecuteTemplate struct {
|
||||
WorkingDir string
|
||||
FacterVars string
|
||||
FacterVars string
|
||||
HieraConfigPath string
|
||||
ModulePath string
|
||||
ManifestFile string
|
||||
ManifestDir string
|
||||
PuppetBinDir string
|
||||
Sudo bool
|
||||
WorkingDir string
|
||||
Debug bool
|
||||
ExtraArguments string
|
||||
ModulePath string
|
||||
ManifestFile string
|
||||
ManifestDir string
|
||||
PuppetBinDir string
|
||||
Sudo bool
|
||||
WorkingDir string
|
||||
Debug bool
|
||||
ExtraArguments string
|
||||
}
|
||||
|
||||
func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||
Interpolate: true,
|
||||
InterpolateContext: &p.config.ctx,
|
||||
InterpolateFilter: &interpolate.RenderFilter{
|
||||
InterpolateFilter: &interpolate.RenderFilter{
|
||||
Exclude: []string{
|
||||
"execute_command",
|
||||
"extra_arguments",
|
||||
|
|
|
@ -87,6 +87,10 @@ type Config struct {
|
|||
// permissions in this directory.
|
||||
StagingDir string `mapstructure:"staging_dir"`
|
||||
|
||||
// The directory from which the command will be executed.
|
||||
// Packer requires the directory to exist when running puppet.
|
||||
WorkingDir string `mapstructure:"working_directory"`
|
||||
|
||||
// The directory that contains the puppet binary.
|
||||
// E.g. if it can't be found on the standard path.
|
||||
PuppetBinDir string `mapstructure:"puppet_bin_dir"`
|
||||
|
@ -105,10 +109,11 @@ type guestOSTypeConfig struct {
|
|||
|
||||
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
||||
provisioner.UnixOSType: {
|
||||
#FIXME assumes both Packer host and target are same OS
|
||||
tempDir: "/tmp",
|
||||
stagingDir: "/tmp/packer-puppet-server",
|
||||
executeCommand: "cd {{.WorkingDir}} && " +
|
||||
"{{.FacterVars}}" +
|
||||
`{{if ne .FacterVars ""}}{{.FacterVars}} {{end}}` +
|
||||
"{{if .Sudo}}sudo -E {{end}}" +
|
||||
`{{if ne .PuppetBinDir ""}}{{.PuppetBinDir}}/{{end}}` +
|
||||
"puppet agent --onetime --no-daemonize --detailed-exitcodes " +
|
||||
|
@ -122,10 +127,11 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||
facterVarsJoiner: " ",
|
||||
},
|
||||
provisioner.WindowsOSType: {
|
||||
#FIXME assumes both Packer host and target are same OS
|
||||
tempDir: path.filepath.ToSlash(os.Getenv("TEMP")),
|
||||
stagingDir: path.filepath.ToSlash(os.Getenv("SYSTEMROOT")) + "/Temp/packer-puppet-server",
|
||||
executeCommand: "cd {{.WorkingDir}} && " +
|
||||
"{{.FacterVars}} " +
|
||||
`{{if ne .FacterVars ""}}{{.FacterVars}} && {{end}}` +
|
||||
`{{if ne .PuppetBinDir ""}}{{.PuppetBinDir}}/{{end}}` +
|
||||
"puppet agent --onetime --no-daemonize --detailed-exitcodes " +
|
||||
"{{if .Debug}}--debug {{end}}" +
|
||||
|
@ -149,18 +155,20 @@ type ExecuteTemplate struct {
|
|||
FacterVars string
|
||||
ClientCertPath string
|
||||
ClientPrivateKeyPath string
|
||||
PuppetNode string
|
||||
PuppetNode string
|
||||
PuppetServer string
|
||||
ExtraArguments string
|
||||
PuppetBinDir string
|
||||
Sudo bool
|
||||
WorkingDir string
|
||||
Debug bool
|
||||
ExtraArguments string
|
||||
}
|
||||
|
||||
func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||
Interpolate: true,
|
||||
InterpolateContext: &p.config.ctx,
|
||||
InterpolateFilter: &interpolate.RenderFilter{
|
||||
InterpolateFilter: &interpolate.RenderFilter{
|
||||
Exclude: []string{
|
||||
"execute_command",
|
||||
"extra_arguments",
|
||||
|
|
Loading…
Reference in New Issue