Error: Could not parse application options: undefined method `[]' for nil:NilClass
Fails because the code that verifies the filename expects, that the filename contains a dot:
option('--facts FACT_FILE') do |arg|
if %w{.yaml .yml .json}.include?(arg.match(/\.[^.]*$/)[0])
options[:fact_file] = arg
else
raise _("The --fact file only accepts yaml and json files.\n%{run_help}") % { run_help: RUN_HELP }
end
end
Also, verifying based on the filename that the file contains json/yaml data is not correct in my opinion. In my opinion, the following should also be supported:
Before this release, `puppet lookup --facts {filename}` failed early when the filename given did not contain a dot. This fix removes the early extensions check and adds a fallback instead — tries both formats (JSON then YAML) to read the given facts file when its path doesn't end with any of the expected extensions (yaml/yml/json). Otherwise, it follows previous implementation and respects given extension.