cmd

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageDisk   = "/mnt/?da1"
	GithubAddress = "https://github.com"
)
View Source
const (
	SshCommunicationError = "exit status 255"
)

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "minishift",
	Short: "Minishift is a tool for application development in local OpenShift clusters.",
	Long:  `Minishift is a command-line tool that provisions and manages single-node OpenShift clusters optimized for development workflows.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		var (
			err                    error
			isAddonInstallRequired bool
		)

		if constants.ProfileName != constants.DefaultProfileName {
			checkForValidProfileOrExit(cmd)
		}

		constants.MachineName = constants.ProfileName
		constants.Minipath = constants.GetProfileHomeDir(constants.ProfileName)

		state.InstanceDirs = state.NewMinishiftDirs(constants.Minipath)

		constants.KubeConfigPath = filepath.Join(state.InstanceDirs.Machines, constants.MachineName+"_kubeconfig")

		if !filehelper.Exists(state.InstanceDirs.Addons) {
			isAddonInstallRequired = true
		}

		createMinishiftDirs(state.InstanceDirs)

		if minishiftConfig.AllInstancesConfig == nil {
			ensureAllInstanceConfigPath(constants.AllInstanceConfigPath)
			minishiftConfig.AllInstancesConfig, err = minishiftConfig.NewAllInstancesConfig(constants.AllInstanceConfigPath)
			if err != nil {
				atexit.ExitWithMessage(1, fmt.Sprintf("Error creating all instance config: %s", err.Error()))
			}
		}

		ensureConfigFileExists(constants.ConfigFile)

		instanceConfigPath := filepath.Join(constants.Minipath, "machines", constants.MachineName+".json")
		minishiftConfig.InstanceConfig, err = minishiftConfig.NewInstanceConfig(instanceConfigPath)
		if err != nil {
			atexit.ExitWithMessage(1, fmt.Sprintf("Error creating config for VM: %s", err.Error()))
		}

		if isAddonInstallRequired {
			if err := cmdUtil.UnpackAddons(state.InstanceDirs.Addons); err != nil {
				atexit.ExitWithMessage(1, fmt.Sprintf("Error installing default add-ons : %s", err))
			}
		}

		if filehelper.Exists(filepath.Join(constants.Minipath, constants.UpdateMarkerFileName)) {
			if err := performPostUpdateExecution(filepath.Join(constants.Minipath, constants.UpdateMarkerFileName)); err != nil {
				atexit.ExitWithMessage(1, fmt.Sprintf("Error in performing post update exeuction: %s", err))
			}
		}

		if minishiftConfig.EnableExperimental {
			glog.Info("Experimental features are enabled")
		}

		shouldShowLibmachineLogs := viper.GetBool(showLibmachineLogs)
		if glog.V(3) {
			log.SetDebug(true)
		}
		if !shouldShowLibmachineLogs {
			log.SetOutWriter(ioutil.Discard)
			log.SetErrWriter(ioutil.Discard)
		}

		setDefaultActiveProfile()

		if glog.V(2) {
			fmt.Println(fmt.Sprintf("-- minishift version: v%s+%s", version.GetMinishiftVersion(), version.GetCommitSha()))
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GenerateBashCompletion added in v1.13.0

func GenerateBashCompletion(w io.Writer, cmd *cobra.Command) error

func GenerateZshCompletion added in v1.13.0

func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error

func IsOpenShiftRunning added in v1.2.0

func IsOpenShiftRunning(driver drivers.Driver) bool

Types

type DockerShellConfig

type DockerShellConfig struct {
	shell.ShellConfig
	DockerCertPath  string
	DockerHost      string
	DockerTLSVerify string
	UsageHint       string
	NoProxyVar      string
	NoProxyValue    string
}

type OcShellConfig

type OcShellConfig struct {
	shell.ShellConfig
	OcDirPath    string
	UsageHint    string
	NoProxyVar   string
	NoProxyValue string
}

type Status added in v1.7.0

type Status struct {
	MinishiftStatus string
	ProfileName     string
	ClusterStatus   string
	DiskUsage       string
}

type UpdateMarker added in v1.2.0

type UpdateMarker struct {
	InstallAddon    bool
	PreviousVersion string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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