Skip to content

Commit 0f9e2ea

Browse files
committed
Fix escaped string usage
Escaped strings should not be quotted. While here, also rework the way networks are escaped: the previous code was generating invalid parameters.
1 parent 7ce43ad commit 0f9e2ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/puppet/parser/functions/docker_run_flags.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ module Puppet::Parser::Functions
2222
flags = []
2323

2424
if opts['username']
25-
flags << "-u '#{call_function('docker::escape', [opts['username']])}'"
25+
flags << "-u #{call_function('docker::escape', [opts['username']])}"
2626
end
2727

2828
if opts['hostname']
29-
flags << "-h '#{call_function('docker::escape', [opts['hostname']])}'"
29+
flags << "-h #{call_function('docker::escape', [opts['hostname']])}"
3030
end
3131

3232
if opts['restart']
@@ -37,7 +37,7 @@ module Puppet::Parser::Functions
3737
if opts['net'].is_a? String
3838
flags << "--net #{call_function('docker::escape', [opts['net']])}"
3939
elsif opts['net'].is_a? Array
40-
flags << "--net #{call_function('docker::escape', [opts['net'].join(' --net ')])}" # FIXME: escaping is buggy
40+
flags += opts['net'].map { |item| ["--net #{call_function('docker::escape', [item])}"] }
4141
end
4242
end
4343

0 commit comments

Comments
 (0)