def get_int_id_from_snapshot_uuid(context, snapshot_uuid): if snapshot_uuid is None: return try: return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid) except exception.NotFound: return db.ec2_snapshot_create(context, snapshot_uuid)['id']
def get_int_id_from_snapshot_uuid(context, snapshot_uuid): if snapshot_uuid is None: return try: return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid) except exception.NotFound: raise exception.SnapshotNotFound()
def test_get_snap_mapping_non_admin(self): ref = db.ec2_snapshot_create(self.context, 'fake-uuid') ec2_id = db.get_ec2_snapshot_id_by_uuid(self.context, 'fake-uuid') self.assertEqual(ref['id'], ec2_id)