lib/gaptool-client.rb in gaptool-client-0.6.17 vs lib/gaptool-client.rb in gaptool-client-0.7.0
- old
+ new
@@ -150,10 +150,11 @@
option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => false
parameter "COMMAND ...", "Command to run", :attribute_name => :command
def execute
if !instance.nil?
+ node = $api.getonenode(instance)
nodes = [$api.getonenode(instance)]
else
nodes = $api.getenvroles(role, environment)
end
nodes.peach do |node|
@@ -323,10 +324,16 @@
option ['-H', '--hidden'], :flag, 'Display hidden hosts'
def execute
attrs = split_attrs(attribute_list)
if instance
- nodes = [$api.getonenode(instance)]
+ n = $api.getonenode(instance)
+ if n['environemnt'] != environment
+ abort "Instance #{instance} is not in environment #{environment}"
+ elsif !n['apps'].include?(app)
+ abort "Instance #{instance} does not host #{app} in env #{environment}"
+ end
+ nodes = [n]
else
params = hidden? ? {hidden: true} : {}
nodes = $api.getappnodes(app, environment, params)
end
nodes.peach do |node|