Merge "Fix heat deletion failed if floating ip is not found" into milestone-proposed
This commit is contained in:
commit
fa85221f9e
@ -118,7 +118,10 @@ class ElasticIp(resource.Resource):
|
|||||||
if e.status_code != 404:
|
if e.status_code != 404:
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
self.nova().floating_ips.delete(self.resource_id)
|
try:
|
||||||
|
self.nova().floating_ips.delete(self.resource_id)
|
||||||
|
except clients.novaclient.exceptions.NotFound:
|
||||||
|
pass
|
||||||
|
|
||||||
def FnGetRefId(self):
|
def FnGetRefId(self):
|
||||||
return unicode(self._ipaddress())
|
return unicode(self._ipaddress())
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import mox
|
||||||
|
|
||||||
from testtools import skipIf
|
from testtools import skipIf
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
@ -223,6 +225,24 @@ class EIPTest(HeatTestCase):
|
|||||||
rsrc.handle_create)
|
rsrc.handle_create)
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
def test_delete_eip_with_exception(self):
|
||||||
|
self.m.StubOutWithMock(self.fc.floating_ips, 'delete')
|
||||||
|
eip.ElasticIp.nova().MultipleTimes().AndReturn(self.fc)
|
||||||
|
self.fc.floating_ips.delete(mox.IsA(object)).AndRaise(
|
||||||
|
clients.novaclient.exceptions.NotFound('fake_falure'))
|
||||||
|
self.fc.servers.get(mox.IsA(object)).AndReturn(False)
|
||||||
|
self.m.ReplayAll()
|
||||||
|
|
||||||
|
t = template_format.parse(eip_template)
|
||||||
|
stack = utils.parse_stack(t)
|
||||||
|
resource_name = 'IPAddress'
|
||||||
|
rsrc = eip.ElasticIp(resource_name,
|
||||||
|
t['Resources'][resource_name],
|
||||||
|
stack)
|
||||||
|
rsrc.resource_id = 'fake_id'
|
||||||
|
rsrc.handle_delete()
|
||||||
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
|
||||||
class AllocTest(HeatTestCase):
|
class AllocTest(HeatTestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user