def _get_hosting_device_template(self, context, id): try: return self._get_by_id(context, hd_models.HostingDeviceTemplate, id) except exc.NoResultFound: raise ciscohostingdevicemanager.HostingDeviceTemplateNotFound( id=id)
def update_hosting_device_template(self, context, id, hosting_device_template): LOG.debug("update_hosting_device_template() called") hdt = hosting_device_template['hosting_device_template'] tenant_bound = hdt.get('tenant_bound') if tenant_bound is not None: hdt['tenant_bound'] = ':'.join(tenant_bound) with context.session.begin(subtransactions=True): hdt_query = context.session.query(hd_models.HostingDeviceTemplate) if not hdt_query.filter_by(id=id).update(hdt): raise ciscohostingdevicemanager.HostingDeviceTemplateNotFound( id=id) return self.get_hosting_device_template(context, id)