Jira (PUP-11204) puppet lookup --facts {filename} fails if filename does not contain a dot

1 view
Skip to first unread message

Reinhard Vicinus (Jira)

unread,
Aug 9, 2021, 10:42:02 AM8/9/21
to puppe...@googlegroups.com
Reinhard Vicinus created an issue
 
Puppet / Bug PUP-11204
puppet lookup --facts {filename} fails if filename does not contain a dot
Issue Type: Bug Bug
Affects Versions: PUP 6.23.0
Assignee: Unassigned
Created: 2021/08/09 7:41 AM
Priority: Normal Normal
Reporter: Reinhard Vicinus

Calling:

puppet lookup --facts dummy keyX
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:

puppet lookup --facts <(puppet facts find $nodename | jq .values) --node $nodename keyX

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Gheorghe Popescu (Jira)

unread,
Aug 16, 2021, 10:23:02 AM8/16/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Oct 6, 2021, 4:50:03 AM10/6/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Oct 6, 2021, 5:08:03 AM10/6/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Oct 20, 2021, 4:20:02 AM10/20/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Nov 1, 2021, 9:21:02 AM11/1/21
to puppe...@googlegroups.com
Luchian Nemes updated an issue
Change By: Luchian Nemes
Release Notes: Bug Fix
Release Notes Summary: 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.

Ciprian Badescu (Jira)

unread,
Nov 2, 2021, 6:01:04 AM11/2/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Fix Version/s: PUP 6.26.0
Fix Version/s: PUP 7.13.0

Parker Leach (Jira)

unread,
Dec 8, 2021, 11:15:02 AM12/8/21
to puppe...@googlegroups.com
Parker Leach updated an issue
Change By: Parker Leach
Labels: docs_reviewed
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages