api: Remove dry-run parameter

Armada's dry-run option is incomplete, no longer maintained, and offers
little value for the complexity required to maintain it.

This commit is the first in a series of changes to remove the dry-run
feature. Specifically, this change removes the parameter as an option
for the API.

Story: 2005121

Change-Id: If5bd2639fe3e9af3f4cc669cd627b47c1d8fec16
Signed-off-by: Drew Walters <andrew.walters@att.com>
This commit is contained in:
Drew Walters 2019-08-21 20:48:55 +00:00
parent 243022d16c
commit d6ad0e5e46
8 changed files with 8 additions and 34 deletions

View File

@ -118,7 +118,7 @@ class BaseResource(object):
self.log_error(ctx, log.ERROR, msg)
def get_tiller(self, req, resp):
return Tiller(dry_run=req.get_param_as_bool('dry_run'))
return Tiller()
class ArmadaRequestContext(object):

View File

@ -94,7 +94,6 @@ class Apply(api.BaseResource):
disable_update_pre=req.get_param_as_bool('disable_update_pre'),
disable_update_post=req.get_param_as_bool('disable_update_post'),
enable_chart_cleanup=req.get_param_as_bool('enable_chart_cleanup'),
dry_run=req.get_param_as_bool('dry_run'),
force_wait=req.get_param_as_bool('wait'),
timeout=req.get_param_as_int('timeout'),
tiller=tiller,

View File

@ -48,7 +48,6 @@ class Rollback(api.BaseResource):
@lock_and_thread()
def handle(self, req, release, tiller):
dry_run = req.get_param_as_bool('dry_run')
tiller.rollback_release(
release,
req.get_param_as_int('version') or 0,
@ -57,5 +56,4 @@ class Rollback(api.BaseResource):
force=req.get_param_as_bool('force'),
recreate_pods=req.get_param_as_bool('recreate_pods'))
return ('(dry run) ' if dry_run else '') + \
'Rollback of {} complete.'.format(release)
return 'Rollback of {} complete.'.format(release)

View File

@ -44,7 +44,6 @@ class ArmadaControllerTest(base.BaseControllerTest):
'disable_update_post': 'false',
'enable_chart_cleanup': 'false',
'skip_pre_flight': 'false',
'dry_run': 'false',
'wait': 'false',
'timeout': '100'
}
@ -56,7 +55,6 @@ class ArmadaControllerTest(base.BaseControllerTest):
'disable_update_pre': False,
'disable_update_post': False,
'enable_chart_cleanup': False,
'dry_run': False,
'force_wait': False,
'timeout': 100,
'tiller': m_tiller,
@ -89,7 +87,7 @@ class ArmadaControllerTest(base.BaseControllerTest):
}], **expected_armada_options)
mock_armada.return_value.sync.assert_called()
mock_tiller.assert_called_with(dry_run=False)
mock_tiller.assert_called()
m_tiller.__exit__.assert_called()
def test_armada_apply_no_href(self):
@ -103,7 +101,6 @@ class ArmadaControllerTest(base.BaseControllerTest):
'disable_update_post': 'false',
'enable_chart_cleanup': 'false',
'skip_pre_flight': 'false',
'dry_run': 'false',
'wait': 'false',
'timeout': '100'
}

View File

@ -38,7 +38,6 @@ class RollbackReleaseControllerTest(base.BaseControllerTest):
release = 'test-release'
version = '2'
dry_run = 'false'
wait = 'true'
timeout = '123'
force = 'true'
@ -47,7 +46,6 @@ class RollbackReleaseControllerTest(base.BaseControllerTest):
resp = self.app.simulate_post(
'/api/v1.0/rollback/{}'.format(release),
params={
'dry_run': dry_run,
'version': version,
'wait': wait,
'timeout': timeout,
@ -55,7 +53,7 @@ class RollbackReleaseControllerTest(base.BaseControllerTest):
'recreate_pods': recreate_pods
})
mock_tiller.assert_called_once_with(dry_run=False)
mock_tiller.assert_called_once()
rollback_release.assert_called_once_with(
release, 2, wait=True, timeout=123, force=True, recreate_pods=True)

View File

@ -45,7 +45,7 @@ class TillerControllerTest(base.BaseControllerTest):
self.assertEqual(expected, result.json)
self.assertEqual('application/json', result.headers['content-type'])
mock_tiller.assert_called_once_with(dry_run=None)
mock_tiller.assert_called_once()
m_tiller.__exit__.assert_called()
@mock.patch.object(api, 'Tiller')
@ -70,7 +70,7 @@ class TillerControllerTest(base.BaseControllerTest):
self.assertEqual(expected, result.json)
self.assertEqual('application/json', result.headers['content-type'])
mock_tiller.assert_called_once_with(dry_run=None)
mock_tiller.assert_called_once()
m_tiller.__exit__.assert_called()
@mock.patch.object(api, 'Tiller')
@ -100,7 +100,7 @@ class TillerControllerTest(base.BaseControllerTest):
}
self.assertEqual(expected, result.json)
mock_tiller.assert_called_once_with(dry_run=None)
mock_tiller.assert_called_once()
m_tiller.list_releases.assert_called_once_with()
m_tiller.__exit__.assert_called()
@ -132,7 +132,7 @@ class TillerControllerTest(base.BaseControllerTest):
}
self.assertEqual(expected, result.json)
mock_tiller.assert_called_once_with(dry_run=None)
mock_tiller.assert_called_once()
m_tiller.list_releases.assert_called_once_with()
m_tiller.__exit__.assert_called()

View File

@ -92,7 +92,6 @@ paths:
- $ref: "#/parameters/disable-update-pre"
- $ref: "#/parameters/disable-update-post"
- $ref: "#/parameters/enable-chart-cleanup"
- $ref: "#/parameters/dry-run"
- $ref: "#/parameters/wait"
- $ref: "#/parameters/timeout"
- name: request_body
@ -194,7 +193,6 @@ paths:
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
- $ref: "#/parameters/dry-run"
- $ref: "#/parameters/wait"
- $ref: "#/parameters/timeout"
- $ref: "#/parameters/force"
@ -287,13 +285,6 @@ parameters:
required: false
type: boolean
default: False
dry-run:
in: query
name: dry_run
required: false
type: boolean
description: Flag to simulate an action if set to True
default: False
wait:
in: query
name: wait

View File

@ -118,7 +118,6 @@ paths:
- $ref: "#/components/parameters/disable-update-pre"
- $ref: "#/components/parameters/disable-update-post"
- $ref: "#/components/parameters/enable-chart-cleanup"
- $ref: "#/components/parameters/dry-run"
- $ref: "#/components/parameters/wait"
- $ref: "#/components/parameters/timeout"
requestBody:
@ -219,7 +218,6 @@ paths:
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
- $ref: "#/components/parameters/dry-run"
- $ref: "#/components/parameters/wait"
- $ref: "#/components/parameters/timeout"
- $ref: "#/components/parameters/force"
@ -345,13 +343,6 @@ components:
description: Flag to test disabled tests
schema:
type: boolean
dry-run:
in: query
name: dry_run
required: false
description: Flag to simulate an install if set to True
schema:
type: boolean
timeout:
in: query
name: timeout