add_alias(server_alias)
click to toggle source
def add_alias(server_alias)
if app.gear.uuid == self.uuid
get_proxy.add_alias(app, self, app.framework, server_alias)
else
ResultIO.new
end
end
add_authorized_ssh_key(ssh_key, key_type=nil, comment=nil)
click to toggle source
def add_authorized_ssh_key(ssh_key, key_type=nil, comment=nil)
get_proxy.add_authorized_ssh_key(app, self, ssh_key, key_type, comment)
end
add_broker_auth_key(iv,token)
click to toggle source
def add_broker_auth_key(iv,token)
get_proxy.add_broker_auth_key(app, self, iv, token)
end
add_env_var(key, value)
click to toggle source
def add_env_var(key, value)
get_proxy.add_env_var(app, self, key, value)
end
app_state_job_show()
click to toggle source
def app_state_job_show()
job = get_proxy.get_show_state_job(app, self)
job
end
broker_auth_key_job_add(iv, token)
click to toggle source
def broker_auth_key_job_add(iv, token)
job = get_proxy.get_broker_auth_key_add_job(app, self, iv, token)
job
end
broker_auth_key_job_remove()
click to toggle source
def broker_auth_key_job_remove()
job = get_proxy.get_broker_auth_key_remove_job(app, self)
job
end
cartridges()
click to toggle source
def cartridges
group_instance = app.group_instance_map[group_instance_name]
carts = group_instance.component_instances.map{ |comp_instance_name| app.comp_instance_map[comp_instance_name].parent_cart_name }
carts.delete(app.name)
carts
end
conceal_port(comp_inst)
click to toggle source
def conceal_port(comp_inst)
get_proxy.conceal_port(app,self,comp_inst.parent_cart_name)
end
create()
click to toggle source
def create
if server_identity.nil?
ret = nil
begin
self.app.ngears += 1
self.container = StickShift::ApplicationContainerProxy.find_available(self.node_profile)
self.server_identity = self.container.id
self.uid = self.container.reserve_uid
self.app.group_instance_map[self.group_instance_name].gears << self
self.app.save
ret = self.container.create(app,self)
self.app.track_usage(self, UsageRecord::EVENTS[:begin]) if ret.exitcode == 0
rescue Exception => e
Rails.logger.debug e.message
Rails.logger.debug e.backtrace.join("\n")
ret = ResultIO.new
ret.errorIO << e.message
ret.exitcode = 5
end
if ret.exitcode != 0
begin
get_proxy.destroy(self.app, self)
rescue Exception => e
end
self.app.ngears -= 1
self.app.group_instance_map[self.group_instance_name].gears.delete(self)
self.app.save
raise StickShift::NodeException.new("Unable to create gear on node", 1, ret)
end
return ret
end
end
destroy()
click to toggle source
def destroy
ret = get_proxy.destroy(app,self)
if ret.exitcode == 0
self.app.destroyed_gears = [] unless self.app.destroyed_gears
self.app.destroyed_gears << @uuid
app.process_cartridge_commands(ret)
track_destroy_usage
self.app.ngears -= 1
self.app.group_instance_map[self.group_instance_name].gears.delete(self)
self.app.save
else
raise StickShift::NodeException.new("Unable to destroy gear on node", 1, ret)
end
return ret
end
env_var_job_add(key, value)
click to toggle source
def env_var_job_add(key, value)
job = get_proxy.get_env_var_add_job(app, self, key, value)
job
end
env_var_job_remove(key)
click to toggle source
def env_var_job_remove(key)
job = get_proxy.get_env_var_remove_job(app, self, key)
job
end
execute_connector(comp_inst, connector_name, input_args)
click to toggle source
def execute_connector(comp_inst, connector_name, input_args)
get_proxy.execute_connector(app, self, comp_inst.parent_cart_name, connector_name, input_args)
end
expose_port(comp_inst)
click to toggle source
def expose_port(comp_inst)
get_proxy.expose_port(app,self,comp_inst.parent_cart_name)
end
force_destroy()
click to toggle source
def force_destroy
begin
begin
get_proxy.destroy(app,self)
rescue Exception => e
end
self.app.destroyed_gears = [] unless self.app.destroyed_gears
self.app.destroyed_gears << @uuid
track_destroy_usage
ensure
self.app.ngears -= 1
self.app.group_instance_map[self.group_instance_name].gears.delete(self)
self.app.save
end
end
force_stop(comp_inst)
click to toggle source
def force_stop(comp_inst)
get_proxy.force_stop(app,self,comp_inst.parent_cart_name)
end
get_execute_connector_job(cart, connector_name, input_args)
click to toggle source
def get_execute_connector_job(cart, connector_name, input_args)
get_proxy.get_execute_connector_job(app, self, cart, connector_name, input_args)
end
get_proxy()
click to toggle source
def get_proxy
if self.container.nil? and !@server_identity.nil?
self.container = StickShift::ApplicationContainerProxy.instance(@server_identity)
end
return self.container
end
group_instance()
click to toggle source
def group_instance
self.app.group_instance_map[self.group_instance_name]
end
prepare_namespace_update(dns_service, new_ns, old_ns)
click to toggle source
def prepare_namespace_update(dns_service, new_ns, old_ns)
results = []
gi = self.app.group_instance_map[self.group_instance_name]
contains_proxy = false
contains_framework = false
contains_mysql = false
result_io = ResultIO.new
gi.component_instances.each do |cname|
ci = self.app.comp_instance_map[cname]
contains_proxy = true if ci.parent_cart_name == self.app.proxy_cartridge
contains_framework = true if ci.parent_cart_name == self.app.framework
contains_mysql = true if ci.parent_cart_name == "mysql-5.1"
end
if contains_proxy || !self.app.scalable
register_application(dns_service, old_ns, new_ns, self.app.name)
else
register_application(dns_service, old_ns, new_ns, self.name)
end
if contains_framework
result_io.append call_update_namespace_hook(self.app.framework, new_ns, old_ns)
else
result_io.append call_update_namespace_hook("abstract", new_ns, old_ns)
end
result_io
end
reload(comp_inst)
click to toggle source
def reload(comp_inst)
get_proxy.reload(app,self,comp_inst.parent_cart_name)
end
remove_alias(server_alias)
click to toggle source
def remove_alias(server_alias)
if app.gear.uuid == self.uuid
get_proxy.remove_alias(app, self, app.framework, server_alias)
else
ResultIO.new
end
end
remove_authorized_ssh_key(ssh_key, comment=nil)
click to toggle source
def remove_authorized_ssh_key(ssh_key, comment=nil)
get_proxy.remove_authorized_ssh_key(app, self, ssh_key, comment)
end
remove_broker_auth_key()
click to toggle source
def remove_broker_auth_key
get_proxy.remove_broker_auth_key(app, self)
end
remove_env_var(key)
click to toggle source
def remove_env_var(key)
get_proxy.remove_env_var(app, self, key)
end
restart(comp_inst)
click to toggle source
def restart(comp_inst)
get_proxy.restart(app,self,comp_inst.parent_cart_name)
end
show_port(comp_inst)
click to toggle source
def show_port(comp_inst)
get_proxy.show_port(app,self,comp_inst.parent_cart_name)
end
show_state()
click to toggle source
def show_state()
get_proxy.show_state(app, self)
end
ssh_key_job_add(ssh_key, ssh_key_type, ssh_key_comment)
click to toggle source
def ssh_key_job_add(ssh_key, ssh_key_type, ssh_key_comment)
job = get_proxy.get_add_authorized_ssh_key_job(app, self, ssh_key, ssh_key_type, ssh_key_comment)
job
end
ssh_key_job_remove(ssh_key, ssh_key_comment)
click to toggle source
def ssh_key_job_remove(ssh_key, ssh_key_comment)
job = get_proxy.get_remove_authorized_ssh_key_job(app, self, ssh_key, ssh_key_comment)
job
end
start(comp_inst)
click to toggle source
def start(comp_inst)
get_proxy.start(app,self,comp_inst.parent_cart_name)
end
status(comp_inst)
click to toggle source
def status(comp_inst)
get_proxy.status(app,self,comp_inst.parent_cart_name)
end
stop(comp_inst)
click to toggle source
def stop(comp_inst)
get_proxy.stop(app,self,comp_inst.parent_cart_name)
end
system_messages(comp_inst)
click to toggle source
def system_messages(comp_inst)
get_proxy.system_messages(app, self, comp_inst.parent_cart_name)
end
threaddump(comp_inst)
click to toggle source
def threaddump(comp_inst)
get_proxy.threaddump(app,self,comp_inst.parent_cart_name)
end
tidy(comp_inst)
click to toggle source
def tidy(comp_inst)
get_proxy.tidy(app,self,comp_inst.parent_cart_name)
end