Jira (PUP-11584) lookup always fails when --node agent.local is used

14 views
Skip to first unread message

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:36:03 AM6/29/22
to puppe...@googlegroups.com
Takashi Kajinami created an issue
 
Puppet / Bug PUP-11584
lookup always fails when --node agent.local is used
Issue Type: Bug Bug
Affects Versions: PUP 7.16.0
Assignee: Unassigned
Created: 2022/06/29 8:35 AM
Environment:

Reproduced with

  • CentOS Stream 9
  • Puppet 7.16.0
  • facter 4.2.10
  • ruby 3.0.3-159

The problem is not reproduced if I downgrade Puppet to 7.10.0 so this looks like a regression.

Priority: Normal Normal
Reporter: Takashi Kajinami

Puppet Version: 7.16.0
Puppet Server Version: 7.16.0
OS Name/Version: CentOS Stream 9

Desired Behavior:

puppet lookup should not fail when it is executed with --node agent.local

Actual Behavior:

puppet lookup consistently fails when it is executed with --node agent.local

```

[root@localhost ~]# sudo puppet lookup enabled_services --node agent.local
Error: Could not run: No facts available for target node: agent.local

```

 

The command works when --node is not used

```

[root@localhost ~]# sudo puppet lookup enabled_services
Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (file: /etc/puppet/hiera.yaml)

  • foo
  • baa

```

 

Hieradata files are created as shown below.

```

[root@localhost ~]# cat /etc/puppet/hiera.yaml

:backends:
  - json
:json:
  :datadir: /etc/puppet/hieradata
:hierarchy:
  - service_configs

[root@localhost ~]# cat /etc/puppet/hieradata/service_configs.json 

{   "enabled_services": ["foo", "baa"] }

```

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:38:02 AM6/29/22
to puppe...@googlegroups.com
Takashi Kajinami updated an issue
Change By: Takashi Kajinami
*Puppet Version: 7.16.0*
*Puppet Server Version: 7.16.0*
*OS Name/Version: CentOS Stream 9*

*Desired Behavior:*


puppet lookup should not fail when it is executed with --node agent.local

*Actual Behavior:*


puppet lookup consistently fails when it is executed with --node agent.local
{code:java}
```

[root@localhost ~]# sudo puppet lookup enabled_services --node agent.local
Error: Could not run: No facts available for target node: agent.local
{code}
```  

 

The command works when --node is not used
{code:java}
```

[root@localhost ~]# sudo puppet lookup enabled_services
Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (file: /etc/puppet/hiera.yaml)
---
- foo
- baa
{code}

```

 

Hieradata files are created as shown below.
{code:java}
```

[root@localhost ~]# cat /etc/puppet/hiera.yaml
---

:backends:
  - json
:json:
  :datadir: /etc/puppet/hieradata
:hierarchy:
  - service_configs
[root@localhost ~]# cat /etc/puppet/hieradata/service_configs.json 
{
  "enabled_services": ["foo", "baa"]
} {code}

```

 

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:39:01 AM6/29/22
to puppe...@googlegroups.com

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:42:01 AM6/29/22
to puppe...@googlegroups.com
Takashi Kajinami commented on Bug PUP-11584
 
Re: lookup always fails when --node agent.local is used

I could workaround the problem by adding a dummy fact file.

[root@localhost ~]# cat foo.yaml 
---
this: is_dummy
[root@localhost ~]# sudo puppet lookup enabled_services --node agent.local --facts foo.yaml
Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (file: /etc/puppet/hiera.yaml)
---
- foo
- baa

side note: this failed when I downgrade puppet to 7.10.0

[root@localhost ~]# sudo puppet lookup enabled_services --node agent.local --facts foo.yaml
Error: Could not run: undefined method `add_extra_values' for nil:NilClass 

 

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:43:02 AM6/29/22
to puppe...@googlegroups.com
Takashi Kajinami updated an issue
Change By: Takashi Kajinami
*Puppet Version: 7.16.0*
*Puppet Server Version: 7.16.0*
*OS Name/Version: CentOS Stream 9*

*Desired Behavior:*

puppet lookup should not fail when it is executed with --node agent.local

*Actual Behavior:*

puppet lookup consistently fails when it is executed with --node agent.local
{code:java}[root@localhost ~]# sudo puppet lookup enabled_services --node agent.local
Error: Could not run: No facts available for target node: agent.local
{code}
 

The command works when --node is not used
{code:java}[root@localhost ~]# sudo puppet lookup enabled_services

Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (file: /etc/puppet/hiera.yaml)
---
- foo
- baa {code}
 

Hieradata files are created as shown below.
{code:java}

[root@localhost ~]# cat /etc/puppet/ hieradata/service_configs.json 

{
  "enabled_services": ["foo", "baa"]
} {code}
{code:java}[root@localhost ~]# cat /etc/puppet/
hiera.yaml

---
:backends:
  - json
:json:
  :datadir: /etc/puppet/hieradata
:hierarchy:
  - service_configs
[root@localhost ~]# cat /etc/puppet/hieradata/service_configs.json 
{
  "enabled_services": ["foo", "baa"]
} {
code}
 

Takashi Kajinami (Jira)

unread,
Jun 29, 2022, 11:48:02 AM6/29/22
to puppe...@googlegroups.com
 
Re: lookup always fails when --node agent.local is used

Hmm... this might be just a wrong usage caused by misunderstanding of the example commands.

I don't see any logic to handle agent.local in puppet code.

And the failure looks like expected according to https://github.com/puppetlabs/puppet/commit/6b1cc3f6ec2d75508395a0803f39fc89c7db980d ...

Reply all
Reply to author
Forward
0 new messages