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

Detail: undefined method `split' for 443:Fixnum #122

Closed
elconas opened this issue Mar 5, 2017 · 0 comments
Closed

Detail: undefined method `split' for 443:Fixnum #122

elconas opened this issue Mar 5, 2017 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@elconas
Copy link
Contributor

elconas commented Mar 5, 2017

Regression intruduced by:

commit 4b0524d09934fa9a3a008811315db3174d4c4e18
Author: Craig Dunn <craig@craigdunn.org>
Date:   Wed Nov 30 12:15:03 2016 +0100

    initial change to enable port ranges (Closes #107)

diff --git a/templates/service.xml.erb b/templates/service.xml.erb
index ac62ff7..50691e0 100644
--- a/templates/service.xml.erb
+++ b/templates/service.xml.erb
@@ -7,7 +7,10 @@

     <%- if @port -%>
     <%- @port.each do |i| -%>
-    <port<% if i['protocol'] -%> protocol="<%= i['protocol'] %>"<% end -%><% if i['port'] -%> port="<%= i['port'] %>"<% end -%> />
+      <%- range = i['port'].split(/:/).map { |p| p.to_i } -%>
+      <%- (range[0]..range[1] || range[0]).each do |p| -%>
+    <port<% if i['protocol'] -%> protocol="<%= i['protocol'] %>"<% end -%> port="<%= p %>" />
+      <%- end -%>
     <%- end -%>

In case port is a list of Integers (not checked in code), the statement failes with:

Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Failed to parse template firewalld/service.xml.erb:
         Filepath: /opt/provision/modules/firewalld/templates/service.xml.erb
         Line: 10
         Detail: undefined method `split' for 443:Fixnum
at /opt/provision/modules/firewalld/manifests/custom_service.pp:66:16
elconas pushed a commit to elconas/puppet-firewalld that referenced this issue Mar 5, 2017
elconas added a commit to elconas/puppet-firewalld that referenced this issue Mar 5, 2017
crayfishx added a commit that referenced this issue Mar 5, 2017
@crayfishx crayfishx added accepted bug Something isn't working labels Mar 5, 2017
@crayfishx crayfishx added this to the 3.2.1 milestone Mar 5, 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