-
Notifications
You must be signed in to change notification settings - Fork 232
/
callbacks.go
61 lines (51 loc) · 3.16 KB
/
callbacks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package config
import (
"fmt"
"path/filepath"
"github.com/crc-org/crc/v2/pkg/crc/constants"
"github.com/crc-org/crc/v2/pkg/os"
"github.com/spf13/cast"
)
func RequiresRestartMsg(key string, _ interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' are only applied when the CRC instance is started.\n"+
"If you already have a running CRC instance, then for this configuration change to take effect, "+
"stop the CRC instance with 'crc stop' and restart it with 'crc start'.", key)
}
func RequiresDeleteMsg(key string, _ interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' are only applied when the CRC instance is created.\n"+
"If you already have a running CRC instance, then for this configuration change to take effect, "+
"delete the CRC instance with 'crc delete' and start it with 'crc start'.", key)
}
func RequiresDeleteAndSetupMsg(key string, _ interface{}) string {
// since we cannot easily import the machine package here to check for existence of the CRC vm
// we rely on the existence of the machine config file to determine if a VM exists
if os.FileExists(filepath.Join(constants.MachineInstanceDir, "crc", "config.json")) {
return fmt.Sprintf("Changes to configuration property '%s' are only applied when the CRC instance is created.\n"+
"If you already have a running CRC instance with different %s, then for this configuration change to take effect, "+
"first delete the CRC instance with 'crc delete'. Then to confirm your system is ready, and you have the needed system bundle, "+
"please run 'crc setup' before 'crc start'.", key, key)
}
return "To confirm your system is ready, and you have the needed system bundle, please run 'crc setup' before 'crc start'."
}
func SuccessfullyApplied(key string, value interface{}) string {
return fmt.Sprintf("Successfully configured %s to %s", key, cast.ToString(value))
}
func RequiresCRCSetup(key string, _ interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' are only applied during 'crc setup'.\n"+
"Please run 'crc setup' for this configuration to take effect.", key)
}
func RequiresCleanupAndSetupMsg(key string, _ interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' are only applied during 'crc setup'.\n"+
"Please run 'crc cleanup' followed by 'crc setup' for this configuration to take effect.", key)
}
func RequiresHTTPPortChangeWarning(key string, value interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' will break OpenShift HTTP routes.\n"+
"In order to access OpenShift applications through HTTP URLs "+
"the %d port must be manually specified, such as http://myapp.apps-crc.testing:%d", key, value, value)
}
func RequiresHTTPSPortChangeWarning(key string, value interface{}) string {
return fmt.Sprintf("Changes to configuration property '%s' will break OpenShift HTTPS routes.\n"+
"In order to access OpenShift applications through HTTPS URLs "+
"the %d port must be manually specified, such as https://myapp.apps-crc.testing:%d\n"+
"After this change, the OpenShift console will be non-functional because of OpenShift limitations", key, value, value)
}