Exemplo n.º 1
0
 def post(self, pack_search_request):
     if hasattr(pack_search_request, 'query'):
         packs = packs_service.search_pack_index(pack_search_request.query)
         return [PackAPI(**pack) for pack in packs]
     else:
         pack = packs_service.get_pack_from_index(pack_search_request.pack)
         return PackAPI(**pack) if pack else None
Exemplo n.º 2
0
 def post(self, pack_search_request):
     if hasattr(pack_search_request, 'query'):
         packs = packs_service.search_pack_index(pack_search_request.query)
         return [PackAPI(**pack) for pack in packs]
     else:
         pack = packs_service.get_pack_from_index(pack_search_request.pack)
         return PackAPI(**pack) if pack else None
Exemplo n.º 3
0
 def run(self, pack):
     """
     :param pack: Pack Name to get info about
     :type pack: ``str``
     """
     return {
         'pack': get_pack_from_index(pack)
     }
Exemplo n.º 4
0
    def _get_repo_url(pack):
        pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
        name_or_url = pack_and_version[0]
        version = pack_and_version[1] if len(pack_and_version) > 1 else None

        if len(name_or_url.split('/')) == 1:
            pack = get_pack_from_index(name_or_url)
            if not pack:
                raise Exception('No record of the "%s" pack in the index.' % name_or_url)
            return (pack['repo_url'], version)
        else:
            return (DownloadGitRepoAction._eval_repo_url(name_or_url), version)
Exemplo n.º 5
0
    def post(self, pack_search_request):

        proxy_config = _get_proxy_config()

        if hasattr(pack_search_request, 'query'):
            packs = packs_service.search_pack_index(pack_search_request.query,
                                                    case_sensitive=False,
                                                    proxy_config=proxy_config)
            return [PackAPI(**pack) for pack in packs]
        else:
            pack = packs_service.get_pack_from_index(pack_search_request.pack,
                                                     proxy_config=proxy_config)
            return PackAPI(**pack) if pack else []
Exemplo n.º 6
0
Arquivo: packs.py Projeto: nzlosh/st2
    def post(self, pack_search_request):

        proxy_config = _get_proxy_config()

        if hasattr(pack_search_request, 'query'):
            packs = packs_service.search_pack_index(pack_search_request.query,
                                                    case_sensitive=False,
                                                    proxy_config=proxy_config)
            return [PackAPI(**pack) for pack in packs]
        else:
            pack = packs_service.get_pack_from_index(pack_search_request.pack,
                                                     proxy_config=proxy_config)
            return PackAPI(**pack) if pack else []
Exemplo n.º 7
0
def get_repo_url(pack, proxy_config=None):
    """
    Retrieve pack repo url.

    :rtype: ``str``

    :return: (repo_url, version)
    :rtype: tuple
    """
    pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
    name_or_url = pack_and_version[0]
    version = pack_and_version[1] if len(pack_and_version) > 1 else None

    if len(name_or_url.split('/')) == 1:
        pack = get_pack_from_index(name_or_url, proxy_config=proxy_config)

        if not pack:
            raise Exception('No record of the "%s" pack in the index.' % (name_or_url))

        return (pack['repo_url'], version)
    else:
        return (eval_repo_url(name_or_url), version)
Exemplo n.º 8
0
def get_repo_url(pack, proxy_config=None):
    """
    Retrieve pack repo url.

    :rtype: ``str``

    :return: (repo_url, version)
    :rtype: tuple
    """
    pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
    name_or_url = pack_and_version[0]
    version = pack_and_version[1] if len(pack_and_version) > 1 else None

    if len(name_or_url.split('/')) == 1:
        pack = get_pack_from_index(name_or_url, proxy_config=proxy_config)

        if not pack:
            raise Exception('No record of the "%s" pack in the index.' % (name_or_url))

        return (pack['repo_url'], version or pack['version'])
    else:
        return (eval_repo_url(name_or_url), version)