[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a

Garrett Holmstrom gholms at fedoraproject.org
Sun Jun 16 02:30:32 UTC 2013


The following commit has been merged in the master branch:
commit a6036b32aa1255920e4e9b5ed3075c6232031e11
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Thu Feb 28 17:13:02 2013 -0800

    Implement DescribeAutoScalingGroups
    
    Fixes TOOLS-204

diff --git a/bin/kilo-describe-auto-scaling-groups b/bin/kilo-describe-auto-scaling-groups
new file mode 100755
index 0000000..f88cb2b
--- /dev/null
+++ b/bin/kilo-describe-auto-scaling-groups
@@ -0,0 +1,6 @@
+#!/usr/bin/python -tt
+
+import euca2ools.commands.autoscaling.describeautoscalinggroups
+
+if __name__ == '__main__':
+    euca2ools.commands.autoscaling.describeautoscalinggroups.DescribeAutoScalingGroups.run()
diff --git a/euca2ools/commands/autoscaling/describeautoscalinggroups.py b/euca2ools/commands/autoscaling/describeautoscalinggroups.py
new file mode 100644
index 0000000..23d1431
--- /dev/null
+++ b/euca2ools/commands/autoscaling/describeautoscalinggroups.py
@@ -0,0 +1,86 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2013, Eucalyptus Systems, Inc.
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms, with or
+# without modification, are permitted provided that the following conditions
+# are met:
+#
+#   Redistributions of source code must retain the above
+#   copyright notice, this list of conditions and the
+#   following disclaimer.
+#
+#   Redistributions in binary form must reproduce the above
+#   copyright notice, this list of conditions and the
+#   following disclaimer in the documentation and/or other
+#   materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from euca2ools.commands.autoscaling import AutoScalingRequest
+from requestbuilder import Arg
+from requestbuilder.mixins import TabifyingCommand
+from requestbuilder.response import PaginatedResponse
+
+class DescribeAutoScalingGroups(AutoScalingRequest, TabifyingCommand):
+    DESCRIPTION = 'Describe auto-scaling groups'
+    ARGS = [Arg('AutoScalingGroupNames.member', metavar='ASGROUP',
+                nargs='*',
+                help='limit results to specific auto-scaling groups'),
+            Arg('--show-long', action='store_true', route_to=None,
+                help="show all of the groups' info")]
+    LIST_MARKERS = ['AutoScalingGroups', 'AvailabilityZones',
+                    'EnabledMetrics', 'Instances', 'LoadBalancerNames',
+                    'SuspendedProcesses', 'Tags', 'TerminationPolicies']
+
+    def main(self):
+        return PaginatedResponse(self, (None,), ('AutoScalingGroups',))
+
+    def prepare_for_page(self, page):
+        # Pages are defined by NextToken
+        self.params['NextToken'] = page
+
+    def get_next_page(self, response):
+        return response.get('NextToken') or None
+
+    def print_result(self, result):
+        for group in result.get('AutoScalingGroups', []):
+            bits = ['AUTO-SCALING-GROUP']
+            bits.append(group.get('AutoScalingGroupName'))
+            bits.append(group.get('LaunchConfigurationName'))
+            bits.append(','.join(group.get('AvailabilityZones')))
+            if self.args['show_long']:
+                bits.append(group.get('CreatedTime'))
+            balancers = group.get('LoadBalancerNames')
+            if balancers:
+                bits.append(','.join(balancers))
+            else:
+                bits.append(None)
+            if self.args['show_long']:
+                bits.append(group.get('HealthCheckType'))
+            bits.append(group.get('MinSize'))
+            bits.append(group.get('MaxSize'))
+            bits.append(group.get('DesiredCapacity'))
+            if self.args['show_long']:
+                bits.append(group.get('DefaultCooldown'))
+                bits.append(group.get('HealthCheckGracePeriod'))
+                bits.append(group.get('VPCZoneIdentifier'))
+                bits.append(group.get('PlacementGroup'))
+                bits.append(group.get('AutoScalingGroupARN'))
+            policies = group.get('TerminationPolicies')
+            if policies:
+                bits.append(','.join(policies))
+            else:
+                bits.append(None)
+            print self.tabify(bits)

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list