Skip to content

Commit 3373b46

Browse files
committed
Do not crash on a typoed legacy fact hash syntax (i.e., missing closing quote)
1 parent 0ff9257 commit 3373b46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ def check
117117

118118
# This matches legacy facts defined in the fact hash that use the top scope
119119
# fact assignment.
120-
if token.value.start_with?("::facts['")
120+
if token.value.match(%r{::facts\['(.*)'\]})
121121
fact_name = token.value.match(%r{::facts\['(.*)'\]})[1]
122122

123123
# This matches legacy facts defined in the fact hash.
124-
elsif token.value.start_with?("facts['")
124+
elsif token.value.match(%r{facts\['(.*)'\]})
125125
fact_name = token.value.match(%r{facts\['(.*)'\]})[1]
126126

127127
# This matches using legacy facts in a the new structured fact. For

0 commit comments

Comments
 (0)