commands

package
v0.0.2-20220209 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InfoCommand = cli.Command{
	Name:        "info",
	Usage:       "show internal information",
	Description: "show internal information",
	Subcommands: cli.Commands{
		infoContainer,
	},
}
View Source
var ListCommand = cli.Command{
	Name:    "list",
	Aliases: []string{"ls"},
	Usage:   "Lists container related information",
	Subcommands: cli.Commands{
		listNamespaces,
		listContainers,
		listContent,
		listImages,
		listSnapshots,
		listTasks,
	},
}
View Source
var MountAllCommand = cli.Command{
	Name:        "mount-all",
	Aliases:     []string{"mount_all"},
	Usage:       "mount all containers",
	Description: "mount all containers to subdirectories with the specified mount point",
	ArgsUsage:   "[flag] MOUNT_POINT",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "mount-support-containers",
			Usage: "mount Kubernetes supporting containers",
		},
	},
	Action: func(clictx *cli.Context) error {

		if runtime.GOOS != "linux" {
			return fmt.Errorf("mounting a container is only supported on Linux")
		}

		if clictx.NArg() < 1 {
			return fmt.Errorf("mount point is required")
		}

		mountpoint := clictx.Args().First()

		ctx, exp, cancel, err := explorerEnvironment(clictx)
		if err != nil {
			return err
		}
		defer cancel()

		if err := exp.MountAllContainers(ctx, mountpoint, !clictx.Bool("mount-support-containers")); err != nil {
			return err
		}

		return nil
	},
}
View Source
var MountCommand = cli.Command{
	Name:        "mount",
	Usage:       "mount a container to a mount point",
	Description: "mount a container to a mount point",
	ArgsUsage:   "ID MOUNTPOINT",
	Action: func(clictx *cli.Context) error {

		if runtime.GOOS != "linux" {
			return fmt.Errorf("mounting a container is only supported on Linux")
		}

		if clictx.NArg() < 2 {
			return fmt.Errorf("container id and mount point are required")
		}

		namespace := clictx.GlobalString("namespace")
		containerid := clictx.Args().First()
		mountpoint := clictx.Args().Get(1)

		log.WithFields(log.Fields{
			"namespace":   namespace,
			"containerid": containerid,
			"mountpoint":  mountpoint,
		}).Debug("user provided mount options")

		ctx, exp, cancel, err := explorerEnvironment(clictx)
		if err != nil {
			return err
		}
		defer cancel()

		ctx = namespaces.WithNamespace(ctx, namespace)

		if err := exp.MountContainer(ctx, containerid, mountpoint); err != nil {
			return err
		}

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL