Ejemplo n.º 1
0
def get_repo(orgName, repoName, prodName=None, prodLabel=None, prodId=None, envName=None, includeDisabled=False,
             viewName=None, viewLabel=None, viewId=None):
    repo_api = RepoAPI()

    env  = get_environment(orgName, envName)
    prod = get_product(orgName, prodName, prodLabel, prodId)

    view = None
    resultViewId = None
    if viewName or viewLabel or viewId:
        view = get_content_view(orgName, viewLabel, viewName, viewId)
        resultViewId = view["id"]

    repos = repo_api.repos_by_env_product(env["id"], prod["id"], repoName, includeDisabled, resultViewId)
    if len(repos) > 0:
        #repo by id call provides more information
        return repo_api.repo(repos[0]["id"])

    if view:
        error = _("Could not find repository [ %(repoName)s ] within organization [ %(orgName)s ], " \
            "product [ %(prodName)s ], content view [ %(viewName)s ], and environment "\
            "[ %(env_name)s ]") % {'repoName':repoName, 'orgName':orgName, 'prodName':prod["name"],
                                   'viewName':view["name"], 'env_name':env["name"]}
    else:
        error = _("Could not find repository [ %(repoName)s ] within organization [ %(orgName)s ], " \
            "product [ %(prodName)s ] and environment [ %(env_name)s ]") % \
            {'repoName':repoName, 'orgName':orgName, 'prodName':prod["name"], 'env_name':env["name"]}

    raise ApiDataError(error)
Ejemplo n.º 2
0
def get_repo(orgName, prodName, prodLabel, prodId, repoName, envName=None, includeDisabled=False):
    repo_api = RepoAPI()

    env  = get_environment(orgName, envName)
    prod = get_product(orgName, prodName, prodLabel, prodId)

    repos = repo_api.repos_by_env_product(env["id"], prod["id"], repoName, includeDisabled)
    if len(repos) > 0:
        #repo by id call provides more information
        return repo_api.repo(repos[0]["id"])

    raise ApiDataError(_("Could not find repository [ %(repoName)s ] within organization [ %(orgName)s ], " \
        "product [ %(prodName)s ] and environment [ %(env_name)s ]") %
        {'repoName':repoName, 'orgName':orgName, 'prodName':prod["name"], 'env_name':env["name"]})
Ejemplo n.º 3
0
def get_repo(orgName, prodName, repoName, envName=None, includeDisabled=False):
    repo_api = RepoAPI()

    env = get_environment(orgName, envName)
    prod = get_product(orgName, prodName)

    repos = repo_api.repos_by_env_product(env["id"], prod["id"], repoName,
                                          includeDisabled)
    if len(repos) > 0:
        #repo by id call provides more information
        return repo_api.repo(repos[0]["id"])

    raise ApiDataError(_("Could not find repository [ %s ] within organization [ %s ], " \
        "product [ %s ] and environment [ %s ]") %
        (repoName, orgName, prodName, env["name"]))
Ejemplo n.º 4
0
def get_repo(orgName, prodName, repoName, envName=None, includeDisabled=False):
    repo_api = RepoAPI()

    env  = get_environment(orgName, envName)
    if env == None:
        return None

    prod = get_product(orgName, prodName)
    if prod == None:
        return None

    repos = repo_api.repos_by_env_product(env["id"], prod["id"], repoName, includeDisabled)
    if len(repos) > 0:
        #repo by id call provides more information
        return repo_api.repo(repos[0]["id"])

    print >> sys.stderr, _("Could not find repository [ %s ] within organization [ %s ], product [ %s ] and environment [ %s ]") % (repoName, orgName, prodName, env["name"])
    return None
Ejemplo n.º 5
0
def get_repo(orgName,
             repoName,
             prodName=None,
             prodLabel=None,
             prodId=None,
             envName=None,
             includeDisabled=False,
             viewName=None,
             viewLabel=None,
             viewId=None):
    repo_api = RepoAPI()

    env = get_environment(orgName, envName)
    prod = get_product(orgName, prodName, prodLabel, prodId)

    view = None
    resultViewId = None
    if viewName or viewLabel or viewId:
        view = get_content_view(orgName, viewLabel, viewName, viewId)
        resultViewId = view["id"]

    repos = repo_api.repos_by_env_product(env["id"], prod["id"], repoName,
                                          includeDisabled, resultViewId)
    if len(repos) > 0:
        #repo by id call provides more information
        return repo_api.repo(repos[0]["id"])

    if view:
        error = _("Could not find repository [ %(repoName)s ] within organization [ %(orgName)s ], " \
            "product [ %(prodName)s ], content view [ %(viewName)s ], and environment "\
            "[ %(env_name)s ]") % {'repoName':repoName, 'orgName':orgName, 'prodName':prod["name"],
                                   'viewName':view["name"], 'env_name':env["name"]}
    else:
        error = _("Could not find repository [ %(repoName)s ] within organization [ %(orgName)s ], " \
            "product [ %(prodName)s ] and environment [ %(env_name)s ]") % \
            {'repoName':repoName, 'orgName':orgName, 'prodName':prod["name"], 'env_name':env["name"]}

    raise ApiDataError(error)