From eb046bf24d7c7468a1f66b5ccff8ca7774c426e1 Mon Sep 17 00:00:00 2001 From: Brian Hartsock Date: Fri, 16 Dec 2011 11:40:44 -0500 Subject: [PATCH] [rackspace|lb] Added error pages to the model --- .../models/load_balancers/load_balancer.rb | 15 +++++++++++++++ .../models/load_balancers/load_balancer_tests.rb | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/fog/rackspace/models/load_balancers/load_balancer.rb b/lib/fog/rackspace/models/load_balancers/load_balancer.rb index 36aeeb6ad..c3ddbe027 100644 --- a/lib/fog/rackspace/models/load_balancers/load_balancer.rb +++ b/lib/fog/rackspace/models/load_balancers/load_balancer.rb @@ -160,6 +160,21 @@ module Fog connection.get_load_balancer_usage(identity, options).body end + def error_page + requires :identity + connection.get_error_page(identity).body['errorpage']['content'] + end + + def error_page=(content) + requires :identity + connection.set_error_page identity, content + end + + def reset_error_page + requires :identity + connection.remove_error_page identity + end + private def create requires :name, :protocol, :port, :virtual_ips, :nodes diff --git a/tests/rackspace/models/load_balancers/load_balancer_tests.rb b/tests/rackspace/models/load_balancers/load_balancer_tests.rb index 6e776cbb1..9245f6086 100644 --- a/tests/rackspace/models/load_balancers/load_balancer_tests.rb +++ b/tests/rackspace/models/load_balancers/load_balancer_tests.rb @@ -109,6 +109,21 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer', ['rackspace']) do @instance.disable_session_persistence end + @instance.wait_for { ready? } + tests("#error_page").succeeds do + @instance.error_page + end + + @instance.wait_for { ready? } + tests("#error_page = 'asdf'").succeeds do + @instance.error_page = 'asdf' + end + + @instance.wait_for { ready? } + tests("#reset_error_page").succeeds do + @instance.reset_error_page + end + @instance.wait_for { ready? } end