Skip to content

Commit 4595f39

Browse files
committed
(#10700) allow additional characters in comment string
1 parent f1b73a9 commit 4595f39

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/puppet/type/firewall.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
isnamevar
6262

6363
# Keep rule names simple - they must start with a number
64-
newvalues(/^\d+[a-zA-Z0-9\s\-_]+$/)
64+
newvalues(/^\d+[[:alpha:][:digit:][:punct:][:space:]]+$/)
6565
end
6666

6767
newproperty(:action) do

spec/fixtures/iptables/conversion_hash.rb

+15
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
:action => nil,
9494
},
9595
},
96+
'comment_string_character_validation' => {
97+
:line => '-A INPUT -s 192.168.0.1 -m comment --comment "000 allow from 192.168.0.1, please"',
98+
:tables => 'filter',
99+
:params => {
100+
:source => '192.168.0.1',
101+
},
102+
},
96103
}
97104

98105
# This hash is for testing converting a hash to an argument line.
@@ -176,4 +183,12 @@
176183
:args => ["-t", :filter, "-p", :tcp, "-m", "comment", "--comment", "100 states_set_from_array",
177184
"-m", "state", "--state", "ESTABLISHED,INVALID"],
178185
},
186+
'comment_string_character_validation' => {
187+
:params => {
188+
:name => "000 allow from 192.168.0.1, please",
189+
:table => 'filter',
190+
:source => '192.168.0.1'
191+
},
192+
:args => ['-t', :filter, '-s', '192.168.0.1', '-p', :tcp, '-m', 'comment', '--comment', '000 allow from 192.168.0.1, please'],
193+
},
179194
}

0 commit comments

Comments
 (0)