예제 #1
0
파일: scm.py 프로젝트: 01org/iris-panel
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join([domains_str, os.linesep, os.linesep,
                               gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
예제 #2
0
파일: scm.py 프로젝트: pombreda/iris-panel
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join(
                [domains_str, os.linesep, os.linesep, gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
예제 #3
0
파일: scm.py 프로젝트: 01org/iris-panel
def check(request):
    """
    Checking scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')
    if domains and gittrees:
        log.info('Checking scm data...')
        detail = check_scm(domains.read(), gittrees.read())
        if not detail:
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
예제 #4
0
파일: scm.py 프로젝트: pombreda/iris-panel
def check(request):
    """
    Checking scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')
    if domains and gittrees:
        log.info('Checking scm data...')
        detail = check_scm(domains.read(), gittrees.read())
        if not detail:
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
예제 #5
0
파일: scmlint.py 프로젝트: 01org/iris-panel
def file_import(domain_file, gittree_file):
    """
    read domain and git-tree file.
    """
    res = check_scm(domain_file.read(), gittree_file.read())
    return res
예제 #6
0
def file_import(domain_file, gittree_file):
    """
    read domain and git-tree file.
    """
    res = check_scm(domain_file.read(), gittree_file.read())
    return res