# File lib/rhc/rest/cartridge.rb, line 7 def initialize(args, use_debug=false) @properties = {} props = args[:properties] || args["properties"] || [] props.each do |p| category = @properties[:"#{p['type']}"] || {} category[:"#{p['name']}"] = p @properties[:"#{p['type']}"] = category end # Make sure that additional gear storage is an integer # TODO: This should probably be fixed in the broker args['additional_gear_storage'] = args['additional_gear_storage'].to_i rescue 0 super end
# File lib/rhc/rest/cartridge.rb, line 75 def connection_info info = property(:cart_data, :connection_url) || property(:cart_data, :job_url) || property(:cart_data, :monitoring_url) info ? (info["value"] || '').rstrip : nil end
# File lib/rhc/rest/cartridge.rb, line 58 def destroy debug "Deleting cartridge #{name}" rest_method "DELETE" end
# File lib/rhc/rest/cartridge.rb, line 27 def property(category, key) category = properties[category] category ? category[key] : nil end
# File lib/rhc/rest/cartridge.rb, line 53 def reload debug "Reloading cartridge #{name}" rest_method "RESTART", :event => "reload" end
# File lib/rhc/rest/cartridge.rb, line 48 def restart debug "Restarting cartridge #{name}" rest_method "RESTART", :event => "restart" end
# File lib/rhc/rest/cartridge.rb, line 23 def scalable? [scales_to,scales_from].map{|x| x > 1 || x == -1}.inject(:|) end
# File lib/rhc/rest/cartridge.rb, line 64 def set_scales(values) values.delete_if{|k,v| v.nil? } debug "Setting scales = %s" % values.map{|k,v| "#{k}: #{v}"}.join(" ") rest_method "UPDATE", values end
# File lib/rhc/rest/cartridge.rb, line 70 def set_storage(values) debug "Setting additional storage: #{values[:additional_gear_storage]}GB" rest_method "UPDATE", values end
# File lib/rhc/rest/cartridge.rb, line 38 def start debug "Starting cartridge #{name}" rest_method "START", :event => "start" end
Generated with the Darkfish Rdoc Generator 2.