Created
April 11, 2017 06:12
-
-
Save hiroakis/91fb724f981aa6ce3994af40a117dbd4 to your computer and use it in GitHub Desktop.
mkr command wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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