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

Evaluation Error: Operator '[]' is not applicable to an Undef Value. #571

Open
n1md4 opened this issue Sep 25, 2020 · 6 comments
Open

Evaluation Error: Operator '[]' is not applicable to an Undef Value. #571

n1md4 opened this issue Sep 25, 2020 · 6 comments

Comments

@n1md4
Copy link

n1md4 commented Sep 25, 2020

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.17.0
  • Ruby: 2.5.5
  • Distribution: centos
  • Module version:4.1.1

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

Use example code to test virtualenv pip install

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Operator '[]' is not applicable to an Undef Value. (file: ... python/manifests/pyvenv.pp, line: 49, column: 12) (file: ... python/manifests/init.pp, line: 95) on node host.domain

What behaviour did you expect instead

For the example to work.

Output log

Any additional information you'd like to impart

python/manifests/pyvenv.pp, line: 49
      case $facts['os']['distro']['codename'] {
python/manifests/init.pp, line: 95
  create_resources('python::pyvenv', $python_pyvenvs)

From the host facter os returns results whereas distro and codename do not.

@kenyon
Copy link
Member

kenyon commented Sep 25, 2020

Hmm, I seem to remember that if you install the package redhat-lsb-core then those facts are available.

@n1md4
Copy link
Author

n1md4 commented Sep 28, 2020

Hi Kenyon. It is a CentOS server but the agent is running on Debian.

I checked APT and lsb-base, lsb-compat, and lsb-release are installed.

I did get codename and distro from lsb_release with the following options:

# lsb_release -cs
stretch
# lsb_release -is
Debian

Albeit, that doesn't help the facter results.

@n1md4
Copy link
Author

n1md4 commented Sep 28, 2020

I exported facter values to test, and still puppet runs fail with the same error:

export FACTER_distro="Debian"
export FACTER_codename="stretch"
# facter codename
stretch
# facter distro
Debian
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Operator '[]' is not applicable to an Undef Value. (file: .../python/manifests/pyvenv.pp, line: 49, column: 12) (file: .../python/manifests/init.pp, line: 95) on node host.domain

@kenyon
Copy link
Member

kenyon commented Sep 29, 2020

Well, the os fact is structured, so to test that properly you would do this:

% facter os.distro.codename
buster

That fact should exist.

@n1md4
Copy link
Author

n1md4 commented Sep 29, 2020

Hmm still that command returns nothing on my setup.

All I want is for the python module to install a module with pip in a target directory within a virtualenv.

I am using the example hiera code:

python::python_pyvenvs:
  "/opt/env1":
    version: "system"
  "/opt/env2":
    version: "system"
python::python_pips:
  "nose":
    virtualenv: "/opt/env1"
  "coverage":
    virtualenv: "/opt/env2"

and I get the error I posted.

@alexjfisher
Copy link
Member

Unfortunately, the version of facter shipped as part of Debian 9 is really old (and puppet itself is only version 4.8). Puppet Inc was shipping facter 3 from puppet 4.2 onwards, but in Debian 9 it's only version 2.4.6.

When we dropped support for Puppet 4 in January 2019, we also decided to stop supporting facter 2.

Are you able to install puppet from the puppetlabs apt repositories instead?

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

3 participants