Version: v0.0.0-...-cf0b7a1 Latest Latest

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

Go to latest
Published: Oct 13, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0



Package cmd contains everything needed for a command to function properly, including providing user feedback as well as taking user input.



This section is empty.


This section is empty.


func IsUserAbortedError

func IsUserAbortedError(err error) bool

IsUserAbortedError returns true if err is of type userAbortedError.

func NewRestoreCommand

func NewRestoreCommand(
	dbConnect func(info db.DialInfo) (core.Database, error),
	openBackup func(path, tempRoot string) (core.BackupFile, error),
	machineConverter func(member core.ReplicaSetMember) core.ControllerNode,
	loadCreds func() (string, string, error),
	devMode bool,
) cmd.Command

NewRestoreCommand creates a cmd.Command to check the database and restore the Juju backup.

func ReadCredsFromAgentConf

func ReadCredsFromAgentConf() (string, string, error)

ReadCredsFromAgentConf tries to load a mongo username and password from the standard agent.conf location on a controller machine.

func ReadCredsFromPattern

func ReadCredsFromPattern(pattern string, readFile func(string) ([]byte, error)) (string, string, error)

ReadCredsFromPattern tries to load a mongo username and password from the first file it finds matching the pattern passed in.


type UserInteractions

type UserInteractions struct {
	// contains filtered or unexported fields

UserInteractions communicates with the user by providing feedback and by collecting user input.

func NewUserInteractions

func NewUserInteractions(ctx *cmd.Context) *UserInteractions

NewUserInteractions constructs user interactions with given context.

func (*UserInteractions) Notify

func (ui *UserInteractions) Notify(message string)

Notify will post message to an io.Writer of the given cmd.Context. This ensures that all messages that require user attention go consistently to the same writer.

func (*UserInteractions) UserConfirmYes

func (ui *UserInteractions) UserConfirmYes() error

UserConfirmYes returns an error if we do not read a "y" or "yes" from user input.

Jump to

Keyboard shortcuts

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