Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDir(name string) (string, error)
- func DoChecks(checks []Check, tryFix bool) []error
- func EmptyFileCreator(path string) (string, error)
- func Linux() bool
- type ActionCheck
- type ActionRunner
- type Check
- func NewCmdActionCheck(msg string, preCheck PreChecker, cmd ActionRunner) Check
- func NewConfigCheck(configKey string, help string, defaulter DefaultGetter) Check
- func NewConfigFileCheck(name string) Check
- func NewFixableConfigFileCheck(name string, fixFunc FileAutoFixFunc) Check
- func NewReqConfigDirCheck(name string) Check
- func NewResourceFileCheck(c CheckerFunc, help string, f FileAutoFixFunc) Check
- type CheckerFunc
- type ConfigCheck
- type DefaultGetter
- func ConfigDir(value interface{}) DefaultGetter
- func IifStatic(iif func() bool, tVal interface{}, fVal interface{}) DefaultGetter
- func Messager(value interface{}) DefaultGetter
- func NoDefault() DefaultGetter
- func Prompter(value interface{}) DefaultGetter
- func RandomVal(value interface{}) DefaultGetter
- func ServiceURL(scheme string, port int) DefaultGetter
- func Static(value interface{}) DefaultGetter
- type FileAutoFixFunc
- type FileCheck
- type PodmanMachine
- type PreChecker
Constants ¶
const CascTemplateString = `` /* 250-byte string literal not displayed */
const RunScript = `` /* 321-byte string literal not displayed */
const SolutionsListPermissionsError = `` /* 364-byte string literal not displayed */
SolutionsListPermissionsError is the permissions error printed by the doctor check.
Variables ¶
var ActionChecks = []Check{ NewCmdActionCheck("setting clock on podman machine", PodmanMachineExists(), UpdatePodmanMachineDate()), }
var AllConfigChecks = []Check{ NewConfigCheck("backstage.api.url", "", Static("https://catalog.techzone.ibm.com")), NewConfigCheck("techzone.api.url", "", Static("https://api.techzone.ibm.com/api")), NewConfigCheck("reservations.api.path", "", Static("my/reservations/all")), NewConfigCheck("reservation.api.path", "", Static("reservation/ibmcloud-2")), NewConfigCheck("execute.workspace.ocpinstaller", "", IifStatic(Linux, DefaultOCPInstallerLinuxConfig, DefaultOCPInstallerConfig)), NewConfigCheck("execute.workspace.pipelinecreator", "", IifStatic(Linux, DefaultPipelineConfigLinuxConfig, DefaultPipelineCreatorConfig)), }
AllConfigChecks checks for configuration values on the system and defines defaulters for fixing the missing values if the user specifies --auto-fix.
var DefaultOCPInstallerConfig = &pkg.ServiceConfig{ Name: "ocp-installer", Local: true, Type: "interactive", Image: "quay.io/ibmtz/ocpinstaller:stable", Volumes: []string{ strings.Join([]string{filepath.Join(pkg.MustITZHomeDir(), "save"), "/usr/src/ocpnow/save"}, ":"), }, }
var DefaultOCPInstallerLinuxConfig = &pkg.ServiceConfig{ Name: "ocp-installer", Local: true, Type: "interactive", Image: "quay.io/ibmtz/ocpinstaller:stable", Volumes: []string{ strings.Join([]string{filepath.Join(pkg.MustITZHomeDir(), "save"), "/usr/src/ocpnow/save", "Z"}, ":"), }, }
var DefaultPipelineConfigLinuxConfig = &pkg.ServiceConfig{ Name: "pipeline-creator", Local: true, Type: "interactive", Image: "quay.io/ibmtz/pipeline-creator:main", Volumes: []string{ strings.Join([]string{filepath.Join(pkg.MustITZHomeDir(), "projects"), "/workspace", "Z"}, ":"), }, }
var DefaultPipelineCreatorConfig = &pkg.ServiceConfig{ Name: "pipeline-creator", Local: true, Type: "interactive", Image: "quay.io/ibmtz/pipeline-creator:main", Volumes: []string{ strings.Join([]string{filepath.Join(pkg.MustITZHomeDir(), "projects"), "/workspace"}, ":"), }, }
var FileChecks = []Check{ NewReqConfigDirCheck("save"), NewReqConfigDirCheck("build_home"), NewReqConfigDirCheck("cache"), NewReqConfigDirCheck("projects"), NewFixableConfigFileCheck("cli-config.yaml", EmptyFileCreator), NewResourceFileCheck(OneExistsOnPath("podman", "docker"), "%s was not found on your path", UpdateConfig("podman.path")), }
FileChecks defines the checks that are done for files on the system.
Functions ¶
func DoChecks ¶
DoChecks performs the configured file checks and return a list of errors, if any, while checking for the files. If fix is set to true, then the file or directory is created if it can be.
func EmptyFileCreator ¶
Types ¶
type ActionCheck ¶ added in v0.1.24
type ActionCheck struct { Message string PreCheck PreChecker Cmd ActionRunner }
ActionCheck is
type ActionRunner ¶ added in v0.1.24
func UpdatePodmanMachineDate ¶ added in v0.1.24
func UpdatePodmanMachineDate() ActionRunner
UpdatePodmanMachineDate updates the date on the podman machine to be the current date on the host.
type Check ¶
Check interface for itz doctor checks
func NewCmdActionCheck ¶ added in v0.1.24
func NewCmdActionCheck(msg string, preCheck PreChecker, cmd ActionRunner) Check
func NewConfigCheck ¶
func NewConfigCheck(configKey string, help string, defaulter DefaultGetter) Check
NewConfigCheck creates a new ConfigCheck for the given key.
func NewConfigFileCheck ¶
NewConfigFileCheck checks for files inside the ITZ home directory
func NewFixableConfigFileCheck ¶
func NewFixableConfigFileCheck(name string, fixFunc FileAutoFixFunc) Check
func NewReqConfigDirCheck ¶
NewReqConfigDirCheck checks for directories inside the ITZ home directory
func NewResourceFileCheck ¶
func NewResourceFileCheck(c CheckerFunc, help string, f FileAutoFixFunc) Check
NewResourceFileCheck checks for any files, using the OS's PATH variable automatically as the path.
type CheckerFunc ¶
func ExistsOnPath ¶
func ExistsOnPath(name string) CheckerFunc
ExistsOnPath checks if a binary file exists on the path, using the OS's PATH variable automatically as the path.
func OneExistsOnPath ¶
func OneExistsOnPath(names ...string) CheckerFunc
OneExistsOnPath checks if one of the binary files in a list exists on the path, using the OS's PATH variable automatically as the path. It returns the first path that exists.
type ConfigCheck ¶
type ConfigCheck struct { ConfigKey string Defaulter DefaultGetter Help string }
ConfigCheck a check for configuration
func (*ConfigCheck) DoCheck ¶
func (c *ConfigCheck) DoCheck(tryFix bool) (string, error)
DoCheck performs a check of the configuration value and returns the value of the configuration, if it exists, with no error. If the configuration value does not exist
func (*ConfigCheck) String ¶
func (c *ConfigCheck) String() string
String provides a human-readable version of the config check
type DefaultGetter ¶
type DefaultGetter func() interface{}
DefaultGetter provides a function type for handling default values of the configuration.
func ConfigDir ¶
func ConfigDir(value interface{}) DefaultGetter
ConfigDir returns the static value for the default.
func IifStatic ¶ added in v0.1.26
func IifStatic(iif func() bool, tVal interface{}, fVal interface{}) DefaultGetter
func Messager ¶
func Messager(value interface{}) DefaultGetter
Messager asks the user a question and returns the answer to the getter.
func Prompter ¶
func Prompter(value interface{}) DefaultGetter
Prompter asks the user a question and returns the answer to the getter.
func RandomVal ¶
func RandomVal(value interface{}) DefaultGetter
RandomVal returns a random string value for the default.
func ServiceURL ¶
func ServiceURL(scheme string, port int) DefaultGetter
ServiceURL returns the static value for the default.
func Static ¶
func Static(value interface{}) DefaultGetter
Static returns the static value for the default.
type FileAutoFixFunc ¶
func TemplatedFileCreator ¶
func TemplatedFileCreator(template string) FileAutoFixFunc
func UpdateConfig ¶
func UpdateConfig(configPath string) FileAutoFixFunc
func UpdateConfigIfMissing ¶
func UpdateConfigIfMissing(configPath string) FileAutoFixFunc
type FileCheck ¶
type FileCheck struct { PathCheckFunc CheckerFunc Path string Name string IsDir bool Help string FixerFunc FileAutoFixFunc UpdaterFunc FileAutoFixFunc }
FileCheck is a check for a required file
type PodmanMachine ¶ added in v0.1.24
type PodmanMachine struct {
MachineState string
}
type PreChecker ¶ added in v0.1.24
type PreChecker func() bool
func PodmanMachineExists ¶ added in v0.1.24
func PodmanMachineExists() PreChecker