def _package_from_releases(tags, extension, version, edition, remote_download): releases = Releases(edition) release = releases.default if version: release = releases.pick_version(version) release.init_download() if not release.artifacts: log.error( f"The {version} {edition} release is empty, visit tracker.mender.io to file a bug report" ) return None artifacts = release.find(tags, extension) if not artifacts: log.error( "Could not find an appropriate package for host, please use --{}-package" .format("hub" if "hub" in tags else "client")) return None artifact = artifacts[-1] if remote_download: return artifact.url else: return download_package(artifact.url)
def install_host(host, *, hub=False, package=None, bootstrap=None, version=None, demo=False, call_collect=False, connection=None, edition=None): data = get_info(host, connection=connection) print_info(data) if not package: tags = [] if edition == "enterprise": tags.append("hub" if hub else "agent") tags.append("64" if data["arch"] in ["x86_64", "amd64"] else data["arch"]) extension = None if "package_tags" in data and "msi" in data["package_tags"]: extension = ".msi" elif "dpkg" in data["bin"]: extension = ".deb" elif "rpm" in data["bin"]: extension = ".rpm" releases = Releases(edition) release = releases.default if version: release = releases.pick_version(version) artifacts = release.find(tags, extension) if not artifacts: user_error( "Could not find an appropriate package for host, please use --{}-package" .format("hub" if hub else "client")) artifact = artifacts[-1] package = download_package(artifact.url) scp(package, host, connection=connection) package = basename(package) install_package(host, package, data, connection=connection) data = get_info(host, connection=connection) if data["agent_version"] and len(data["agent_version"]) > 0: print("CFEngine {} was successfully installed on '{}'".format( data["agent_version"], host)) else: print("Installation failed!") sys.exit(1) if bootstrap: bootstrap_host(data, policy_server=bootstrap, connection=connection) if demo: if hub: demo_lib.install_def_json(host, connection=connection, call_collect=call_collect) demo_lib.agent_run(data, connection=connection) demo_lib.disable_password_dialog(host) demo_lib.agent_run(data, connection=connection)
def install_host( host, *, hub=False, package=None, bootstrap=None, version=None, demo=False, call_collect=False, connection=None): data = get_info(host, connection=connection) print_info(data) if not package: tags = [] tags.append("hub" if hub else "agent") tags.append("64" if data["arch"] in ["x86_64", "amd64"] else data["arch"]) extension = None if "dpkg" in data["bin"]: extension = ".deb" elif "rpm" in data["bin"]: extension = ".rpm" releases = Releases() release = releases.default if version: release = releases.pick_version(version) artifacts = release.find(tags, extension) if not artifacts: user_error( "Could not find an appropriate package for host, please use --{}-package".format( "hub" if hub else "client")) artifact = artifacts[-1] package = download_package(artifact.url) scp(package, host, connection=connection) package = basename(package) install_package(host, package, data, connection=connection) data = get_info(host, connection=connection) if data["agent_version"] and len(data["agent_version"]) > 0: print( "CFEngine {} was successfully installed on '{}'".format(data["agent_version"], host)) else: print("Installation failed!") sys.exit(1) if bootstrap: bootstrap_host(host, policy_server=bootstrap, connection=connection) if demo: if hub: demo_lib.install_def_json(host, connection=connection, call_collect=call_collect) demo_lib.agent_run(host, connection=connection) demo_lib.disable_password_dialog(host) demo_lib.agent_run(host, connection=connection)
def packages(tags=None, version=None, edition=None): releases = Releases(edition) print("Available releases: {}".format(releases)) release = releases.default if version: release = releases.pick_version(version) print("Using {}:".format(release)) artifacts = release.find(tags) if len(artifacts) == 0: print("No suitable packages found") else: for artifact in artifacts: download_package(artifact.url)
def packages(tags=None, version=None): releases = Releases() print("Available releases: {}".format(releases)) release = releases.default if version: release = releases.pick_version(version) print("Using {}:".format(release)) artifacts = release.find(tags) if len(artifacts) == 0: print("No suitable packages found") else: for artifact in artifacts: download_package(artifact.url)
def _package_from_releases(tags, extension, version, edition, remote_download): releases = Releases(edition) release = releases.default if version: release = releases.pick_version(version) artifacts = release.find(tags, extension) if not artifacts: log.error( "Could not find an appropriate package for host, please use --{}-package" .format("hub" if hub else "client")) return 1 artifact = artifacts[-1] if remote_download: return artifact.url else: return download_package(artifact.url)
def print_version_info(): print("cf-remote version 0.1 (BETA)") print("Available CFEngine versions:") releases = Releases() print(releases)
def print_version_info(): print(f"cf-remote version {version.string()}") print("Available CFEngine versions:") releases = Releases() print(releases)