diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py index a8faecd486..3466479dbd 100644 --- a/magnum/api/controllers/v1/bay.py +++ b/magnum/api/controllers/v1/bay.py @@ -463,8 +463,8 @@ class BaysController(base.Controller): @base.Controller.api_version("1.3") # noqa @wsme.validate(types.uuid, bool, [BayPatchType]) - @expose.expose(BayID, types.uuid_or_name, bool, body=[BayPatchType], - status_code=202) + @expose.expose(BayID, types.uuid_or_name, types.boolean, + body=[BayPatchType], status_code=202) def patch(self, bay_ident, rollback=False, patch=None): """Update an existing bay. diff --git a/magnum/api/controllers/v1/cluster.py b/magnum/api/controllers/v1/cluster.py index e6ad47f44d..d36954c4bd 100644 --- a/magnum/api/controllers/v1/cluster.py +++ b/magnum/api/controllers/v1/cluster.py @@ -435,7 +435,7 @@ class ClustersController(base.Controller): @base.Controller.api_version("1.3") # noqa @wsme.validate(types.uuid, bool, [ClusterPatchType]) - @expose.expose(ClusterID, types.uuid_or_name, bool, + @expose.expose(ClusterID, types.uuid_or_name, types.boolean, body=[ClusterPatchType], status_code=202) def patch(self, cluster_ident, rollback=False, patch=None): """Update an existing Cluster. diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster.py b/magnum/tests/unit/api/controllers/v1/test_cluster.py index aab217dd60..a2cabacd94 100644 --- a/magnum/tests/unit/api/controllers/v1/test_cluster.py +++ b/magnum/tests/unit/api/controllers/v1/test_cluster.py @@ -412,6 +412,26 @@ class TestPatch(api_base.FunctionalTest): self.assertEqual(400, response.status_int) self.assertTrue(response.json['errors']) + def test_update_cluster_with_rollback_enabled(self): + response = self.patch_json( + '/clusters/%s/?rollback=True' % self.cluster_obj.uuid, + [{'path': '/node_count', 'value': 4, + 'op': 'replace'}], + headers={'OpenStack-API-Version': 'container-infra 1.3'}) + + self.mock_cluster_update.assert_called_once_with(mock.ANY, True) + self.assertEqual(202, response.status_code) + + def test_update_cluster_with_rollback_disabled(self): + response = self.patch_json( + '/clusters/%s/?rollback=False' % self.cluster_obj.uuid, + [{'path': '/node_count', 'value': 4, + 'op': 'replace'}], + headers={'OpenStack-API-Version': 'container-infra 1.3'}) + + self.mock_cluster_update.assert_called_once_with(mock.ANY, False) + self.assertEqual(202, response.status_code) + def test_remove_ok(self): response = self.get_json('/clusters/%s' % self.cluster_obj.uuid) self.assertIsNotNone(response['name'])