admin

package
v0.6.0-RC4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitCmd = &cli.Command{
	Name:  "init",
	Usage: "Initialize or upgrade the database",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "identity",
			Usage: "Name of the user or service that is running the Singularity for tracking and logging purpose",
		},
	},
	Description: "This commands need to be run before running any singularity daemon or after any version upgrade",
	Action: func(c *cli.Context) error {
		db, closer, err := database.OpenFromCLI(c)
		if err != nil {
			return errors.WithStack(err)
		}
		defer closer.Close()
		err = admin.Default.InitHandler(c.Context, db)
		if err != nil {
			return errors.WithStack(err)
		}
		if c.IsSet("identity") {
			err = admin.Default.SetIdentityHandler(c.Context, db, admin.SetIdentityRequest{
				Identity: c.String("identity"),
			})
			if err != nil {
				return errors.WithStack(err)
			}
		}
		return nil
	},
}
View Source
var ResetCmd = &cli.Command{
	Name:  "reset",
	Usage: "Reset the database",
	Flags: []cli.Flag{cliutil.ReallyDotItFlag},
	Action: func(c *cli.Context) error {
		if err := cliutil.HandleReallyDoIt(c); err != nil {
			return errors.WithStack(err)
		}
		db, closer, err := database.OpenFromCLI(c)
		if err != nil {
			return errors.WithStack(err)
		}
		defer closer.Close()
		return admin.Default.ResetHandler(c.Context, db)
	},
}

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