Skip to content

Instantly share code, notes, and snippets.

@hiroakis
Created April 11, 2017 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroakis/91fb724f981aa6ce3994af40a117dbd4 to your computer and use it in GitHub Desktop.
Save hiroakis/91fb724f981aa6ce3994af40a117dbd4 to your computer and use it in GitHub Desktop.
mkr command wrapper
require 'json'
service = ARGV[0]
role = ARGV[1]
status = ARGV[2]
roleFullnames = "#{service}:#{role}"
hosts = JSON.parse(`mkr hosts`)
target_host_ids = []
hosts.each do |i|
if i["roleFullnames"].include? roleFullnames
target_host_ids << i["id"]
end
end
ret = `mkr update --status #{status} #{target_host_ids.join(" ")}`
puts ret
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment