Exemplo n.º 1
0
    def copyHardwareProfile(self, srcHardwareProfileName):
        response = None

        postdata = cherrypy.request.json

        try:
            if 'dstHardwareProfileName' not in postdata:
                raise HardwareProfileNotFound(
                    'Missing destination hardware profile parameter')

            dstHardwareProfileName = postdata['dstHardwareProfileName']

            hpMgr = HardwareProfileManager()

            hpMgr.copyHardwareProfile(srcHardwareProfileName,
                                      dstHardwareProfileName)
        except HardwareProfileNotFound as ex:
            self.handleException(ex)
            code = self.getTortugaStatusCode(ex)
            response = self.notFoundErrorResponse(str(ex), code)
        except Exception as ex:
            self.getLogger().exception(
                'hardware profile WS API copyHardwareProfile() failed')

            self.handleException(ex)

            response = self.errorResponse(str(ex))

        return self.formatResponse(response)
Exemplo n.º 2
0
    def copyHardwareProfile(self, srcHardwareProfileName, dstHardwareProfileName):
        response = None

        try:
            hpMgr = HardwareProfileManager()

            hpMgr.copyHardwareProfile(
                cherrypy.request.db,
                srcHardwareProfileName, dstHardwareProfileName)
        except HardwareProfileNotFound as ex:
            self.handleException(ex)
            code = self.getTortugaStatusCode(ex)
            response = self.notFoundErrorResponse(str(ex), code)
        except Exception as ex:
            self._logger.exception(
                'hardware profile WS API copyHardwareProfile() failed')

            self.handleException(ex)

            response = self.errorResponse(str(ex))

        return self.formatResponse(response)