def compose_image(socket_path, api_version, args, show_json=False, testmode=0): """Download the compose's output image :param socket_path: Path to the Unix socket to use for API communication :type socket_path: str :param api_version: Version of the API to talk to. eg. "0" :type api_version: str :param args: List of remaining arguments from the cmdline :type args: list of str :param show_json: Set to True to show the JSON output instead of the human readable output :type show_json: bool :param testmode: unused in this function :type testmode: int compose image <uuid> This downloads only the result image, saving it as the image name, which depends on the type of compose that was selected. """ if len(args) == 0: log.error("logs is missing the compose build id") return 1 api_route = client.api_url(api_version, "/compose/image/%s" % args[0]) return client.download_file(socket_path, api_route, sys.stdout.isatty())
def compose_results(socket_path, api_version, args, show_json=False, testmode=0): """Download a tar file of the compose's results :param socket_path: Path to the Unix socket to use for API communication :type socket_path: str :param api_version: Version of the API to talk to. eg. "0" :type api_version: str :param args: List of remaining arguments from the cmdline :type args: list of str :param show_json: Set to True to show the JSON output instead of the human readable output :type show_json: bool :param testmode: unused in this function :type testmode: int compose results <uuid> The results includes the metadata, output image, and logs. It is saved as uuid.tar """ if len(args) == 0: log.error("results is missing the compose build id") return 1 api_route = client.api_url(api_version, "/compose/results/%s" % args[0]) return client.download_file(socket_path, api_route, sys.stdout.isatty())
def compose_logs(socket_path, api_version, args, show_json=False, testmode=0, api=None): """Download a tar of the compose's logs :param socket_path: Path to the Unix socket to use for API communication :type socket_path: str :param api_version: Version of the API to talk to. eg. "0" :type api_version: str :param args: List of remaining arguments from the cmdline :type args: list of str :param show_json: Set to True to show the JSON output instead of the human readable output :type show_json: bool :param testmode: unused in this function :type testmode: int compose logs <uuid> Saves the logs as uuid-logs.tar """ if len(args) == 0: log.error("logs is missing the compose build id") return 1 api_route = client.api_url(api_version, "/compose/logs/%s" % args[0]) try: rc = client.download_file(socket_path, api_route, sys.stdout.isatty()) except RuntimeError as e: print(str(e)) rc = 1 return rc
def compose_metadata(socket_path, api_version, args, show_json=False, testmode=0): """Download a tar file of the compose's metadata :param socket_path: Path to the Unix socket to use for API communication :type socket_path: str :param api_version: Version of the API to talk to. eg. "0" :type api_version: str :param args: List of remaining arguments from the cmdline :type args: list of str :param show_json: Set to True to show the JSON output instead of the human readable output :type show_json: bool :param testmode: unused in this function :type testmode: int compose metadata <uuid> Saves the metadata as uuid-metadata.tar """ if len(args) == 0: log.error("metadata is missing the compose build id") return 1 api_route = client.api_url(api_version, "/compose/metadata/%s" % args[0]) return client.download_file(socket_path, api_route)