puppet-python
puppet-python copied to clipboard
Evaluation Error: Operator '[]' is not applicable to an Undef Value.
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.
Hmm, I seem to remember that if you install the package redhat-lsb-core then those facts are available.
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.
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
Well, the os fact is structured, so to test that properly you would do this:
% facter os.distro.codename
buster
That fact should exist.
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.
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?