You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by ma...@apache.org on 2014/12/05 18:05:44 UTC
incubator-aurora git commit: Make abstract method annotations on
ConfigurationPlugin effective.
Repository: incubator-aurora
Updated Branches:
refs/heads/master 905137f83 -> 627ce1c2a
Make abstract method annotations on ConfigurationPlugin effective.
Reviewed at https://reviews.apache.org/r/28693/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/627ce1c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/627ce1c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/627ce1c2
Branch: refs/heads/master
Commit: 627ce1c2a39c4ae2e1a991ba2fd153e14fa73893
Parents: 905137f
Author: Zameer Manji <zm...@twopensource.com>
Authored: Fri Dec 5 08:38:58 2014 -0800
Committer: Maxim Khutornenko <ma...@apache.org>
Committed: Fri Dec 5 08:38:58 2014 -0800
----------------------------------------------------------------------
.../python/apache/aurora/client/cli/__init__.py | 9 +++---
.../apache/aurora/client/cli/test_plugins.py | 29 --------------------
2 files changed, 5 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/627ce1c2/src/main/python/apache/aurora/client/cli/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/__init__.py b/src/main/python/apache/aurora/client/cli/__init__.py
index a12d789..a133ac0 100644
--- a/src/main/python/apache/aurora/client/cli/__init__.py
+++ b/src/main/python/apache/aurora/client/cli/__init__.py
@@ -154,7 +154,7 @@ class Context(object):
print_aurora_log(severity, msg, *args, **kwargs)
-class ConfigurationPlugin(object):
+class ConfigurationPlugin(AbstractClass):
"""A component that can be plugged in to a command-line to add new configuration options.
For example, if a production environment is protected behind some
@@ -171,15 +171,16 @@ class ConfigurationPlugin(object):
@abstractmethod
def get_options(self):
- """Return the set of options processed by this plugin"""
- return []
+ """Return the set of options processed by this plugin
+ This must return a list of CommandOption objects that represent the arguments for this plugin.
+ """
@abstractmethod
def before_dispatch(self, raw_args):
"""Run some code before dispatching to the client.
If a ConfigurationPlugin.Error exception is thrown, aborts the command execution.
+ This must return a list of arguments to pass to the remaining plugins and program.
"""
- return raw_args
@abstractmethod
def before_execution(self, context):
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/627ce1c2/src/test/python/apache/aurora/client/cli/test_plugins.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_plugins.py b/src/test/python/apache/aurora/client/cli/test_plugins.py
index 43765f2..a64759c 100644
--- a/src/test/python/apache/aurora/client/cli/test_plugins.py
+++ b/src/test/python/apache/aurora/client/cli/test_plugins.py
@@ -60,10 +60,6 @@ class BogusPlugin(ConfigurationPlugin):
raise self.Error("Oops")
-class EmptyPlugin(ConfigurationPlugin):
- pass
-
-
class TestPlugins(AuroraClientCommandTest):
@classmethod
@@ -149,31 +145,6 @@ class TestPlugins(AuroraClientCommandTest):
assert mock_context.bogosity == "maximum"
assert mock_context.after
- def test_empty_plugins_in_create_job(self):
- """Installs a plugin that doesn't implement any of the plugin methods.
- Prior to AURORA-362, this would cause the client to crash with an empty
- argument list.
- """
- mock_context = FakeAuroraCommandContext()
- with patch('apache.aurora.client.cli.jobs.Job.create_context', return_value=mock_context):
- mock_query = self.create_mock_query()
- mock_context.add_expected_status_query_result(
- self.create_mock_status_query_result(ScheduleStatus.INIT))
- mock_context.add_expected_status_query_result(
- self.create_mock_status_query_result(ScheduleStatus.RUNNING))
- api = mock_context.get_api('west')
- api.create_job.return_value = self.get_createjob_response()
-
- with temporary_file() as fp:
- fp.write(self.get_valid_config())
- fp.flush()
- cmd = AuroraCommandLine()
- cmd.register_plugin(EmptyPlugin())
- cmd.execute(['job', 'create', '--wait-until=RUNNING',
- 'west/bozo/test/hello', fp.name])
- self.assert_create_job_called(api)
- self.assert_scheduler_called(api, mock_query, 1)
-
def mock_print(self, str):
for str in str.split('\n'):
self.transcript.append(str)