Skip to content

Commit

Permalink
Fix frozen string errors for tasks (puppetlabs#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
khaefeli authored and florindragos committed Jun 24, 2019
1 parent 28265e6 commit 3772c5b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions tasks/swarm_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

def swarm_init(advertise_addr, autolock, cert_expiry, dispatcher_heartbeat, external_ca, force_new_cluster, listen_addr, max_snapshots, snapshot_interval)
cmd_string = 'docker swarm init'
cmd_string << " --advertise-addr=#{advertise_addr}" unless advertise_addr.nil?
cmd_string << ' --autolock' unless autolock.nil?
cmd_string << ' --cert-expiry' unless cert_expiry.nil?
cmd_string << " --dispatcher-heartbeat=#{dispatcher_heartbeat}" unless dispatcher_heartbeat.nil?
cmd_string << " --external-ca=#{external_ca}" unless external_ca.nil?
cmd_string << ' --force-new-cluster' unless force_new_cluster.nil?
cmd_string << " --listen-addr=#{listen_addr}" unless listen_addr.nil?
cmd_string << " --max-snapshots=#{max_snapshots}" unless max_snapshots.nil?
cmd_string << " --snapshot-interval=#{snapshot_interval}" unless snapshot_interval.nil?
cmd_string += " --advertise-addr=#{advertise_addr}" unless advertise_addr.nil?
cmd_string += ' --autolock' unless autolock.nil?
cmd_string += ' --cert-expiry' unless cert_expiry.nil?
cmd_string += " --dispatcher-heartbeat=#{dispatcher_heartbeat}" unless dispatcher_heartbeat.nil?
cmd_string += " --external-ca=#{external_ca}" unless external_ca.nil?
cmd_string += ' --force-new-cluster' unless force_new_cluster.nil?
cmd_string += " --listen-addr=#{listen_addr}" unless listen_addr.nil?
cmd_string += " --max-snapshots=#{max_snapshots}" unless max_snapshots.nil?
cmd_string += " --snapshot-interval=#{snapshot_interval}" unless snapshot_interval.nil?

stdout, stderr, status = Open3.capture3(cmd_string)
raise Puppet::Error, "stderr: '#{stderr}'" if status != 0
Expand Down
8 changes: 4 additions & 4 deletions tasks/swarm_join.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

def swarm_join(advertise_addr, listen_addr, token, manager_ip)
cmd_string = 'docker swarm join'
cmd_string << " --advertise-addr=#{advertise_addr}" unless advertise_addr.nil?
cmd_string << " --listen-addr=#{listen_addr}" unless listen_addr.nil?
cmd_string << " --token=#{token}" unless token.nil?
cmd_string << " #{manager_ip}" unless manager_ip.nil?
cmd_string += " --advertise-addr=#{advertise_addr}" unless advertise_addr.nil?
cmd_string += " --listen-addr=#{listen_addr}" unless listen_addr.nil?
cmd_string += " --token=#{token}" unless token.nil?
cmd_string += " #{manager_ip}" unless manager_ip.nil?

stdout, stderr, status = Open3.capture3(cmd_string)
raise Puppet::Error, "stderr: '#{stderr}'" if status != 0
Expand Down
2 changes: 1 addition & 1 deletion tasks/swarm_leave.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def swarm_leave(force)
cmd_string = 'docker swarm leave '
cmd_string << ' -f' if force == 'true'
cmd_string += ' -f' if force == 'true'
stdout, stderr, status = Open3.capture3(cmd_string)
raise Puppet::Error, "stderr: '#{stderr}'" if status != 0
stdout.strip
Expand Down
4 changes: 2 additions & 2 deletions tasks/swarm_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

def swarm_update(image, service)
cmd_string = 'docker service update'
cmd_string << " --image #{image}" unless image.nil?
cmd_string << " #{service}" unless service.nil?
cmd_string += " --image #{image}" unless image.nil?
cmd_string += " #{service}" unless service.nil?

stdout, stderr, status = Open3.capture3(cmd_string)
raise Puppet::Error, "stderr: '#{stderr}'" if status != 0
Expand Down

0 comments on commit 3772c5b

Please sign in to comment.