Skip to content

Commit

Permalink
Fix to autoscale policy creation and launch config name parsing.
Browse files Browse the repository at this point in the history
Closes boto#154
  • Loading branch information
rlotun committed Apr 7, 2011
1 parent 95a5c70 commit 370bdf2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
9 changes: 8 additions & 1 deletion boto/ec2/autoscale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def create_scaling_policy(self, scaling_policy):
if scaling_policy.cooldown is not None:
params['Cooldown'] = scaling_policy.cooldown

return self.get_object('PutScalingPolicy', params)
return self.get_object('PutScalingPolicy', params, Request)

def delete_launch_configuration(self, launch_config_name):
"""
Expand Down Expand Up @@ -235,6 +235,10 @@ def get_all_launch_configurations(self, **kwargs):
:type max_records: int
:param max_records: Maximum amount of configurations to return.
:type next_token: str
:param next_token: If you have more results than can be returned at once, pass in this
parameter to page through all results.
:rtype: list
:returns: List of :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` instances.
"""
Expand All @@ -245,6 +249,9 @@ def get_all_launch_configurations(self, **kwargs):
params['MaxRecords'] = max_records
if names:
self.build_list_params(params, names, 'LaunchConfigurationNames')
next_token = kwargs.get('next_token')
if next_token:
params['NextToken'] = next_token
return self.get_list('DescribeLaunchConfigurations', params,
[('member', LaunchConfiguration)])

Expand Down
15 changes: 7 additions & 8 deletions boto/ec2/autoscale/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from boto.ec2.elb.listelement import ListElement
from boto.resultset import ResultSet
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.request import Request
from boto.ec2.autoscale.instance import Instance

Expand Down Expand Up @@ -117,17 +118,17 @@ def __init__(self, connection=None, name=None,
:param health_check_type: The service you want the health status from,
Amazon EC2 or Elastic Load Balancer.
:type launch_config: str
:type launch_config: str or LaunchConfiguration
:param launch_config: Name of launch configuration (required).
:type load_balancers: list
:param load_balancers: List of load balancers.
:type maxsize: int
:type max_size: int
:param maxsize: Maximum size of group (required).
:type minsize: int
:type min_size: int
:param minsize: Minimum size of group (required).
:type placement_group: str
Expand All @@ -147,11 +148,9 @@ def __init__(self, connection=None, name=None,
self.created_time = None
default_cooldown = default_cooldown or kwargs.get('cooldown') # backwards compatibility
self.default_cooldown = int(default_cooldown) if default_cooldown is not None else None
self.launch_config = launch_config
if self.launch_config:
self.launch_config_name = self.launch_config.name
else:
self.launch_config_name = None
self.launch_config_name = launch_config
if launch_config and isinstance(launch_config, LaunchConfiguration):
self.launch_config_name = launch_config.name
self.desired_capacity = desired_capacity
lbs = load_balancers or []
self.load_balancers = ListElement(lbs)
Expand Down
2 changes: 1 addition & 1 deletion boto/ec2/autoscale/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def endElement(self, name, value, connection):
if name == 'PolicyName':
self.name = value
elif name == 'AutoScalingGroupName':
self.group_name = value
self.as_name = value
elif name == 'PolicyARN':
self.policy_arn = value
elif name == 'ScalingAdjustment':
Expand Down

0 comments on commit 370bdf2

Please sign in to comment.