You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by dm...@apache.org on 2014/11/14 22:38:28 UTC

incubator-aurora git commit: Show update page URL in the output for beta-update start.

Repository: incubator-aurora
Updated Branches:
  refs/heads/master 489e3de70 -> 2450a1e22


Show update page URL in the output for beta-update start.

Bugs closed: AURORA-766

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


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

Branch: refs/heads/master
Commit: 2450a1e221facf63dac3affa4bdf35f4909d2b84
Parents: 489e3de
Author: David McLaughlin <da...@dmclaughlin.com>
Authored: Fri Nov 14 13:38:08 2014 -0800
Committer: David McLaughlin <da...@dmclaughlin.com>
Committed: Fri Nov 14 13:38:08 2014 -0800

----------------------------------------------------------------------
 src/main/python/apache/aurora/client/cli/context.py      | 3 +++
 src/main/python/apache/aurora/client/cli/update.py       | 6 +++++-
 src/test/python/apache/aurora/client/cli/test_supdate.py | 5 ++++-
 3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2450a1e2/src/main/python/apache/aurora/client/cli/context.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/context.py b/src/main/python/apache/aurora/client/cli/context.py
index df9dc24..96c386e 100644
--- a/src/main/python/apache/aurora/client/cli/context.py
+++ b/src/main/python/apache/aurora/client/cli/context.py
@@ -123,6 +123,9 @@ class AuroraCommandContext(Context):
     return synthesize_url(api.scheduler_proxy.scheduler_client().url, jobkey.role,
         jobkey.env, jobkey.name)
 
+  def get_update_page(self, api, jobkey, update_id):
+    return "%s/%s" % (self.get_job_page(api, jobkey), update_id)
+
   def open_scheduler_page(self, cluster, role, env, name):
     """Open a scheduler page"""
     api = self.get_api(cluster)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2450a1e2/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 3076392..12774af 100644
--- a/src/main/python/apache/aurora/client/cli/update.py
+++ b/src/main/python/apache/aurora/client/cli/update.py
@@ -39,6 +39,9 @@ from gen.apache.aurora.api.ttypes import JobUpdateAction, JobUpdateStatus
 
 
 class StartUpdate(Verb):
+
+  UPDATE_MSG_TEMPLATE = "Job update has started. View your update progress at %s"
+
   @property
   def name(self):
     return 'start'
@@ -77,7 +80,8 @@ class StartUpdate(Verb):
         err_msg="Failed to start update due to error:")
 
     if resp.result:
-      context.print_out("Job update has started.")
+      url = context.get_update_page(api, job, resp.result.startJobUpdateResult.updateId)
+      context.print_out(self.UPDATE_MSG_TEMPLATE % url)
     else:
       context.print_out_response_details(resp)
     return EXIT_OK

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2450a1e2/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 97a9664..7637352 100644
--- a/src/test/python/apache/aurora/client/cli/test_supdate.py
+++ b/src/test/python/apache/aurora/client/cli/test_supdate.py
@@ -92,11 +92,14 @@ class TestUpdateCommand(AuroraClientCommandTest):
         result = cmd.execute(['beta-update', 'start', self.TEST_JOBSPEC, fp.name])
         assert result == EXIT_OK
 
+      update_url_msg = StartUpdate.UPDATE_MSG_TEMPLATE % (
+          mock_context.get_update_page(mock_api, AuroraJobKey.from_path(self.TEST_JOBSPEC), "id"))
+
       assert mock_api.start_job_update.call_count == 1
       args, kwargs = mock_api.start_job_update.call_args
       assert isinstance(args[0], AuroraConfig)
       assert args[1] is None
-      assert mock_context.get_out() == ["Job update has started."]
+      assert mock_context.get_out() == [update_url_msg]
       assert mock_context.get_err() == []
 
   def test_start_update_command_line_succeeds_noop_update(self):