Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use provided r10k command_path #153

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ Type: bool
Description: Run `puppet generate types` after updating an environment
Default: `true`

### `command_path`

Type: `string`
Description: Allow overriding the default path to r10k.
Default: `/opt/puppetlabs/puppetserver/bin/r10k`

## Usage

Webhook API provides following paths
Expand Down
2 changes: 1 addition & 1 deletion api/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (e EnvironmentController) DeployEnvironment(c *gin.Context) {
var branch string

// Set the base r10k command into a slice of strings
cmd := []string{"r10k", "deploy", "environment"}
cmd := []string{h.GetR10kCommand(), "deploy", "environment"}

// Get the configuration
conf := config.GetConfig()
Expand Down
2 changes: 1 addition & 1 deletion api/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (m ModuleController) DeployModule(c *gin.Context) {
var h helpers.Helper

// Set the base r10k command into a string slice
cmd := []string{"r10k", "deploy", "module"}
cmd := []string{h.GetR10kCommand(), "deploy", "module"}

// Get the configuration
conf := config.GetConfig()
Expand Down
14 changes: 14 additions & 0 deletions lib/helpers/r10k-command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package helpers

import "github.com/voxpupuli/webhook-go/config"

const Command = "r10k"

func (h *Helper) GetR10kCommand() string {
conf := config.GetConfig().R10k
commandPath := conf.CommandPath
if commandPath == "" {
return Command
}
return commandPath
}