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

Sort problem in v1.2.4 template #195

Closed
sshipway opened this issue May 4, 2017 · 3 comments
Closed

Sort problem in v1.2.4 template #195

sshipway opened this issue May 4, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@sshipway
Copy link

sshipway commented May 4, 2017

In version 1.2.4, the template has:

<% if @save_db_to_disk %>
<%- @save_db_to_disk_interval.sort_by{}.each do |seconds, key_change| -%>
save <%= seconds -%> <%= key_change -%> <%= "\n" -%>
<%- end -%>
<% end %>

This throws up an error under our version of Ruby (1.8.7):

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Failed to parse template redis/redis.conf.erb:
  Filepath: /etc/puppet/environments/development/modules/redis/templates/redis.conf.erb
  Line: 117
  Detail: undefined method `<=>' for nil:NilClass
 at /etc/puppet/environments/development/modules/redis/manifests/config.pp:92:18 on node xmdrdb01.smxemail.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The solution is to specify what to sort by, then it will correctly run:

<% if @save_db_to_disk %>
<%- @save_db_to_disk_interval.sort_by{|k,v|k}.each do |seconds, key_change| -%>
save <%= seconds -%> <%= key_change -%> <%= "\n" -%>
<%- end -%>
<% end %>

In the meantime, we have reverted to v1.2.3 which runs as expected and provides the features we currently use.

@petems
Copy link
Member

petems commented May 4, 2017

@sshipway Can you open a PR to the repo with that change?

I'm assuming this is on CentOS 6? 1.8.7 is EOL. I'd recomend using the Puppet 4+ agent as it comes with it's own Ruby packaged in, so won't have Ruby version issues.

@sshipway
Copy link
Author

sshipway commented May 4, 2017

Yes, this is Centos 6 with Puppet 3. We have a project running to upgrade to Centos 7 and bring everything up to Puppet 4, but this will take much time before it is approved and finalised. In the meantime, we (and many like us) will continue to be using Centos6/Pupet3 etc I suspect.

I don't have a separate repo with a change, sorry; it's only 6 chars and we're using the official 1.2.3 tag. I'll see what I can do...

@petems petems added the bug Something isn't working label May 11, 2017
@petems
Copy link
Member

petems commented May 11, 2017

Closed via #199

@petems petems closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants