// resets meshery config, skips conirmation if skipConfirmation is true
resets meshery config, skips conirmation if skipConfirmation is true
// resets meshery config skips conirmation if skipConfirmation is true
func resetMesheryConfig() error {
	userResponse := false
	if utils.SilentFlag {
		userResponse = true
	} else {
		userResponse = utils.AskForConfirmation("Meshery config file will be reset to system defaults. Are you sure you want to continue")
	}
	if !userResponse {
		log.Info("Reset aborted.")
		return nil
	}
	mctlCfg, err := config.GetMesheryCtl(viper.GetViper())
	if err != nil {
		return errors.Wrap(err, "error processing config")
	}
	currCtx, err := mctlCfg.SetCurrentContext(tempContext)
	if err != nil {
		return errors.Wrap(err, "failed to retrieve current-context")
	}
	log.Info("Meshery resetting...\n")
	log.Printf("Current Context: %s", mctlCfg.CurrentContext)
	log.Printf("Channel: %s", currCtx.Channel)
	log.Printf("Version: %s", currCtx.Version)
	log.Printf("Platform: %s\n", currCtx.Platform)
	switch currCtx.Platform {
	case "docker":
		log.Printf("Fetching default docker-compose file as per current-context: %s...\n", mctlCfg.CurrentContext)
		err = utils.DownloadDockerComposeFile(currCtx, true)
		if err != nil {
			return errors.Wrap(err, "failed to fetch docker-compose file")
		}
		log.Printf("Fetching Meshery Operator manifests...\n")
		err = utils.DownloadOperatorManifest()
		if err != nil {
			return err
		}
		log.Info("...Meshery config (" + utils.DockerComposeFile + ") now reset to default settings.")
	case "kubernetes":
		version := currCtx.Version
		if version == "latest" {
			if currCtx.Channel == "edge" {
				version = "master"
			} else {
				version, err = utils.GetLatestStableReleaseTag()
				if err != nil {
					return err
				}
			}
		}
		log.Printf("Fetching Meshery Server and Meshery Operator manifests...")
		_, err := utils.FetchManifests(version)
		if err != nil {
			return err
		}
		log.Info("...meshconfig has been reset to default settings.")
	default:
		log.Errorf("the platform %s is not supported currently. The supported platforms are:\ndocker\nkubernetes\nPlease check %s/config.yaml file.", currCtx.Platform, utils.MesheryFolder)
	}
	return nil
}
func resetMesheryConfig ( ) error { userResponse := false if utils . SilentFlag { userResponse = true } else { userResponse = utils . AskForConfirmation ( " " ) } if ! userResponse { log . Info ( " " ) return nil } mctlCfg , err := config . GetMesheryCtl ( viper . GetViper ( ) ) if err != nil { return errors . Wrap ( err , " " ) } currCtx , err := mctlCfg . SetCurrentContext ( tempContext ) if err != nil { return errors . Wrap ( err , " " ) } log . Info ( " \n " ) log . Printf ( " " , mctlCfg . CurrentContext ) log . Printf ( " " , currCtx . Channel ) log . Printf ( " " , currCtx . Version ) log . Printf ( " \n " , currCtx . Platform ) switch currCtx . Platform { case " " : log . Printf ( " \n " , mctlCfg . CurrentContext ) err = utils . DownloadDockerComposeFile ( currCtx , true ) if err != nil { return errors . Wrap ( err , " " ) } log . Printf ( " \n " ) err = utils . DownloadOperatorManifest ( ) if err != nil { return err } log . Info ( " " + utils . DockerComposeFile + " " ) case " " : version := currCtx . Version if version == " " { if currCtx . Channel == " " { version = " " } else { version , err = utils . GetLatestStableReleaseTag ( ) if err != nil { return err } } } log . Printf ( " " ) _ , err := utils . FetchManifests ( version ) if err != nil { return err } log . Info ( " " ) default : log . Errorf ( " \n \n \n " , currCtx . Platform , utils . MesheryFolder ) } return nil }
resets meshery config, skips conirmation if skipConfirmation is true
resets meshery config skips conirmation if skipConfirmation is true
// ask user for confirmation // Get viper instance used for context // get the platform, channel and the version of the current context // if a temp context is set using the -c flag, use it as the current context // fetch the manifest files corresponding to the version specified