Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken $hostname default value when fact['networking'] is null #138

Open
brabiega opened this issue Mar 4, 2020 · 1 comment
Open

Broken $hostname default value when fact['networking'] is null #138

brabiega opened this issue Mar 4, 2020 · 1 comment

Comments

@brabiega
Copy link

brabiega commented Mar 4, 2020

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.4.0
  • Ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
  • Distribution: Server - Ubuntu Bionic, Agent - Ubuntu Trusty
  • Module version: v3.0.0

How to reproduce (e.g Puppet code you use)

I have quite specific setup - I'm running puppet in some old, long running docker containers. Probably due to that the "networking" fact is empty on such nodes which causes:

{"message":"Server Error: Evaluation Error: Operator '[]' is not applicable to an Undef Value. (file: /etc/puppet/environments/production/modules/telegraf/manifests/params.pp, line: 37, column: 29) 

This line is the problem:

$hostname               = $facts['networking']['hostname']

Even when I pass the $hostname directly when I initialize telegraf module the default value can't be fetched from facts and whole catalog fails.

What are you seeing

mon-01-59c36840-1d9d-4ec4-a4e8-317b19e83d3c:~ # facter -p networking -j
{
  "networking": null
}

What behaviour did you expect instead

That's a good question. The catalog compilation shouldn't fail when $hostname is provided and default value cannot be resolved.

Output log

mon-01-59c36840-1d9d-4ec4-a4e8-317b19e83d3c:~ # facter -p networking -j
{
  "networking": null
}

Any additional information you'd like to impart

@Dan33l
Copy link
Member

Dan33l commented Mar 4, 2020

This is due to version of facter.

The version shipped with Puppet package All In One (aka AIO) provided by Puppet Inc. is not the same one that version shipped by Puppet package provided by packagers of GNU/Linux distribs.

Unfortunately we can not gives requirement about facter in the metadata.json file, only about Puppet.

Fewer and fewer legacy facts (not structured) are removed from modules.

We use and tests VP modules with AIO packages. My advice is to use the same than us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants