From 5d3785ba7047cfe05851e0f99ad43875397767bf Mon Sep 17 00:00:00 2001 From: George Scott Date: Wed, 27 Mar 2013 12:09:05 -0700 Subject: [PATCH] [aws|beanstalk] Update parser for DescribeEnvironmentResources Updated parser to handle both new and "legacy" beanstalk stacks. Updated Environment#load_balancer to return correct result for both stack types. --- lib/fog/aws/models/beanstalk/environment.rb | 8 ++++++-- .../beanstalk/describe_environment_resources.rb | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/models/beanstalk/environment.rb b/lib/fog/aws/models/beanstalk/environment.rb index eef6b427d..82400a2a2 100644 --- a/lib/fog/aws/models/beanstalk/environment.rb +++ b/lib/fog/aws/models/beanstalk/environment.rb @@ -47,8 +47,12 @@ module Fog # Returns the load balancer object associated with the environment. def load_balancer(elb_connection = Fog::AWS[:elb]) - requires :resources - elb_connection.load_balancers.get(resources['LoadBalancer']['LoadBalancerName']) + + if resources.nil? + elb_connection.load_balancers.get(live_resources['LoadBalancers'].first['Name']) + else + elb_connection.load_balancers.get(resources['LoadBalancer']['LoadBalancerName']) + end end # Return events related to this version diff --git a/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb b/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb index ee74ad1f9..92a5ddf33 100644 --- a/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb +++ b/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb @@ -16,6 +16,17 @@ module Fog tag 'Id', :string tag 'LaunchConfigurations', :object, :list tag 'LoadBalancers', :object, :list + tag 'Resources', :object, :list + tag 'Description', :string + tag 'LogicalResourceId', :string + tag 'PhysicalResourceId', :string + tag 'Type', :string + tag 'Properties', :object, :list + tag 'RuntimeSources', :object, :list + tag 'Parameter', :string + tag 'Versions', :object, :list + tag 'ApplicationName', :string + tag 'VersionLabel', :string tag 'Triggers', :object, :list end