Esempio n. 1
0
    def create_snapshot(self, params):
        """To create diagnostic snapshot:
                fuel snapshot

            To specify config for snapshotting:
                fuel snapshot < conf.yaml

        """
        if sys.stdin.isatty():
            conf = {}
        else:
            conf = yaml.load(sys.stdin.read())

        snapshot_task = SnapshotTask.start_snapshot_task(conf)
        self.serializer.print_to_output(
            snapshot_task.data,
            "Generating diagnostic snapshot..."
        )
        snapshot_task.wait()

        if snapshot_task.status == 'ready':
            self.serializer.print_to_output(
                snapshot_task.data,
                "...Completed...\n"
                "Diagnostic snapshot can be downloaded from " +
                snapshot_task.connection.root +
                snapshot_task.data["message"]
            )
        elif snapshot_task.status == 'error':
            six.print_(
                "Snapshot generating task ended with error. Task message: {0}"
                .format(snapshot_task.data["message"]),
                file=sys.stderr
            )
Esempio n. 2
0
    def get_snapshot(self, params):
        """To download diagnostic snapshot:
                fuel snapshot

            To download diagnostic snapshot to specific directory:
                fuel snapshot --dir path/to/directory

            To specify config for snapshoting
                fuel snapshot < conf.yaml

        """
        if sys.stdin.isatty():
            conf = {}
        else:
            conf = yaml.load(sys.stdin.read())

        snapshot_task = SnapshotTask.start_snapshot_task(conf)
        self.serializer.print_to_output(
            snapshot_task.data,
            "Generating dump..."
        )
        snapshot_task.wait()

        if snapshot_task.status == 'ready':
            download_snapshot_with_progress_bar(
                snapshot_task.connection.root + snapshot_task.data["message"],
                auth_token=APIClient.auth_token,
                directory=params.dir
            )
        elif snapshot_task.status == 'error':
            six.print_(
                "Snapshot generating task ended with error. Task message: {0}"
                .format(snapshot_task.data["message"]),
                file=sys.stderr
            )
Esempio n. 3
0
    def get_snapshot(self, params):
        """To download diagnostic snapshot:
                fuel snapshot

            To download diagnostic snapshot to specific directory:
                fuel snapshot --dir path/to/directory

            To specify config for snapshoting
                fuel snapshot < conf.yaml

        """
        if sys.stdin.isatty():
            conf = {}
        else:
            conf = yaml.load(sys.stdin.read())

        snapshot_task = SnapshotTask.start_snapshot_task(conf)
        self.serializer.print_to_output(snapshot_task.data,
                                        "Generating dump...")
        snapshot_task.wait()

        if snapshot_task.status == 'ready':
            download_snapshot_with_progress_bar(
                snapshot_task.connection.root + snapshot_task.data["message"],
                auth_token=APIClient.auth_token,
                directory=params.dir)
        elif snapshot_task.status == 'error':
            six.print_(
                "Snapshot generating task ended with error. Task message: {0}".
                format(snapshot_task.data["message"]),
                file=sys.stderr)
Esempio n. 4
0
    def get_snapshot(self, params):
        """To download diagnostic snapshot:
                fuel snapshot

            To download diagnostic snapshot to specific directory:
                fuel snapshot --dir path/to/directory

            To specify config for snapshoting
                fuel snapshot < conf.yaml

        """
        if sys.stdin.isatty():
            conf = {}
        else:
            conf = yaml.load(sys.stdin.read())

        snapshot_task = SnapshotTask.start_snapshot_task(conf)
        self.serializer.print_to_output(
            snapshot_task.data,
            "Generating dump..."
        )
        snapshot_task.wait()
        download_snapshot_with_progress_bar(
            snapshot_task.connection.root + snapshot_task.data["message"],
            directory=params.dir
        )
Esempio n. 5
0
    def get_snapshot_config(self, params):
        """Download default config for snapshot:
                fuel snapshot --conf > dump_conf.yaml

            To use json formatter:
                fuel snapshot --conf --json
        """
        conf = SnapshotTask.get_default_config()
        self.serializer.write_to_file(sys.stdout, conf)
Esempio n. 6
0
    def get_snapshot(self, params):
        """To download diagnostic snapshot:
                fuel snapshot

            To download diagnostic snapshot to specific directory:
                fuel snapshot --dir path/to/directory
        """
        snapshot_task = SnapshotTask.start_snapshot_task()
        self.serializer.print_to_output(
            snapshot_task.data,
            "Generating dump..."
        )
        snapshot_task.wait()
        download_snapshot_with_progress_bar(
            snapshot_task.connection.api_root + snapshot_task.data["message"],
            directory=params.dir
        )
Esempio n. 7
0
    def get_snapshot(self, params):
        """To download diagnostic snapshot:
                fuel snapshot

            To download diagnostic snapshot to specific directory:
                fuel snapshot --dir path/to/directory
        """
        snapshot_task = SnapshotTask.start_snapshot_task()
        self.serializer.print_to_output(
            snapshot_task.data,
            "Generating dump..."
        )
        snapshot_task.wait()
        download_snapshot_with_progress_bar(
            snapshot_task.connection.root + snapshot_task.data["message"],
            directory=params.dir
        )