示例#1
0
 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)
示例#2
0
 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)