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

(FACT-3165) Report correct location of where a fact was resolved from #2606

Merged
merged 3 commits into from
Sep 16, 2023

Conversation

tvpartytonight
Copy link
Contributor

No description provided.

Also fix the grammar as suggested by

Co-authored-by: Josh Cooper <[email protected]>
The resolution class implements a :last_evaluated instance variable
that the aggregate class should also implement.
@tvpartytonight tvpartytonight changed the title Fact 3165 patch aggregate (FACT-3165) Report correct location of where a fact was resolved from Sep 13, 2023
Copy link
Contributor

@joshcooper joshcooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the repro from the ticket, the one fact is registered first and the fact value resolves to one, but facter reports the location as coming from two:

[2023-09-15 18:08:57.510196 ] INFO Facter - executed with command line: foo --debug --custom-dir custom_facts 
registering one.rb
registering two.rb
[2023-09-15 18:08:57.519856 ] DEBUG Facter::QueryParser - List of resolvable facts: [#<Facter::SearchedFact:0x000055e484b74490 @name="foo", @fact_class=nil, @user_query="foo", @type=:custom, @file=nil>] 
[2023-09-15 18:08:57.519972 ] DEBUG Facter::Util::Fact - custom fact foo got resolved from: ["custom_facts/two.rb", 1] 
[2023-09-15 18:08:57.521208 ] DEBUG Facter::FactManager - fact "foo" has resolved to: one 

The new behavior is facter reports the fact as having been resolved from one with proper file name and line number:

[2023-09-15 18:08:50.847471 ] INFO Facter - executed with command line: foo --debug --custom-dir custom_facts 
registering one.rb
registering two.rb
[2023-09-15 18:08:50.854295 ] DEBUG Facter::QueryParser - List of resolvable facts: [#<Facter::SearchedFact:0x000055f7493b20e0 @name="foo", @fact_class=nil, @user_query="foo", @type=:custom, @file=nil>] 
[2023-09-15 18:08:50.854388 ] DEBUG Facter::Util::Fact - custom fact foo was resolved from: custom_facts/one.rb:1 
[2023-09-15 18:08:50.855584 ] DEBUG Facter::FactManager - fact "foo" has resolved to: one 

@joshcooper joshcooper merged commit 26961af into puppetlabs:main Sep 16, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants