| Index: third_party/gsutil/boto/boto/ec2/autoscale/group.py
|
| diff --git a/third_party/gsutil/20110627/boto/boto/ec2/autoscale/group.py b/third_party/gsutil/boto/boto/ec2/autoscale/group.py
|
| similarity index 83%
|
| rename from third_party/gsutil/20110627/boto/boto/ec2/autoscale/group.py
|
| rename to third_party/gsutil/boto/boto/ec2/autoscale/group.py
|
| index 639a4116b811102d01fca4a8c86184797705a48e..ab303d33b873887f73131f41af20fde1ee503ea7 100644
|
| --- a/third_party/gsutil/20110627/boto/boto/ec2/autoscale/group.py
|
| +++ b/third_party/gsutil/boto/boto/ec2/autoscale/group.py
|
| @@ -19,13 +19,12 @@
|
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| # IN THE SOFTWARE.
|
|
|
| -
|
| 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
|
| -
|
| +from boto.ec2.autoscale.tag import Tag
|
|
|
| class ProcessType(object):
|
| def __init__(self, connection=None):
|
| @@ -86,8 +85,8 @@ class AutoScalingGroup(object):
|
| launch_config=None, availability_zones=None,
|
| load_balancers=None, default_cooldown=None,
|
| health_check_type=None, health_check_period=None,
|
| - placement_group=None, vpc_zone_identifier=None, desired_capacity=None,
|
| - min_size=None, max_size=None, **kwargs):
|
| + placement_group=None, vpc_zone_identifier=None,
|
| + desired_capacity=None, min_size=None, max_size=None, **kwargs):
|
| """
|
| Creates a new AutoScalingGroup with the specified name.
|
|
|
| @@ -103,25 +102,24 @@ class AutoScalingGroup(object):
|
| :param availability_zones: List of availability zones (required).
|
|
|
| :type default_cooldown: int
|
| - :param default_cooldown: Number of seconds after a Scaling Activity completes
|
| - before any further scaling activities can start.
|
| + :param default_cooldown: Number of seconds after a Scaling Activity
|
| + completes before any further scaling activities can start.
|
|
|
| :type desired_capacity: int
|
| :param desired_capacity: The desired capacity for the group.
|
|
|
| :type health_check_period: str
|
| - :param health_check_period: Length of time in seconds after a new EC2 instance
|
| - comes into service that Auto Scaling starts checking its
|
| - health.
|
| + :param health_check_period: Length of time in seconds after a new
|
| + EC2 instance comes into service that Auto Scaling starts
|
| + checking its health.
|
|
|
| :type health_check_type: str
|
| :param health_check_type: The service you want the health status from,
|
| - Amazon EC2 or Elastic Load Balancer.
|
| + Amazon EC2 or Elastic Load Balancer.
|
|
|
| :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.
|
|
|
| @@ -133,11 +131,12 @@ class AutoScalingGroup(object):
|
|
|
| :type placement_group: str
|
| :param placement_group: Physical location of your cluster placement
|
| - group created in Amazon EC2.
|
| + group created in Amazon EC2.
|
|
|
| :type vpc_zone_identifier: str
|
| - :param vpc_zone_identifier: The subnet identifier of the Virtual Private Cloud.
|
| -
|
| + :param vpc_zone_identifier: The subnet identifier of the Virtual
|
| + Private Cloud.
|
| +
|
| :rtype: :class:`boto.ec2.autoscale.group.AutoScalingGroup`
|
| :return: An autoscale group.
|
| """
|
| @@ -146,8 +145,11 @@ class AutoScalingGroup(object):
|
| self.min_size = int(min_size) if min_size is not None else None
|
| self.max_size = int(max_size) if max_size is not None else 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
|
| + # backwards compatibility
|
| + default_cooldown = default_cooldown or kwargs.get('cooldown')
|
| + if default_cooldown is not None:
|
| + default_cooldown = int(default_cooldown)
|
| + self.default_cooldown = default_cooldown
|
| self.launch_config_name = launch_config
|
| if launch_config and isinstance(launch_config, LaunchConfiguration):
|
| self.launch_config_name = launch_config.name
|
| @@ -162,20 +164,19 @@ class AutoScalingGroup(object):
|
| self.autoscaling_group_arn = None
|
| self.vpc_zone_identifier = vpc_zone_identifier
|
| self.instances = None
|
| + self.tags = None
|
|
|
| # backwards compatible access to 'cooldown' param
|
| def _get_cooldown(self):
|
| return self.default_cooldown
|
| +
|
| def _set_cooldown(self, val):
|
| self.default_cooldown = val
|
| +
|
| cooldown = property(_get_cooldown, _set_cooldown)
|
|
|
| def __repr__(self):
|
| - return 'AutoScalingGroup<%s>: created:%s, minsize:%s, maxsize:%s, capacity:%s' % (self.name,
|
| - self.created_time,
|
| - self.min_size,
|
| - self.max_size,
|
| - self.desired_capacity)
|
| + return 'AutoScaleGroup<%s>' % self.name
|
|
|
| def startElement(self, name, attrs, connection):
|
| if name == 'Instances':
|
| @@ -191,6 +192,9 @@ class AutoScalingGroup(object):
|
| elif name == 'SuspendedProcesses':
|
| self.suspended_processes = ResultSet([('member', SuspendedProcess)])
|
| return self.suspended_processes
|
| + elif name == 'Tags':
|
| + self.tags = ResultSet([('member', Tag)])
|
| + return self.tags
|
| else:
|
| return
|
|
|
| @@ -214,7 +218,10 @@ class AutoScalingGroup(object):
|
| elif name == 'PlacementGroup':
|
| self.placement_group = value
|
| elif name == 'HealthCheckGracePeriod':
|
| - self.health_check_period = int(value)
|
| + try:
|
| + self.health_check_period = int(value)
|
| + except ValueError:
|
| + self.health_check_period = None
|
| elif name == 'HealthCheckType':
|
| self.health_check_type = value
|
| elif name == 'VPCZoneIdentifier':
|
| @@ -223,22 +230,25 @@ class AutoScalingGroup(object):
|
| setattr(self, name, value)
|
|
|
| def set_capacity(self, capacity):
|
| - """ Set the desired capacity for the group. """
|
| - params = {
|
| - 'AutoScalingGroupName' : self.name,
|
| - 'DesiredCapacity' : capacity,
|
| - }
|
| + """
|
| + Set the desired capacity for the group.
|
| + """
|
| + params = {'AutoScalingGroupName' : self.name,
|
| + 'DesiredCapacity' : capacity}
|
| req = self.connection.get_object('SetDesiredCapacity', params,
|
| - Request)
|
| + Request)
|
| self.connection.last_request = req
|
| return req
|
|
|
| def update(self):
|
| - """ Sync local changes with AutoScaling group. """
|
| + """
|
| + Sync local changes with AutoScaling group.
|
| + """
|
| return self.connection._update_group('UpdateAutoScalingGroup', self)
|
|
|
| def shutdown_instances(self):
|
| - """ Convenience method which shuts down all instances associated with
|
| + """
|
| + Convenience method which shuts down all instances associated with
|
| this group.
|
| """
|
| self.min_size = 0
|
| @@ -246,24 +256,30 @@ class AutoScalingGroup(object):
|
| self.desired_capacity = 0
|
| self.update()
|
|
|
| - def delete(self):
|
| - """ Delete this auto-scaling group if no instances attached or no
|
| + def delete(self, force_delete=False):
|
| + """
|
| + Delete this auto-scaling group if no instances attached or no
|
| scaling activities in progress.
|
| """
|
| - return self.connection.delete_auto_scaling_group(self.name)
|
| + return self.connection.delete_auto_scaling_group(self.name, force_delete)
|
|
|
| def get_activities(self, activity_ids=None, max_records=50):
|
| """
|
| Get all activies for this group.
|
| """
|
| - return self.connection.get_all_activities(self, activity_ids, max_records)
|
| + return self.connection.get_all_activities(self, activity_ids,
|
| + max_records)
|
|
|
| def suspend_processes(self, scaling_processes=None):
|
| - """ Suspends Auto Scaling processes for an Auto Scaling group. """
|
| + """
|
| + Suspends Auto Scaling processes for an Auto Scaling group.
|
| + """
|
| return self.connection.suspend_processes(self.name, scaling_processes)
|
|
|
| def resume_processes(self, scaling_processes=None):
|
| - """ Resumes Auto Scaling processes for an Auto Scaling group. """
|
| + """
|
| + Resumes Auto Scaling processes for an Auto Scaling group.
|
| + """
|
| return self.connection.resume_processes(self.name, scaling_processes)
|
|
|
|
|
|
|