[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:44 UTC 2013


The following commit has been merged in the master branch:
commit 0f48855686fd644ad3e332b316c862bb78daee7c
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Tue Mar 19 18:53:22 2013 -0700

    Implement DescribeAlarmHistory
    
    Fixes TOOLS-258

diff --git a/bin/euwatch-describe-alarm-history b/bin/euwatch-describe-alarm-history
new file mode 100755
index 0000000..b395d86
--- /dev/null
+++ b/bin/euwatch-describe-alarm-history
@@ -0,0 +1,6 @@
+#!/usr/bin/python -tt
+
+import euca2ools.commands.monitoring.describealarmhistory
+
+if __name__ == '__main__':
+    euca2ools.commands.monitoring.describealarmhistory.DescribeAlarmHistory.run()
diff --git a/euca2ools/commands/autoscaling/describepolicies.py b/euca2ools/commands/monitoring/describealarmhistory.py
similarity index 60%
copy from euca2ools/commands/autoscaling/describepolicies.py
copy to euca2ools/commands/monitoring/describealarmhistory.py
index 9cff37c..f0dbf16 100644
--- a/euca2ools/commands/autoscaling/describepolicies.py
+++ b/euca2ools/commands/monitoring/describealarmhistory.py
@@ -28,42 +28,41 @@
 # 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
+import argparse
+from euca2ools.commands.monitoring import CloudWatchRequest
 from requestbuilder import Arg
 from requestbuilder.mixins import TabifyingCommand
 from requestbuilder.response import PaginatedResponse
 
 
-class DescribePolicies(AutoScalingRequest, TabifyingCommand):
-    DESCRIPTION = 'Describe auto-scaling policies'
-    ARGS = [Arg('PolicyNames.member', metavar='POLICY', nargs='*',
-                help='limit results to specific auto-scaling policies'),
-            Arg('-g', '--auto-scaling-group', dest='AutoScalingGroupName',
-                metavar='ASGROUP'),
+class DescribeAlarmHistory(CloudWatchRequest, TabifyingCommand):
+    DESCRIPTION = 'Retrieve history for one alarm or all alarms'
+    ARGS = [Arg('AlarmName', metavar='ALARM', nargs='?',
+                help='limit results to a specific alarm'),
+            Arg('--end-date', dest='EndDate', metavar='DATE',
+                help='limit results to history before a given point in time'),
+            Arg('--history-item-type', dest='HistoryItemType',
+                choices=('Action', 'ConfigurationUpdate', 'StateUpdate'),
+                help='limit results to specific history item types'),
             Arg('--show-long', action='store_true', route_to=None,
-                help="show all of the policies' info")]
-    LIST_TAGS = ['ScalingPolicies', 'Alarms']
+                help='show detailed event data as machine-readable JSON'),
+            Arg('--start-date', dest='StartDate', metavar='DATE',
+                help='limit results to history after a given point in time')]
+    LIST_TAGS = ['AlarmHistoryItems']
 
     def main(self):
-        return PaginatedResponse(self, (None,), ('ScalingPolicies',))
+        return PaginatedResponse(self, (None,), ('AlarmHistoryItems,'))
 
     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 policy in result.get('ScalingPolicies', []):
-            bits = ['SCALING-POLICY']
-            bits.append(policy.get('AutoScalingGroupName'))
-            bits.append(policy.get('PolicyName'))
-            bits.append(policy.get('ScalingAdjustment'))
+        for item in result.get('AlarmHistoryItems', []):
+            bits = [item.get('AlarmName'), item.get('Timestamp'),
+                    item.get('HistoryItemType'), item.get('HistorySummary')]
             if self.args['show_long']:
-                bits.append(policy.get('MinAdjustmentStep'))
-            bits.append(policy.get('AdjustmentType'))
-            if self.args['show_long']:
-                bits.append(policy.get('Cooldown'))
-            bits.append(policy.get('PolicyARN'))
+                bits.append(item.get('HistoryData'))
             print self.tabify(bits)

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list