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

Remove .length from variable $pin_release in app #754

Merged
merged 5 commits into from
Jun 21, 2018

Conversation

paladox
Copy link

@paladox paladox commented May 15, 2018

This causes

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown function: 'length'. at /etc/puppet/environments/production/modules/apt/templates/pin.pref.epp:4:16 at /etc/puppet/environments/production/modules/apt/manifests/source.pp:92 on node xxx

downstream

We use puppet from Debian stretch

This causes 

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown function: 'length'. at /etc/puppet/environments/production/modules/apt/templates/pin.pref.epp:4:16 at /etc/puppet/environments/production/modules/apt/manifests/source.pp:92 on node xxx

downstream
@paladox
Copy link
Author

paladox commented May 15, 2018

We use puppet 4.8 from stretch.

@tphoney
Copy link

tphoney commented Jun 21, 2018

closing, and re-openning to force travis to re-kick

@tphoney tphoney closed this Jun 21, 2018
@tphoney tphoney reopened this Jun 21, 2018
@@ -1,7 +1,7 @@
<%- | $name, $pin_release, $release, $codename, $release_version, $component, $originator, $label, $version, $origin, $explanation, $packages_string, $priority | -%>
<%-
$pin =
if $pin_release.length > 0 {
if $pin_release {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this be better
if $pin_release and $pin_release.length > 0
Following the logic of the rest of the template.
Many thanks for the code !!! @paladox

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done.

@paladox
Copy link
Author

paladox commented Jun 21, 2018

Causes

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, epp(): Invalid EPP: Syntax error at 'options' at /etc/puppet/environments/production/modules/apt/templates/pin.pref.epp:5:3 at /etc/puppet/environments/production/modules/apt/manifests/pin.pp:74:17 at /etc/puppet/environments/production/modules/redis/manifests/init.pp:9 on node misc2.miraheze.org

@paladox
Copy link
Author

paladox commented Jun 21, 2018

and now i get

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown function: 'length'. at /etc/puppet/environments/production/modules/apt/templates/pin.pref.epp:4:33 at /etc/puppet/environments/production/modules/redis/manifests/init.pp:9 on node misc2.miraheze.org

again

@tphoney
Copy link

tphoney commented Jun 21, 2018

thanks @paladox i will have another look, and get back to you.

@tphoney
Copy link

tphoney commented Jun 21, 2018

apologies, for the interruption again, what manifest/data where you using to test this ?

@tphoney
Copy link

tphoney commented Jun 21, 2018

or revert back to what you had, and i will merge.

@paladox
Copy link
Author

paladox commented Jun 21, 2018

@tphoney we have this:

apt::pin { 'debian_stretch_backports_redis':
    priority   => 740,
    originator => 'Debian',
    release    => 'stretch-backports',
    packages   => 'redis-server',
}

/~https://github.com/miraheze/puppet/blob/master/modules/redis/manifests/init.pp#L9

/~https://github.com/miraheze/puppet/blob/master/manifests/site.pp#L42

@paladox
Copy link
Author

paladox commented Jun 21, 2018

doing

if $pin_release != '' {
  $options = [
    if $release != ''         { "a=${release}" },
    if $codename != ''        { "n=${codename}" },
    if $release_version != '' { "v=${release_version}"},
    if $component != ''       { "c=${component}" },
    if $originator != ''      { "o=${originator}" },
    if $label != ''           { "l=${label}" },
    ].filter |$x| { $x != undef }
   "release ${options.join(', ')}" }

should also work?

I think .length will only work on a array?

@tphoney
Copy link

tphoney commented Jun 21, 2018

https://forge.puppet.com/puppetlabs/stdlib#length Its a weird one :) depends on the puppet version 4 vs 5. I think, revert to 'if $pin_release ' and i will merge. the same goes for empty

@@ -1,14 +1,14 @@
<%- | $name, $pin_release, $release, $codename, $release_version, $component, $originator, $label, $version, $origin, $explanation, $packages_string, $priority | -%>
<%-
$pin =
if $pin_release.length > 0 {
if $pin_release {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be != ''?

@tphoney
Copy link

tphoney commented Jun 21, 2018

This looks good™️ 👍. Thanks for the effort you have put in.

@tphoney tphoney merged commit 7fc436b into puppetlabs:master Jun 21, 2018
@paladox
Copy link
Author

paladox commented Jun 21, 2018

your welcome and thanks for merging! :)

@paladox paladox deleted the patch-1 branch June 21, 2018 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants