예제 #1
0
def get_by_pk(user, idt):

    try:
        return Rack.objects.filter(id=idt).uniqueResult()
    except ObjectDoesNotExist, e:
        raise exceptions.RackNumberNotFoundError(
            "Rack id %s nao foi encontrado" % (idt))
예제 #2
0
def get_by_pk(user, idt):

    try:
        return Rack.objects.filter(id=idt).uniqueResult()
    except ObjectDoesNotExist:
        raise exceptions.RackNumberNotFoundError(
            "Rack id %s nao foi encontrado" % idt)
    except Exception, e:
        log.error(u'Failure to search the Rack.')
        raise exceptions.RackError("Failure to search the Rack. %s" % e)
예제 #3
0
                            if not equip.maintenance:
                                (erro, result) = commands.getstatusoutput("/usr/bin/backuper -T acl -b %s -e -i %s -w 300" % (rel_filename, equipment_name))
                                if erro:
                                    raise exceptions.RackAplError()
                        except exceptions.RackAplError, e:
                            raise e
                        except:
                            #Error equipment not found, do nothing
                            pass

            datas = dict()
            success_map = dict()

            success_map['rack_conf'] = True
            datas['sucesso'] = success_map

            return Response(datas, status=status.HTTP_201_CREATED)

        except exceptions.RackAplError, exception:
            log.exception(exception)
            raise exceptions.RackAplError("Falha ao aplicar as configuracoes: %s" %(result))
        except exceptions.RackNumberNotFoundError, exception:
            log.exception(exception)
            raise exceptions.RackNumberNotFoundError()
        except var_exceptions.VariableDoesNotExistException, exception:
            log.error(exception)
            raise var_exceptions.VariableDoesNotExistException("Erro buscando a variável PATH_TO_ADD_CONFIG ou REL_PATH_TO_ADD_CONFIG.")
        except Exception, exception:
            log.exception(exception)
            raise api_exceptions.NetworkAPIException(exception)