Beispiel #1
0
def check_edenfs_version(tracker: ProblemTracker, instance: EdenInstance) -> None:
    rver, release = instance.get_running_version_parts()
    if not rver or not release:
        # This could be a dev build that returns the empty
        # string for both of these values.
        return

    running_version = version.format_eden_version((rver, release))
    installed_version = version.get_current_version()
    if running_version == installed_version:
        return

    tracker.add_problem(
        Problem(
            dedent(
                f"""\
The version of Eden that is installed on your machine is:
    fb-eden-{installed_version}.x86_64
but the version of Eden that is currently running is:
    fb-eden-{running_version}.x86_64

Consider running `eden restart --graceful` to migrate to the newer version,
which may have important bug fixes or performance improvements.
"""
            ),
            severity=ProblemSeverity.ADVICE,
        )
    )
Beispiel #2
0
def check_edenfs_version(tracker: ProblemTracker,
                         instance: EdenInstance) -> None:
    def date_from_version(version: str) -> date:
        return datetime.strptime(version, "%Y%m%d").date()

    rver, release = instance.get_running_version_parts()
    if not rver or not release:
        # This could be a dev build that returns the empty
        # string for both of these values.
        return

    # get installed version parts
    iversion, irelease = version.get_current_version_parts()
    if not iversion or not irelease:
        # dev build of eden client returns empty strings here
        return

    # check if the runnig version is more than two weeks old
    daysgap = date_from_version(iversion) - date_from_version(rver)
    if daysgap.days < 14:
        return

    running_version = version.format_eden_version((rver, release))
    installed_version = version.format_eden_version((iversion, irelease))

    if sys.platform == "win32":
        help_string = f"""\
The version of EdenFS that is installed on your machine is:
    fb.eden {installed_version}
but the version of EdenFS that is currently running is:
    fb.eden {running_version}

Consider running `edenfsctl restart` to migrate to the newer version,
which may have important bug fixes or performance improvements.
"""
    else:
        help_string = f"""\
The version of EdenFS that is installed on your machine is:
    fb-eden-{installed_version}.x86_64
but the version of EdenFS that is currently running is:
    fb-eden-{running_version}.x86_64

Consider running `edenfsctl restart --graceful` to migrate to the newer version,
which may have important bug fixes or performance improvements.
"""
    tracker.add_problem(
        Problem(dedent(help_string), severity=ProblemSeverity.ADVICE))