コード例 #1
0
ファイル: util.py プロジェクト: project-ncl/repour
async def print_java_version(java_bin_dir=""):

    if java_bin_dir and java_bin_dir.endswith("/"):
        command = java_bin_dir + "java"
    elif java_bin_dir:
        command = java_bin_dir + "/java"
    else:
        command = "java"

    expect_ok = asutil.expect_ok_closure()
    output = await expect_ok(
        cmd=[command, "-version"],
        desc="Failed getting Java version",
        cwd=".",
        stdout=stdout_options["text"],
        stderr=stderr_options["stdout"],
        print_cmd=True,
    )
    logger.info(output)
コード例 #2
0
        3600,
        4500,
        5400,
        6300,
        7200,
    ],
)

logger = logging.getLogger(__name__)

# Each adjust provider is represented by a get_*_provider factory function,
# which MUST return an adjust(repo_dir, extra_adjust_parameters, adjust_result) function.
#
# Each factory function takes various parameters that SHOULD be all derived from configuration.

expect_ok = asutil.expect_ok_closure(exception.AdjustCommandError)


async def is_sync_on(adjustspec):
    """For sync to be active, we need to both have the originRepoUrl information
    and the 'sync' key to be set to on.

    return: :bool: whether sync feature enabled or disabled
    """
    if (("originRepoUrl" in adjustspec) and adjustspec["originRepoUrl"]
            and ("sync" in adjustspec) and (adjustspec["sync"] is True)):
        logger.info("Auto-Sync feature activated")
        return True
    elif "originRepoUrl" not in adjustspec:
        logger.info(
            "'originRepoUrl' key not specified: Auto-Sync feature disabled")
コード例 #3
0
ファイル: repo.py プロジェクト: project-ncl/repour
        if resp.status == reauth_status:
            resp.close()
            retry_count -= 1
            await auth()
        else:
            break
    else:
        e = await exception.RepoHttpClientError.from_response(
            "Repository provider authentication failed", resp
        )
        raise e

    return resp


expect_ok = asutil.expect_ok_closure(exception.RepoCommandError)

RepoUrls = collections.namedtuple("RepoUrls", ["readwrite", "readonly"])

#
# Repo operations
#


def repo_gerrit(api_url, username, password, new_repo_owners):
    session = aiohttp.ClientSession()  # pylint: disable=no-member

    def es(o):
        return json.dumps(obj=o, ensure_ascii=False)

    def md5(*args):