Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Bug 911322 #1561

Merged
merged 1 commit into from
Mar 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions broker/test/helpers/rest/api_models_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,12 @@ def initialize(type=nil, name=nil, app=nil)
end
end

def valid
raise_ex("Invalid cartridge type '#{self.type}'") if ((self.type != 'standalone') && (self.type != 'embedded'))
def valid(app=nil)
raise_ex("Invalid cartridge type '#{self.type}'") if ((self.type != 'standalone') && (self.type != 'embedded'))
if app
raise_ex("Invalid cartridge type '#{self.type}'") if self.type != 'embedded'
raise_ex("Invalid cartridge type '#{self.name}'") if self.name.start_with? "haproxy"
end
end
end

Expand Down
19 changes: 0 additions & 19 deletions broker/test/helpers/rest/api_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,9 @@ def compare(hash)
app_add_cart_post_v1.response_type = "cartridge"
app_add_cart_post_v1.response_status = "created"

#app_expose_port_post_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/events", "POST")
#app_expose_port_post_v1.request['event'] = 'expose-port'
#app_expose_port_post_v1.response = RestApplication_V1.new(app_name, app_type, dom_id, app_scale)
#app_expose_port_post_v1.response_type = "application"

#app_show_port_post_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/events", "POST")
#app_show_port_post_v1.request['event'] = 'show-port'
#app_show_port_post_v1.response = RestApplication_V1.new(app_name, app_type, dom_id, app_scale)
#app_show_port_post_v1.response_type = "application"

#app_gear_get_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/gears")
#app_gear_get_v1.response_type = 'gears'

app_gear_groups_get_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/gear_groups")
app_gear_groups_get_v1.response_type = 'gear_groups'

#app_conceal_port_post_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/events", "POST")
#app_conceal_port_post_v1.request['event'] = 'conceal-port'
#app_conceal_port_post_v1.response = RestApplication_V1.new(app_name, app_type, dom_id, app_scale)
#app_conceal_port_post_v1.response_type = "application"

app_cart_list_get_v1 = RestApi_V1.new("/domains/#{dom_id}/applications/#{app_name}/cartridges")
app_cart_list_get_v1.response_type = "cartridges"

Expand Down Expand Up @@ -285,7 +267,6 @@ def compare(hash)
#app_show_port_post_v1,
#app_gear_get_v1,
app_gear_groups_get_v1,
#app_conceal_port_post_v1,
app_cart_list_get_v1,
app_cart_get_v1,
app_cart_start_post_v1,
Expand Down
6 changes: 5 additions & 1 deletion controller/app/helpers/rest_model_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def get_application_rest_cartridges(application, domain)
group_instances.each do |group_instance|
component_instances = group_instance.all_component_instances
component_instances.each do |component_instance|
cartridges << get_rest_cartridge(application, domain, component_instance, group_instances, application.group_overrides)
if requested_api_version == 1.0
cartridges << get_rest_cartridge(application, domain, component_instance, group_instances, application.group_overrides) if component_instance.is_embeddable? and !component_instance.is_web_proxy?
else
cartridges << get_rest_cartridge(application, domain, component_instance, group_instances, application.group_overrides)
end
end
end
cartridges
Expand Down
5 changes: 5 additions & 0 deletions controller/app/models/component_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def is_embeddable?
cart = CartridgeCache.find_cartridge(cartridge_name)
cart.is_embeddable?
end

def is_web_proxy?
cart = CartridgeCache.find_cartridge(cartridge_name)
cart.is_web_proxy?
end

def group_instance
self.application.group_instances.find(self.group_instance_id)
Expand Down