def patch_one(self, fip_key): """ Set or unset a PTR """ request = pecan.request response = pecan.response context = request.environ['context'] try: body = request.body_dict except Exception as e: if e.message != 'TODO: Unsupported Content Type': raise else: # Got a blank body body = dict() region, id_ = fip_key_to_data(fip_key) fip = DesignateAdapter.parse('API_v2', body, objects.FloatingIP()) fip.validate() LOG.info(_LI("Updated %(fip)s"), {'fip': fip}) fip = self.central_api.update_floatingip(context, region, id_, fip) response.status_int = 202 if fip: return DesignateAdapter.render('API_v2', fip, request=request)
def patch_one(self, fip_key): """ Set or unset a PTR """ request = pecan.request context = request.environ['context'] body = request.body_dict region, id_ = fip_key_to_data(fip_key) # Validate the request conforms to the schema self._resource_schema.validate(body) fip = self.central_api.update_floatingip( context, region, id_, objects.FloatingIP().from_dict(body['floatingip'])) if fip: return self._view.show(context, request, fip)
def get_ptr_fixture(self, fixture=0, values=None): values = values or {} _values = copy.copy(self.ptr_fixtures[fixture]) _values.update(values) return objects.FloatingIP().from_dict(_values)