forked from rodjek/puppet-lint
-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
When a YAML file has a legacy fact, passing --fix to puppet-lint produces an unexpected error.
Whoops! It looks like puppet-lint has encountered an error that it doesn't
know how to handle. Please open an issue at https://github.com/puppetlabs/puppet-lint
and paste the following output into the issue description.
puppet-lint version: 5.1.1
ruby version: 3.3.5-p100
platform: x86_64-linux
file path: test/hiera.yaml
file contents:
---
version: 5
sample_key: host.%{::domain}
error:
NoMethodError: undefined method `value' for nil
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:210:in `fix'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checkplugin.rb:42:in `block in fix_problems'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checkplugin.rb:38:in `each'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checkplugin.rb:38:in `fix_problems'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checks.rb:80:in `block in run'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checks.rb:78:in `each'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/checks.rb:78:in `run'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint.rb:225:in `run'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/bin.rb:88:in `block in run'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/bin.rb:83:in `each'
/usr/local/share/gems/gems/puppet-lint-5.1.1/lib/puppet-lint/bin.rb:83:in `run'
/usr/local/share/gems/gems/puppet-lint-5.1.1/bin/puppet-lint:7:in `<top (required)>'
/usr/local/bin/puppet-lint:25:in `load'
/usr/local/bin/puppet-lint:25:in `<main>'
Expected Behavior
Do not throw an error.
Steps to Reproduce
- Have a module with a hiera.yaml file that contains a legacy fact.
- Run puppet-lint --fix
Test files I was using:
test/hiera.yaml
test/files/sample.yaml
test/manifests/init.pp
hiera.yaml:
---
version: 5
sample_key: host.%{::domain}
init.pp:
# Class: test
#
class test {
$foo = 'bar'
$baz = 'test'
}
sample.yaml:
# This is a sample YAML file demonstrating common features
# Key-value pairs (mappings)
name: John Doe
age: 30
isStudent: false
# Lists (sequences)
hobbies:
- Reading
- Hiking
- Coding
# Nested structures
address:
street: 123 Main St
city: Anytown
zipCode: "12345" # String value
Environment
Version 5.1.1
Platform Rocky 9.5
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working