Skip to content

Commit

Permalink
Add a option to force override module name
Browse files Browse the repository at this point in the history
The module name is implied from the git repository name. However, both
r10k and puppet are very particular about module naming, and the
implicit rewrites rules can get in the way. Puppet will understand any
amount of dashes in the project name as `<vendor>-<module>`, rewriting
`-` to `/`. For git repositories, there are often arbitrary naming rules
with copious amounts of these control characters in repository names,
making it nearly impossible to serve both worlds at the same time.

This URL parameter (module_name) allows to override the module name
directly in the URL, completely ignoring the git repository name.
  • Loading branch information
raincz committed Feb 11, 2024
1 parent 8e91113 commit 11d8935
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ func (m ModuleController) DeployModule(c *gin.Context) {
cmd = append(cmd, branch)
}

module := data.ModuleName
overrideModule := c.Query("module_name")
if overrideModule != "" {
module = overrideModule
}

// Append module name and r10k configuration to the cmd string slice
cmd = append(cmd, data.ModuleName)
cmd = append(cmd, module)
cmd = append(cmd, fmt.Sprintf("--config=%s", h.GetR10kConfig()))

// Set additional optional r10k flags if they are set
Expand Down

0 comments on commit 11d8935

Please sign in to comment.