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

fix map.erb to work on Redhat 6 releases #963

Merged
merged 1 commit into from
Nov 4, 2016
Merged

fix map.erb to work on Redhat 6 releases #963

merged 1 commit into from
Nov 4, 2016

Conversation

mbelscher
Copy link

Currently our team still requires support for RHEL and CentOS6.7 releases. This has a back level
ruby of 1.8.7 the map.erb doesn't compile correctly

erb -x -T '-' map.erb | ruby -c
-:17: syntax error, unexpected '|', expecting tCOLON2 or '[' or '.'
... @mappings.inject(0) { |l,(h)| h['key'].size > l ? h['key']....
^
-:17: syntax error, unexpected '}', expecting kEND
...size > l ? h['key'].size : l }

With the latest changes to Ran UT test. This is the relevant section and the final tally

nginx::resource::map
os-independent items
basic assumptions

  should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with owner => "root", group => "root", mode => "0644", ensure => "file" and content =~ /map \$uri \$backend_pool/
map.conf template content
  when hostnames is true
    should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with mode => "0644"
    should set hostnames
  when default is pool_a
    should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with mode => "0644"
    should set default
  when mappings is {"foo"=>"pool_b", "bar"=>"pool_c", "baz"=>"pool_d"}
    should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with mode => "0644"
    should contain ordered mappings when supplied as a hash
  when mappings is [{"key"=>"foo", "value"=>"pool_b"}, {"key"=>"bar", "value"=>"pool_c"}, {"key"=>"baz", "value"=>"pool_d"}]
    should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with mode => "0644"
    should contain mappings in input order when supplied as an array of hashes
  when ensure => absent
    should contain File[/etc/nginx/conf.d/backend_pool-map.conf] with ensure => "absent"
  when mappings is a string

    should raise Puppet::Error with message matching /mappings must be a hash of the form { 'foo' => 'pool_b' }/

Finished in 2 minutes 24.4 seconds (files took 1.43 seconds to load)
864 examples, 0 failures

@wyardley wyardley merged commit a4b630a into voxpupuli:master Nov 4, 2016
@wyardley
Copy link
Collaborator

wyardley commented Nov 4, 2016

Just FWIW, the README has "Ruby 1.9.3 or later (Support for Ruby-1.8.7 is not guaranteed. YMMV)."

I can think of some other things the module assumes (ordered hashes, for one) that are also not Ruby 1.8.7 friendly.

That said, the change is small and the tests pass, so I've merged this.

cegeka-jenkins pushed a commit to cegeka/puppet-nginx that referenced this pull request Sep 13, 2019
Minor change to map.erb to work with Ruby 1.8.7
Rubueno pushed a commit to Rubueno/puppet-nginx that referenced this pull request Oct 19, 2020
Minor change to map.erb to work with Ruby 1.8.7
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.

2 participants