lib/gizzmo.rb in gizzmo-0.11.1 vs lib/gizzmo.rb in gizzmo-0.11.2
- old
+ new
@@ -9,10 +9,11 @@
DOC_STRINGS = {
"addforwarding" => "Add a forwarding from a graph_id / base_source_id to a given shard.",
"addlink" => "Add a relationship link between two shards.",
"create" => "Create shard(s) of a given Java/Scala class. If you don't know the list of available classes, you can just try a bogus class, and the exception will include a list of valid classes.",
"drill" => "Show shard trees for replicas of a given structure signature (from 'report').",
+ "dump" => "Show shard trees for given table ids.",
"find" => "Show all shards with a given hostname.",
"finish-replica" => "Remove the write-only barrier in front of a shard that's finished being copied after 'setup-replica'.",
"flush" => "Flush error queue for a given priority.",
"forwardings" => "Get a list of all forwardings.",
"hosts" => "List hosts used in shard names in the forwarding table and replicas.",
@@ -79,10 +80,11 @@
opts.separator("")
end
def load_config(options, filename)
YAML.load(File.open(filename)).each do |k, v|
+ k = "hosts" if k == "host"
v = v.split(",").map {|h| h.strip } if k == "hosts"
options.send("#{k}=", v)
end
end
@@ -115,10 +117,14 @@
opts.on("-d", "--destination-type=TYPE") do |s|
subcommand_options.destination_type = s
end
end,
+ 'dump' => OptionParser.new do |opts|
+ opts.banner = "Usage: #{zero} dump TABLE_ID [TABLE_ID...]"
+ separators(opts, DOC_STRINGS["dump"])
+ end,
'wrap' => OptionParser.new do |opts|
opts.banner = "Usage: #{zero} wrap CLASS_NAME SHARD_ID_TO_WRAP [MORE SHARD_IDS...]"
separators(opts, DOC_STRINGS["wrap"])
end,
'rebalance' => OptionParser.new do |opts|
@@ -326,12 +332,13 @@
subcommand_options.quiet = true
end
end
}
-if ENV['GIZZMORC']
- load_config(global_options, ENV['GIZZMORC'])
+rc_path = ENV['GIZZMORC'] || "#{ENV["HOME"]}/.gizzmorc"
+if File.exists?(rc_path)
+ load_config(global_options, rc_path)
end
global = OptionParser.new do |opts|
opts.banner = "Usage: #{zero} [global-options] SUBCOMMAND [subcommand-options]"
opts.separator ""
@@ -364,9 +371,15 @@
opts.separator ""
opts.separator "Global options:"
opts.on("-H", "--hosts=HOST[,HOST,...]", "HOSTS of application servers") do |hosts|
global_options.hosts = hosts.split(",").map {|h| h.strip }
end
+
+ opts.on("-H", "--host=HOST", "HOST of application servers") do |hosts|
+ global_options.hosts = hosts.split(",").map {|h| h.strip }
+ end
+
+
opts.on("-P", "--port=PORT", "PORT of remote manager service. default 7920") do |port|
global_options.port = port.to_i
end