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

Fixing broken for puppet-lint >= 2.4.0 #28

Closed
wants to merge 1 commit into from

Conversation

baurmatt
Copy link
Contributor

@baurmatt baurmatt commented Jan 6, 2020

This is an empty PR to let Travis run and show the problem.

As a small example:

$ bundle exec rspec ./spec/puppet-lint/plugins/legacy_facts_spec.rb:267
Run options: include {:locations=>{"./spec/puppet-lint/plugins/legacy_facts_spec.rb"=>[267]}}

legacy_facts
  with fix enabled
    fact variable using legacy $::sshrsakey
      should use the facts hash (FAILED - 1)

Failures:

  1) legacy_facts with fix enabled fact variable using legacy $::sshrsakey should use the facts hash
     Failure/Error: expect(manifest).to eq("$facts['ssh']['rsa']['key']")

       expected: "$facts['ssh']['rsa']['key']"
            got: "$::sshrsakey"

       (compared using ==)
     # ./spec/puppet-lint/plugins/legacy_facts_spec.rb:268:in `block (4 levels) in <top (required)>'

Finished in 0.00994 seconds (files took 0.19942 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/puppet-lint/plugins/legacy_facts_spec.rb:267 # legacy_facts with fix enabled fact variable using legacy $::sshrsakey should use the facts hash

Coverage report generated for RSpec to /Users/mbaur/Sources/puppet-lint-legacy_facts-check/coverage. 0.0 / 0.0 LOC (100.0%) covered.

A lot of the "fixes" don't work anymore. My tests show that this starts to happen with puppet-lint 2.4.0.

Problem seems to be here:

raise PuppetLint::NoFix if problem[:token].raw and problem[:token].value != problem[:token].raw

It gets triggered because problem[:token].value != problem[:token].raw and therefore no fixing is attempted for this line.

To be honest, I don't really get why this line was introduced in the first place. Perhaps @seanmil has some deeper insight why this started to break in 2.4.0? He introduce this change in #13.

@baurmatt
Copy link
Contributor Author

baurmatt commented Jan 6, 2020

Failing test

@mmckinst
Copy link
Owner

Thanks for bringing this to my attention. I've found forcing it to use puppet-lint 2.3.6 at #29 seems to fix it for everything except ruby 1.9.3 as you can see at https://travis-ci.org/mmckinst/puppet-lint-legacy_facts-check/builds/635072450 .

I'll take a deeper look at this later and see what has changed between puppet-lint 2.3.6 and puppet-lint 2.4.0.

@mmckinst
Copy link
Owner

ref rodjek/puppet-lint#902

@baurmatt
Copy link
Contributor Author

Ha awesome, looks like Alex stumbled over this as well :) Looking forward to a fix! If I can help somehow, please let me know! :)

mmckinst added a commit that referenced this pull request Jan 27, 2020
@mmckinst
Copy link
Owner

1.0.3 has been released which works around this problem. TBD what the long term fix is so this can go back on puppet-lint 2.4.0.

@baurmatt
Copy link
Contributor Author

Thank you! :)

@mmckinst
Copy link
Owner

mmckinst commented Mar 9, 2020

This was fixed in #32 .

Thanks for submitting the bug report.

@mmckinst mmckinst closed this Mar 9, 2020
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.

2 participants