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

quote the numbers in the case statement #18

Merged
merged 2 commits into from
Apr 15, 2016

Conversation

mmckinst
Copy link
Contributor

This module is failing on puppet 4 because it doesn't have quotes around the numbers for operatingsystemmajrelease.

[root@memcached vagrant]# puppet --version
4.3.1
[root@memcached vagrant]# cat ./foo.pp
case $::operatingsystemmajrelease {
  6, 7: {
    notify {"${::operatingsystemmajrelease} no quotes":}
  } 
  default: {
    fail("Module ${module_name} is not supported on operatingsystemmajrelease ${::operatingsystemmajrelease}")
  }
}

[root@memcached vagrant]# puppet apply ./foo.pp
Error: Evaluation Error: Error while evaluating a Function Call, Module  is not supported on operatingsystemmajrelease 7 at /home/vagrant/foo.pp:6:5 on node memcached.example.net
[root@memcached vagrant]# 

Something in puppet 4 must've changed becaue it works fine in puppet 3. Interesting this is if you run the below code on puppet 3.x, the case statement stops at the 'no quote' statement whereas on puppet 4.x it stops at the 'with quotes' statement.

[root@memcached vagrant]# puppet --version
4.3.1
[root@memcached vagrant]# cat ./foo.pp
case $::operatingsystemmajrelease {
  6, 7: {
    notify {"${::operatingsystemmajrelease} no quotes":}
  } 
  '6', '7': {
    notify {"${::operatingsystemmajrelease} with quotes":}
  }
  default: {
    fail("Module ${module_name} is not supported on operatingsystemmajrelease ${::operatingsystemmajrelease}")
  }
}

[root@memcached vagrant]# puppet apply ./foo.pp
Notice: Compiled catalog for memcached.example.net in environment production in 0.05 seconds
Notice: 7 with quotes
Notice: /Stage[main]/Main/Notify[7 with quotes]/message: defined 'message' as '7 with quotes'
Notice: Applied catalog in 0.02 seconds
[root@memcached vagrant]# 

@mmckinst
Copy link
Contributor Author

Some actual documentation is https://tickets.puppetlabs.com/browse/PUP-4451 saying operatingsystemmajrelease is a string .

@cwood
Copy link

cwood commented Mar 11, 2016

Would be great to merge this in. Cause its affecting my upgrade to puppet4 as well.

@jhoblitt
Copy link
Owner

@mmckinst Somehow I missed this PR. Looks good. Thank you!

@jhoblitt jhoblitt merged commit 7d682bc into jhoblitt:master Apr 15, 2016
@mmckinst
Copy link
Contributor Author

Thanks @jhoblitt . Can you release a new version on puppetforge too?

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.

3 participants