Removing dead code.
Change-Id: I7121a6d29691cf8d3e779f2afe9ada7d263c6c9d
This commit is contained in:
parent
cd0242780e
commit
c7c7dc671c
|
@ -87,16 +87,6 @@ class PreUpdateJobDeleteException(TillerException):
|
||||||
super(PreUpdateJobDeleteException, self).__init__(message)
|
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):
|
class ReleaseException(TillerException):
|
||||||
'''
|
'''
|
||||||
Exception that occurs when a release fails to install, upgrade, delete,
|
Exception that occurs when a release fails to install, upgrade, delete,
|
||||||
|
|
|
@ -162,14 +162,6 @@ class K8s(object):
|
||||||
"Exception getting cron jobs: namespace=%s, label=%s: %s",
|
"Exception getting cron jobs: namespace=%s, label=%s: %s",
|
||||||
namespace, label_selector, e)
|
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=''):
|
def get_namespace_pod(self, namespace="default", label_selector=''):
|
||||||
'''
|
'''
|
||||||
:param namespace: namespace of the Pod
|
:param namespace: namespace of the Pod
|
||||||
|
@ -181,17 +173,6 @@ class K8s(object):
|
||||||
return self.client.list_namespaced_pod(
|
return self.client.list_namespaced_pod(
|
||||||
namespace, label_selector=label_selector)
|
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=''):
|
def get_namespace_daemonset(self, namespace='default', label=''):
|
||||||
'''
|
'''
|
||||||
:param namespace: namespace of target deamonset
|
:param namespace: namespace of target deamonset
|
||||||
|
|
|
@ -271,33 +271,6 @@ class Tiller(object):
|
||||||
LOG.warn("PRE: Could not delete anything, please check yaml")
|
LOG.warn("PRE: Could not delete anything, please check yaml")
|
||||||
raise ex.PreUpdateJobDeleteException(name, namespace)
|
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):
|
def list_charts(self):
|
||||||
'''
|
'''
|
||||||
List Helm Charts from Latest Releases
|
List Helm Charts from Latest Releases
|
||||||
|
@ -377,8 +350,6 @@ class Tiller(object):
|
||||||
status = self.get_release_status(release)
|
status = self.get_release_status(release)
|
||||||
raise ex.ReleaseException(release, status, 'Upgrade')
|
raise ex.ReleaseException(release, status, 'Upgrade')
|
||||||
|
|
||||||
self._post_update_actions(post_actions, namespace)
|
|
||||||
|
|
||||||
tiller_result = TillerResult(
|
tiller_result = TillerResult(
|
||||||
update_msg.release.name, update_msg.release.namespace,
|
update_msg.release.name, update_msg.release.namespace,
|
||||||
update_msg.release.info.status.Code.Name(
|
update_msg.release.info.status.Code.Name(
|
||||||
|
|
|
@ -367,7 +367,6 @@ class TillerTestCase(base.ArmadaTestCase):
|
||||||
# TODO: Test these methods as well, either by unmocking, or adding
|
# TODO: Test these methods as well, either by unmocking, or adding
|
||||||
# separate tests for them.
|
# separate tests for them.
|
||||||
tiller_obj._pre_update_actions = MagicMock()
|
tiller_obj._pre_update_actions = MagicMock()
|
||||||
tiller_obj._post_update_actions = MagicMock()
|
|
||||||
|
|
||||||
pre_actions = {}
|
pre_actions = {}
|
||||||
post_actions = {}
|
post_actions = {}
|
||||||
|
@ -393,8 +392,6 @@ class TillerTestCase(base.ArmadaTestCase):
|
||||||
tiller_obj._pre_update_actions.assert_called_once_with(
|
tiller_obj._pre_update_actions.assert_called_once_with(
|
||||||
pre_actions, release, namespace, chart, disable_hooks, values,
|
pre_actions, release, namespace, chart, disable_hooks, values,
|
||||||
timeout)
|
timeout)
|
||||||
tiller_obj._post_update_actions.assert_called_once_with(
|
|
||||||
post_actions, namespace)
|
|
||||||
|
|
||||||
mock_update_release_request.assert_called_once_with(
|
mock_update_release_request.assert_called_once_with(
|
||||||
chart=chart,
|
chart=chart,
|
||||||
|
|
Loading…
Reference in New Issue