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

Ensure versioncmp 'a' parameter is a string #70

Merged
merged 3 commits into from
Mar 31, 2021

Conversation

raoulbhatia
Copy link
Contributor

Fixes:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, 'versioncmp' parameter 'a' expects a String value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/augeas/manifests/lens.pp, line: 61, column: 24) (file: /etc/puppetlabs/code/environments/production/modules/postfix/manifests/augeas.pp, line: 7) on node [...]

Fixes:
> Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, 'versioncmp' parameter 'a' expects a String value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/augeas/manifests/lens.pp, line: 61, column: 24) (file: /etc/puppetlabs/code/environments/production/modules/postfix/manifests/augeas.pp, line: 7) on node [...]
@raphink
Copy link
Member

raphink commented May 16, 2018

Well that might fix it, but your error is not supposed to happen (i.e. $::augeasversion being undef).

@raoulbhatia
Copy link
Contributor Author

I am still hitting this error with Ubuntu 18.04 and Puppet 5.4.0-2ubuntu3. Any way that I can better debug this?

@raoulbhatia
Copy link
Contributor Author

raoulbhatia commented Oct 29, 2018

Ok, it seems that $::augeasversion is undef/not set if augeas-tools is not installed.

@raphink
Copy link
Member

raphink commented Nov 1, 2018

It should not require augeas-tools, only the Augeas library.

@kjetilho
Copy link

The problem is with Facter 3.x, the C implementation runs "augparse --version" to find the version instead of using the Ruby library. The old Ruby implementation works just fine without augeas-tools installed. One possible workaround is to include that implementation as a plugin fact...

Tested on Ubuntu Bionic with facter 3.10.0-4

@linuxmail
Copy link

hi,

I've changed the line https://github.com/camptocamp/puppet-augeas/blob/8e605057c0b3f45b4cf36b13e1ad292fc3b63b88/manifests/lens.pp#L61

from:

if (!$stock_since or versioncmp($::augeasversion, $stock_since) < 0) {

to:

if (!$stock_since or versioncmp("${::augeasversion}", $stock_since) < 0) {

than the problem disapears.

cu denny

@wiene
Copy link

wiene commented Oct 10, 2019

The proposed patch worked for me.

@oasys
Copy link

oasys commented Mar 25, 2021

I"m seeing this same issue on a Debian Buster install, and the proposed patch fixes it.

Presumably this isn't merged because of the failing ci test:

manifests/lens.pp - WARNING: string containing only a variable on line 61

Is there something that can be done to fix the test or is there a different/better way to solve the problem?

@raphink
Copy link
Member

raphink commented Mar 31, 2021

Actually, we should use String() now: https://puppet.com/docs/puppet/7.5/typecasting.html

This will also fix the linting issue

manifests/lens.pp Outdated Show resolved Hide resolved
@raphink raphink merged commit 79c47b5 into voxpupuli:master Mar 31, 2021
@raoulbhatia
Copy link
Contributor Author

Thanks for improving my PR! 🇨🇭

@oasys
Copy link

oasys commented Apr 2, 2021

Thanks, this works for me. Can we do a forge release?

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

Successfully merging this pull request may close these issues.

6 participants