Repository navigation
Render :tag in PuppetFile.toText for git modules - #5
Open
dennisboege-devoba wants to merge 2 commits into
Open
dennisboege-devoba wants to merge 2 commits into
dennisboege-devoba wants to merge 2 commits into
Conversation
Since :tag is parsed as an alias for :ref, toText() rendered every git module with :ref, so a Puppetfile that pinned a module by tag came back with :ref after a round-trip. Remember the tag on the module declaration and render :tag when it is set. ref stays populated so the checkout in fetchGitMetadata() is unchanged.
dploeger
reviewed
Nov 27, 2026
| this.ref = parameters[':ref'] | ||
| } else if (':tag' in parameters) { | ||
| this.ref = parameters[':tag'] | ||
| this.ref = this.tag = parameters[':tag'] |
Member
There was a problem hiding this comment.
Please only set this.tag here and not this.ref because it makes no sense to set it here IMHO
dploeger
requested changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Follow-up to #4. The parser accepts
:tagon git modules now, butPuppetFile.toText()only knows:ref. A Puppetfile that pins a module with:tag => 'v1.0.0'comes back as:ref => 'v1.0.0'after a round-trip. r10k treats both the same, but the generated file no longer matches the input.Change
lib/ModuleDeclaration.ts: newtagfield, set alongsiderefwhen the module uses:tag.refstays populated, so the checkout infetchGitMetadata()does not change.lib/PuppetFile.ts: the git module template renders:tagwhentagis set and falls back to:refotherwise.test/puppetfile.test.ts: new round-trip test with a:tagmodule. It fails on currentmain(:ref => 'test'instead of:tag => 'test') and passes with this change.If a module declares both
:refand:tag,:refstill wins, same as in the parser.Version as a proposal: v0.4.1