Jira (PUP-6400) lookup cli has no way to set arbitrary scope values

12 views
Skip to first unread message

R.I.Pienaar (JIRA)

unread,
Jun 10, 2016, 6:57:03 AM6/10/16
to puppe...@googlegroups.com
R.I.Pienaar created an issue
 
Puppet / Bug PUP-6400
lookup cli has no way to set arbitrary scope values
Issue Type: Bug Bug
Affects Versions: PUP 4.5.1
Assignee: Unassigned
Components: CLI
Created: 2016/06/10 3:56 AM
Priority: Normal Normal
Reporter: R.I.Pienaar

When constructing hierarchies it's best to use $trusted wherever possible and there are legit use cases for using random in scope vars.

The old CLI let you specify arbitrary scope which would be used to satisfy testing these on the CLI, with new lookup this is pretty hard/impossible.

It lets you supply facts from a file which then is only accessible as facts.foo for example, no way to do trusted or random vars.

I might have missed a obvious way to achieve this so this ticket could be a non issue but could not find it.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Jun 10, 2016, 9:28:02 PM6/10/16
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug PUP-6400
 
Re: lookup cli has no way to set arbitrary scope values

You should be able to feed in $trusted stuff by having the fact 'trusted' set to the correct (expected) values. (I am unsure if we tested that though, it may work because we do get $trusted as a node parameter in some cases, and IIRC, that is how we deal with the facts given on the CLI). Love to hear if that works or not.

For arbitrary variables; since that is supported at runtime, the CLI should support those too. (Not having support for that is an oversight). The easiest is to add yet another flag that accepts a reference to a file with variables, or we need to redesign the options to accept a combination of facts and variables in one and the same file. Not sure what is best (also considering backwards compatibility).

Henrik Lindberg (JIRA)

unread,
Jun 10, 2016, 9:28:03 PM6/10/16
to puppe...@googlegroups.com

Eric Sorenson (JIRA)

unread,
Jul 15, 2016, 7:41:11 PM7/15/16
to puppe...@googlegroups.com
Eric Sorenson assigned an issue to R.I.Pienaar
 

R.I.Pienaar do henrik's suggestions address your concerns? sounds like there is a way to achieve this - pls put the ticket back to me iff not.

Change By: Eric Sorenson
Assignee: R.I.Pienaar
Fix Version/s: PUP 4.6.0

R.I.Pienaar (JIRA)

unread,
Jul 16, 2016, 9:07:07 AM7/16/16
to puppe...@googlegroups.com
R.I.Pienaar commented on Bug PUP-6400
 
Re: lookup cli has no way to set arbitrary scope values

Eric Sorenson no can't say I got this to work tbh

irb(main):002:0> JSON.parse(File.read("facts.json"))
=> {"trusted"=>{"certname"=>"foo.com"}}

:hierarchy:
  - "%{trusted.certname}"

# puppet lookup --facts facts.json --debug some::data
Debug: hiera(): Looking up lookup_options in YAML backend
Debug: hiera(): Looking for data source dev3.devco.net
...

Doesn't seem to be using these facts. But apart from that Henrik Lindberg also identified what looks like some feature work that's needed in his reply

Moses Mendoza (JIRA)

unread,
May 16, 2017, 8:01:03 PM5/16/17
to puppe...@googlegroups.com
Moses Mendoza updated an issue
 
Change By: Moses Mendoza
Labels: needs_decision triaged
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Moses Mendoza (JIRA)

unread,
May 16, 2017, 8:01:03 PM5/16/17
to puppe...@googlegroups.com
Moses Mendoza assigned an issue to Eric Sorenson
Change By: Moses Mendoza
Assignee: R.I.Pienaar Eric Sorenson

Moses Mendoza (JIRA)

unread,
May 16, 2017, 8:01:33 PM5/16/17
to puppe...@googlegroups.com

Rob Braden (JIRA)

unread,
Nov 30, 2018, 2:42:03 PM11/30/18
to puppe...@googlegroups.com
Rob Braden updated an issue
Change By: Rob Braden
Sub-team: Language
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Rob Braden (JIRA)

unread,
Nov 30, 2018, 2:42:04 PM11/30/18
to puppe...@googlegroups.com
Rob Braden updated an issue
Change By: Rob Braden
Team: Platform Core Server

Josh Cooper (Jira)

unread,
Aug 18, 2021, 4:18:02 PM8/18/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6400
 
Re: lookup cli has no way to set arbitrary scope values

The lack of trusted facts will be fixed in PUP-8094, but I'll leave this open regarding the ability to specify arbitrary variables.

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

David McTavish (Jira)

unread,
Dec 6, 2021, 11:32:01 AM12/6/21
to puppe...@googlegroups.com
David McTavish updated an issue
 
Change By: David McTavish
Labels: final_triage needs_decision

David McTavish (Jira)

unread,
Dec 6, 2021, 11:32:02 AM12/6/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Issue Type: Bug Improvement

David McTavish (Jira)

unread,
Dec 6, 2021, 1:32:01 PM12/6/21
to puppe...@googlegroups.com

David McTavish (Jira)

unread,
Dec 22, 2021, 1:31:01 PM12/22/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Team: Froyo
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Molly Waggett (Jira)

unread,
Feb 22, 2022, 1:37:01 PM2/22/22
to puppe...@googlegroups.com
Molly Waggett updated an issue
Change By: Molly Waggett
Labels: final_triage needs_decision

Josh Cooper (Jira)

unread,
May 28, 2022, 2:09:02 PM5/28/22
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-6400
 
Re: lookup cli has no way to set arbitrary scope values

Coming back to this. It is currently possible to override the certname trusted fact by specifying the certname option:

$ cat /home/josh/.puppetlabs/etc/code/environments/trusted/hiera.yaml  
---
version: 5
hierarchy:
  - name: "Environment"
    paths:
    - "%{trusted.certname}"
$ cat /home/josh/.puppetlabs/etc/code/environments/trusted/data/foo.com
---
key: 42
$ bundle exec puppet lookup key -E trusted --certname foo.com          
--- 42 

It is also possible to specify facts that are used to derive the "certname" (though if you specify one value, then you have to specify all of them:

$ cat facts.json                                                       
  "hostname": "foo",
  "domain": "com",
  "fqdn": "foo.com",
  "clientcert": "foo.com"
}
$ bundle exec puppet lookup key -E trusted --facts facts.json 
--- 42

But you cannot specify arbitrary trusted facts nor can you specify node parameters. It would be fairly trivial to add command line options to support those use cases.

Reply all
Reply to author
Forward
0 new messages