Skip to content

Commit 0396177

Browse files
genebeandhollinger
authored andcommitted
Allow legacy --puppetfile flag to be used
This allows for utilizing the current version of webhook-go in environments saddled with legacy versions of r10k that don't yet have the new --modules flag.
1 parent 89c6987 commit 0396177

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ Type: bool
209209
Description: Deploy modules in environments.
210210
Default: `true`
211211

212+
### `use_legacy_puppetfile_flag`
213+
214+
Type: bool
215+
Description: Use the legacy `--puppetfile` flag instead of `--modules`. This should only be used when your version of r10k doesn't support the newer flag.
216+
Default: `false`
217+
212218
### `generate_types`
213219

214220
Type: bool

api/environment.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func (e EnvironmentController) DeployEnvironment(c *gin.Context) {
6363
cmd = append(cmd, "--generate-types")
6464
}
6565
if conf.R10k.DeployModules {
66-
cmd = append(cmd, "--modules")
66+
if conf.R10k.UseLegacyPuppetfileFlag {
67+
cmd = append(cmd, "--puppetfile")
68+
} else {
69+
cmd = append(cmd, "--modules")
70+
}
6771
}
6872

6973
// Pass the command to the execute function and act on the result and any error

config/config.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ type Config struct {
3535
ServerUri string `mapstructure:"server_uri"`
3636
} `mapstructure:"chatops"`
3737
R10k struct {
38-
CommandPath string `mapstructure:"command_path"`
39-
ConfigPath string `mapstructure:"config_path"`
40-
DefaultBranch string `mapstructure:"default_branch"`
41-
Prefix string `mapstructure:"prefix"`
42-
AllowUppercase bool `mapstructure:"allow_uppercase"`
43-
Verbose bool `mapstructure:"verbose"`
44-
DeployModules bool `mapstructure:"deploy_modules"`
45-
GenerateTypes bool `mapstructure:"generate_types"`
38+
CommandPath string `mapstructure:"command_path"`
39+
ConfigPath string `mapstructure:"config_path"`
40+
DefaultBranch string `mapstructure:"default_branch"`
41+
Prefix string `mapstructure:"prefix"`
42+
AllowUppercase bool `mapstructure:"allow_uppercase"`
43+
Verbose bool `mapstructure:"verbose"`
44+
DeployModules bool `mapstructure:"deploy_modules"`
45+
UseLegacyPuppetfileFlag bool `mapstructure:"use_legacy_puppetfile_flag"`
46+
GenerateTypes bool `mapstructure:"generate_types"`
4647
} `mapstructure:"r10k"`
4748
}
4849

@@ -88,6 +89,7 @@ func setDefaults(v *viper.Viper) *viper.Viper {
8889
v.SetDefault("r10k.verbose", true)
8990
v.SetDefault("r10k.deploy_modules", true)
9091
v.SetDefault("r10k.generate_types", true)
92+
v.SetDefault("r10k.use_legacy_puppetfile_flag", false)
9193

9294
return v
9395
}

0 commit comments

Comments
 (0)