{"sha":"d3948706a3ff28d0160157f76f1e18244a8dad5c","node_id":"C_kwDOAGpalNoAKGQzOTQ4NzA2YTNmZjI4ZDAxNjAxNTdmNzZmMWUxODI0NGE4ZGFkNWM","commit":{"author":{"name":"Tobias Urdin","email":"tobias.urdin@binero.se","date":"2022-11-28T15:12:13Z"},"committer":{"name":"Tobias Urdin","email":"tobias.urdin@binero.com","date":"2024-01-19T09:42:42Z"},"message":"Return HTTPBadRequest from circular dependency\n\nWe don't map the CircularDependencyException to\na 400 Bad Request in the fault middleware so users\ncan never get an understand of what is wrong in\ntheir template. They are today instead present\nwith a 500 internal server error without details\nwhich doesn't help them.\n\nChange-Id: Idc8713b4c29e2534dd7059e4566ac3b777f418e5\n(cherry picked from commit c13f911ba69569e0ad9c24befa3b22a59247c7ae)","tree":{"sha":"f12b4a58c589a2b76b02eae57d3182ea003c5106","url":"https://api.github.com/repos/openstack/heat/git/trees/f12b4a58c589a2b76b02eae57d3182ea003c5106"},"url":"https://api.github.com/repos/openstack/heat/git/commits/d3948706a3ff28d0160157f76f1e18244a8dad5c","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}},"url":"https://api.github.com/repos/openstack/heat/commits/d3948706a3ff28d0160157f76f1e18244a8dad5c","html_url":"https://github.com/openstack/heat/commit/d3948706a3ff28d0160157f76f1e18244a8dad5c","comments_url":"https://api.github.com/repos/openstack/heat/commits/d3948706a3ff28d0160157f76f1e18244a8dad5c/comments","author":{"login":"tobias-urdin","id":14872193,"node_id":"MDQ6VXNlcjE0ODcyMTkz","avatar_url":"https://avatars.githubusercontent.com/u/14872193?v=4","gravatar_id":"","url":"https://api.github.com/users/tobias-urdin","html_url":"https://github.com/tobias-urdin","followers_url":"https://api.github.com/users/tobias-urdin/followers","following_url":"https://api.github.com/users/tobias-urdin/following{/other_user}","gists_url":"https://api.github.com/users/tobias-urdin/gists{/gist_id}","starred_url":"https://api.github.com/users/tobias-urdin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobias-urdin/subscriptions","organizations_url":"https://api.github.com/users/tobias-urdin/orgs","repos_url":"https://api.github.com/users/tobias-urdin/repos","events_url":"https://api.github.com/users/tobias-urdin/events{/privacy}","received_events_url":"https://api.github.com/users/tobias-urdin/received_events","type":"User","user_view_type":"public","site_admin":false},"committer":{"login":"tobias-urdin","id":14872193,"node_id":"MDQ6VXNlcjE0ODcyMTkz","avatar_url":"https://avatars.githubusercontent.com/u/14872193?v=4","gravatar_id":"","url":"https://api.github.com/users/tobias-urdin","html_url":"https://github.com/tobias-urdin","followers_url":"https://api.github.com/users/tobias-urdin/followers","following_url":"https://api.github.com/users/tobias-urdin/following{/other_user}","gists_url":"https://api.github.com/users/tobias-urdin/gists{/gist_id}","starred_url":"https://api.github.com/users/tobias-urdin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobias-urdin/subscriptions","organizations_url":"https://api.github.com/users/tobias-urdin/orgs","repos_url":"https://api.github.com/users/tobias-urdin/repos","events_url":"https://api.github.com/users/tobias-urdin/events{/privacy}","received_events_url":"https://api.github.com/users/tobias-urdin/received_events","type":"User","user_view_type":"public","site_admin":false},"parents":[{"sha":"c73cf918cb040045f2bcc1d21896003183a6f5ee","url":"https://api.github.com/repos/openstack/heat/commits/c73cf918cb040045f2bcc1d21896003183a6f5ee","html_url":"https://github.com/openstack/heat/commit/c73cf918cb040045f2bcc1d21896003183a6f5ee"}],"stats":{"total":50,"additions":49,"deletions":1},"files":[{"sha":"b6ed0f28e99547fc357ddf0338ad29ecfa25788a","filename":"heat/api/middleware/fault.py","status":"modified","additions":2,"deletions":1,"changes":3,"blob_url":"https://github.com/openstack/heat/blob/d3948706a3ff28d0160157f76f1e18244a8dad5c/heat%2Fapi%2Fmiddleware%2Ffault.py","raw_url":"https://github.com/openstack/heat/raw/d3948706a3ff28d0160157f76f1e18244a8dad5c/heat%2Fapi%2Fmiddleware%2Ffault.py","contents_url":"https://api.github.com/repos/openstack/heat/contents/heat%2Fapi%2Fmiddleware%2Ffault.py?ref=d3948706a3ff28d0160157f76f1e18244a8dad5c","patch":"@@ -93,7 +93,8 @@ class FaultWrapper(wsgi.Middleware):\n         'UnsupportedObjectError': webob.exc.HTTPBadRequest,\n         'ResourceTypeUnavailable': webob.exc.HTTPBadRequest,\n         'InvalidBreakPointHook': webob.exc.HTTPBadRequest,\n-        'ImmutableParameterModified': webob.exc.HTTPBadRequest\n+        'ImmutableParameterModified': webob.exc.HTTPBadRequest,\n+        'CircularDependencyException': webob.exc.HTTPBadRequest\n     }\n \n     def _map_exception_to_error(self, class_exception):"},{"sha":"ff0a57527c07008dc47cd6700b4e96fe5cbb2b90","filename":"heat/tests/api/openstack_v1/test_stacks.py","status":"modified","additions":47,"deletions":0,"changes":47,"blob_url":"https://github.com/openstack/heat/blob/d3948706a3ff28d0160157f76f1e18244a8dad5c/heat%2Ftests%2Fapi%2Fopenstack_v1%2Ftest_stacks.py","raw_url":"https://github.com/openstack/heat/raw/d3948706a3ff28d0160157f76f1e18244a8dad5c/heat%2Ftests%2Fapi%2Fopenstack_v1%2Ftest_stacks.py","contents_url":"https://api.github.com/repos/openstack/heat/contents/heat%2Ftests%2Fapi%2Fopenstack_v1%2Ftest_stacks.py?ref=d3948706a3ff28d0160157f76f1e18244a8dad5c","patch":"@@ -1212,6 +1212,53 @@ def test_create_err_stack_bad_reqest(self, mock_enforce):\n         self.assertEqual('HTTPBadRequest', resp.json['error']['type'])\n         self.assertIsNotNone(resp.json['error']['traceback'])\n \n+    def test_create_err_circulardep(self, mock_enforce):\n+        self._mock_enforce_setup(mock_enforce, 'create', True)\n+        stack_name = \"foobar\"\n+        template = {u'Foo': u'bar'}\n+        body = {'template': template,\n+                'stack_name': stack_name,\n+                'parameters': {},\n+                'timeout_mins': 30}\n+\n+        req = self._post('/stacks', json.dumps(body))\n+\n+        error = heat_exc.CircularDependencyException(cycle='some data')\n+        mock_call = self.patchobject(rpc_client.EngineClient, 'call',\n+                                     side_effect=tools.to_remote_error(error))\n+\n+        resp = tools.request_with_middleware(fault.FaultWrapper,\n+                                             self.controller.create,\n+                                             req, tenant_id=self.tenant,\n+                                             body=body)\n+\n+        self.assertEqual(400, resp.json['code'])\n+        self.assertEqual('CircularDependencyException',\n+                         resp.json['error']['type'])\n+\n+        mock_call.assert_called_once_with(\n+            req.context,\n+            ('create_stack',\n+             {'stack_name': stack_name,\n+              'template': template,\n+              'params': {'parameters': {},\n+                         'encrypted_param_names': [],\n+                         'parameter_defaults': {},\n+                         'event_sinks': [],\n+                         'resource_registry': {}},\n+              'files': {},\n+              'environment_files': None,\n+              'files_container': None,\n+              'args': {'timeout_mins': 30},\n+              'owner_id': None,\n+              'nested_depth': 0,\n+              'user_creds_id': None,\n+              'parent_resource_name': None,\n+              'stack_user_project_id': None,\n+              'template_id': None}),\n+            version='1.36'\n+        )\n+\n     @mock.patch.object(rpc_client.EngineClient, 'call')\n     @mock.patch.object(stacks.stacks_view, 'format_stack')\n     def test_preview_stack(self, mock_format, mock_call, mock_enforce):"}]}