update error msg for invalid state to update vpn resources
Change-Id: I6719fa359d0c14accfa8b9b440c2b7fbabbdcfdb Closes-Bug: #1256766
This commit is contained in:
parent
fbfa21e7ca
commit
3f110c9a57
@ -194,8 +194,9 @@ class VPNPluginDb(VPNPluginBase, base_db.CommonDbMixin):
|
||||
|
||||
def assert_update_allowed(self, obj):
|
||||
status = getattr(obj, 'status', None)
|
||||
_id = getattr(obj, 'id', None)
|
||||
if utils.in_pending_status(status):
|
||||
raise vpnaas.VPNStateInvalid(id=id, state=status)
|
||||
raise vpnaas.VPNStateInvalidToUpdate(id=_id, state=status)
|
||||
|
||||
def _make_ipsec_site_connection_dict(self, ipsec_site_conn, fields=None):
|
||||
|
||||
|
@ -70,8 +70,9 @@ class RouterInUseByVPNService(qexception.InUse):
|
||||
message = _("Router %(router_id)s is used by VPNService %(vpnservice_id)s")
|
||||
|
||||
|
||||
class VPNStateInvalid(qexception.BadRequest):
|
||||
message = _("Invalid state %(state)s of vpnaas resource %(id)s")
|
||||
class VPNStateInvalidToUpdate(qexception.BadRequest):
|
||||
message = _("Invalid state %(state)s of vpnaas resource %(id)s"
|
||||
" for updating")
|
||||
|
||||
|
||||
class IPsecPolicyInUse(qexception.InUse):
|
||||
|
@ -909,6 +909,9 @@ class TestVpnaas(VPNPluginDbTestCase):
|
||||
vpnservice['vpnservice']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(400, res.status_int)
|
||||
res = self.deserialize(self.fmt, res)
|
||||
self.assertIn(vpnservice['vpnservice']['id'],
|
||||
res['NeutronError']['message'])
|
||||
|
||||
def test_delete_vpnservice(self):
|
||||
"""Test case to delete a vpnservice."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user