lib/gaptool-client.rb in gaptool-client-0.7.7 vs lib/gaptool-client.rb in gaptool-client-0.7.8

- old
+ new

@@ -270,19 +270,21 @@ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => false option ["-A", "--attribute"], "ATTRIBUTE", "Pass one or more parameters to the deploy recipe in recipe.attr=value format", :multivalued => true option ["-b", "--chef-branch"], "BRANCH", "branch of the chef repository to use (defaults to last branch used during init/chefrun)", :default => nil option ['-s', '--serial'], :flag, 'Run command serially. Order of execution is unknown.' + option ['-W', '--whyrun'], :flag, 'Whyrun, like dry-run but different.' def execute attrs = split_attrs(attribute_list) if !instance.nil? nodes = [$api.getonenode(instance)] else nodes = $api.getenvroles(role, environment) end method = serial? ? :each : :peach + wopts = whyrun? ? " -W " : "" nodes.send method do |node| if node['chef_runlist'].nil? runlist = ['recipe[main]'] elsif node['chef_runlist'].is_a? Array runlist = node['chef_runlist'] @@ -311,10 +313,10 @@ unless chef_branch.nil? json['chefbranch'] = chef_branch git = "git checkout -f #{chef_branch}; git fetch --all; git reset --hard origin/#{chef_branch}" end commands = [ - "cd ~admin/ops; #{git} && echo '#{json.to_json}' > ~admin/solo.json && sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json -E #{environment} && rm -f ~admin/solo.json" + "cd ~admin/ops; #{git} && echo '#{json.to_json}' > ~admin/solo.json && sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json -E #{environment}#{wopts}" ] sshcmd(node, commands) end end end