diff --git a/armada/exceptions/tiller_exceptions.py b/armada/exceptions/tiller_exceptions.py index b6e67004..47a0eea1 100644 --- a/armada/exceptions/tiller_exceptions.py +++ b/armada/exceptions/tiller_exceptions.py @@ -87,16 +87,6 @@ class PreUpdateJobDeleteException(TillerException): super(PreUpdateJobDeleteException, self).__init__(message) -class PreUpdateJobCreateException(TillerException): - '''Exception that occurs when a job creation fails.''' - - def __init__(self, name, namespace): - - message = 'Failed to create k8s job {} in {}'.format(name, namespace) - - super(PreUpdateJobCreateException, self).__init__(message) - - class ReleaseException(TillerException): ''' Exception that occurs when a release fails to install, upgrade, delete, diff --git a/armada/handlers/k8s.py b/armada/handlers/k8s.py index c81209e0..fa82167f 100644 --- a/armada/handlers/k8s.py +++ b/armada/handlers/k8s.py @@ -162,14 +162,6 @@ class K8s(object): "Exception getting cron jobs: namespace=%s, label=%s: %s", namespace, label_selector, e) - def create_job_action(self, name, namespace="default"): - ''' - :param name: name of the job - :param namespace: name of pod that job - ''' - # TODO(MarshM) this does nothing? - LOG.debug(" %s in namespace: %s", name, namespace) - def get_namespace_pod(self, namespace="default", label_selector=''): ''' :param namespace: namespace of the Pod @@ -181,17 +173,6 @@ class K8s(object): return self.client.list_namespaced_pod( namespace, label_selector=label_selector) - # TODO(MarshM) unused? - def get_all_pods(self, label_selector=''): - ''' - :param label_selector: filters Pods by label - - Returns a list of pods from all namespaces - ''' - - return self.client.list_pod_for_all_namespaces( - label_selector=label_selector) - def get_namespace_daemonset(self, namespace='default', label=''): ''' :param namespace: namespace of target deamonset diff --git a/armada/handlers/tiller.py b/armada/handlers/tiller.py index aa4d4d6d..5015dd83 100644 --- a/armada/handlers/tiller.py +++ b/armada/handlers/tiller.py @@ -271,33 +271,6 @@ class Tiller(object): LOG.warn("PRE: Could not delete anything, please check yaml") raise ex.PreUpdateJobDeleteException(name, namespace) - try: - for action in actions.get('create', []): - name = action.get("name") - action_type = action.get("type") - if "job" in action_type: - LOG.info("Creating %s in namespace: %s", name, namespace) - # TODO(MarshM) create_job_action does nothing but LOG.debug - self.k8s.create_job_action(name, action_type) - continue - except Exception: - LOG.warn("PRE: Could not create anything, please check yaml") - raise ex.PreUpdateJobCreateException(name, namespace) - - def _post_update_actions(self, actions, namespace): - try: - for action in actions.get('create', []): - name = action.get("name") - action_type = action.get("type") - if "job" in action_type: - LOG.info("Creating %s in namespace: %s", name, namespace) - # TODO(MarshM) create_job_action does nothing but LOG.debug - self.k8s.create_job_action(name, action_type) - continue - except Exception: - LOG.warn("POST: Could not create anything, please check yaml") - raise ex.PreUpdateJobCreateException(name, namespace) - def list_charts(self): ''' List Helm Charts from Latest Releases @@ -377,8 +350,6 @@ class Tiller(object): status = self.get_release_status(release) raise ex.ReleaseException(release, status, 'Upgrade') - self._post_update_actions(post_actions, namespace) - tiller_result = TillerResult( update_msg.release.name, update_msg.release.namespace, update_msg.release.info.status.Code.Name( diff --git a/armada/tests/unit/handlers/test_tiller.py b/armada/tests/unit/handlers/test_tiller.py index 6b7da5e1..fe8a5326 100644 --- a/armada/tests/unit/handlers/test_tiller.py +++ b/armada/tests/unit/handlers/test_tiller.py @@ -367,7 +367,6 @@ class TillerTestCase(base.ArmadaTestCase): # TODO: Test these methods as well, either by unmocking, or adding # separate tests for them. tiller_obj._pre_update_actions = MagicMock() - tiller_obj._post_update_actions = MagicMock() pre_actions = {} post_actions = {} @@ -393,8 +392,6 @@ class TillerTestCase(base.ArmadaTestCase): tiller_obj._pre_update_actions.assert_called_once_with( pre_actions, release, namespace, chart, disable_hooks, values, timeout) - tiller_obj._post_update_actions.assert_called_once_with( - post_actions, namespace) mock_update_release_request.assert_called_once_with( chart=chart,