aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Fix error listing active updates.
Date Fri, 20 Mar 2015 02:26:29 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 0214e708b -> db7941892


Fix error listing active updates.

Reviewed at https://reviews.apache.org/r/32276/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/db794189
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/db794189
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/db794189

Branch: refs/heads/master
Commit: db7941892bd1cb49ca4479153117fbe19876607c
Parents: 0214e70
Author: Bill Farner <wfarner@apache.org>
Authored: Thu Mar 19 19:22:12 2015 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Thu Mar 19 19:22:12 2015 -0700

----------------------------------------------------------------------
 .../python/apache/aurora/client/cli/update.py   | 22 ++++++++------------
 .../apache/aurora/client/cli/test_supdate.py    |  8 ++-----
 2 files changed, 11 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/db794189/src/main/python/apache/aurora/client/cli/update.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/update.py b/src/main/python/apache/aurora/client/cli/update.py
index 2168e99..830ef44 100644
--- a/src/main/python/apache/aurora/client/cli/update.py
+++ b/src/main/python/apache/aurora/client/cli/update.py
@@ -246,14 +246,14 @@ class ListUpdates(Verb):
 
   STATUS_GROUPS = dict({
       'active': ACTIVE_JOB_UPDATE_STATES,
-      'all': JobUpdateStatus._VALUES_TO_NAMES.keys(),
-      'blocked': [
-          JobUpdateStatus.ROLL_FORWARD_AWAITING_PULSE, JobUpdateStatus.ROLL_BACK_AWAITING_PULSE],
-      'failed': [JobUpdateStatus.ERROR, JobUpdateStatus.FAILED, JobUpdateStatus.ROLLED_BACK],
-      'inactive': list(set(JobUpdateStatus._VALUES_TO_NAMES.keys()) - ACTIVE_JOB_UPDATE_STATES),
-      'paused': [JobUpdateStatus.ROLL_FORWARD_PAUSED, JobUpdateStatus.ROLL_BACK_PAUSED],
-      'succeeded': JobUpdateStatus.ROLLED_FORWARD,
-  }.items() + JobUpdateStatus._NAMES_TO_VALUES.items())
+      'all': set(JobUpdateStatus._VALUES_TO_NAMES.keys()),
+      'blocked': {
+          JobUpdateStatus.ROLL_FORWARD_AWAITING_PULSE, JobUpdateStatus.ROLL_BACK_AWAITING_PULSE},
+      'failed': {JobUpdateStatus.ERROR, JobUpdateStatus.FAILED, JobUpdateStatus.ROLLED_BACK},
+      'inactive': set(JobUpdateStatus._VALUES_TO_NAMES.keys()) - ACTIVE_JOB_UPDATE_STATES,
+      'paused': {JobUpdateStatus.ROLL_FORWARD_PAUSED, JobUpdateStatus.ROLL_BACK_PAUSED},
+      'succeeded': {JobUpdateStatus.ROLLED_FORWARD},
+  }.items() + [(k, {v}) for k, v in JobUpdateStatus._NAMES_TO_VALUES.items()])
 
   def get_options(self):
     return [
@@ -308,11 +308,7 @@ updates matching any of the specified statuses will be included."""),
 
     filter_statuses = set()
     for status in context.options.status:
-      group = self.STATUS_GROUPS[status]
-      if isinstance(group, list):
-        filter_statuses = filter_statuses.union(set(group))
-      else:
-        filter_statuses.add(group)
+      filter_statuses = filter_statuses.union(set(self.STATUS_GROUPS[status]))
 
     response = api.query_job_updates(
         role=update_filter.role if job_key is None else None,

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/db794189/src/test/python/apache/aurora/client/cli/test_supdate.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_supdate.py b/src/test/python/apache/aurora/client/cli/test_supdate.py
index df072e9..f9acbdf 100644
--- a/src/test/python/apache/aurora/client/cli/test_supdate.py
+++ b/src/test/python/apache/aurora/client/cli/test_supdate.py
@@ -167,7 +167,7 @@ west/bozo/test/hello                            update_id
   me          1970-01-17T08:03:24 1970-06-13T08:34:16"""
 
   def test_list_updates_by_status(self):
-    self._mock_options.status = ['paused', 'ROLLING_FORWARD']
+    self._mock_options.status = ListUpdates.STATUS_GROUPS.keys()
     self._mock_api.query_job_updates.return_value = get_status_query_response(count=3)
     assert self._command.execute(self._fake_context) == EXIT_OK
     assert self._mock_api.query_job_updates.mock_calls == [
@@ -175,11 +175,7 @@ west/bozo/test/hello                            update_id
           role=None,
           user=None,
           job_key=None,
-          update_statuses=set([
-              JobUpdateStatus.ROLL_FORWARD_PAUSED,
-              JobUpdateStatus.ROLL_BACK_PAUSED,
-              JobUpdateStatus.ROLLING_FORWARD
-          ]))
+          update_statuses=set(JobUpdateStatus._VALUES_TO_NAMES.keys()))
     ]
 
   def test_list_updates_by_env(self):


Mime
View raw message