-
Notifications
You must be signed in to change notification settings - Fork 3
/
constants.go
109 lines (94 loc) · 3.02 KB
/
constants.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package constants
import "time"
const (
// LowDiskLimit sets the warning level of low disk (in bytes)
LowDiskLimit uint64 = 50 * 1024 * 1024 * 1024 // 50 Gb
// AbittiVagrantURL is the URL for the Abittti Vagrantfile
AbittiVagrantURL = "http://static.abitti.fi/usbimg/qa/vagrant/Vagrantfile"
// URLTest is a testing URL for network connectivity (network.CheckIfNetworkAvailable).
// Point this to something ultra-stable
URLTest = "http://static.abitti.fi/usbimg/qa/latest.txt"
// URLTestTimeout is the timeout in seconds for the test above
URLTestTimeout = 4
// VagrantBoxAvailVersionDetailsCacheTimeout is a timeout for vagrant box version
// cache. See naksu/boxversion GetVagrantBoxAvailVersionDetails() for more
// In seconds (5 minutes)
VagrantBoxAvailVersionDetailsCacheTimeout int64 = 5 * 60
// VBoxManageCacheTimeout is a timeout for executing VBoxManage showvminfo
// See naksu/box getVMInfoRegexp()
VBoxManageCacheTimeout int64 = 15
// LogCopyRequestFilename is for requesting logs from ktp
LogCopyRequestFilename = "_log_copy_requested"
// LogCopyDoneFilename is for detecting when log request is done
LogCopyDoneFilename = "_log_copy_done"
// LogCopyStatusFilename is for progress info on log copying
LogCopyStatusFilename = "_log_copy_status"
// LogRequestTimeout is the timeout for log request from ktp
LogRequestTimeout = 1 * time.Minute
)
// AvailableSelection is a struct for a UI/configuration option
type AvailableSelection struct {
ConfigValue string
Legend string
}
// AvailableLangs is an array of possible language selection values.
// The first value is the default.
var AvailableLangs = []AvailableSelection{
AvailableSelection{
ConfigValue: "fi",
Legend: "Suomeksi",
},
AvailableSelection{
ConfigValue: "sv",
Legend: "På svenska",
},
AvailableSelection{
ConfigValue: "en",
Legend: "In English",
},
}
// AvailableNics is an array of possible NIC selection values.
// The first value is the default.
var AvailableNics = []AvailableSelection{
AvailableSelection{
ConfigValue: "virtio",
Legend: "virtio",
},
AvailableSelection{
ConfigValue: "Am79C970A",
Legend: "Am79C970A",
},
AvailableSelection{
ConfigValue: "Am79C973",
Legend: "Am79C973",
},
AvailableSelection{
ConfigValue: "82540EM",
Legend: "82540EM",
},
AvailableSelection{
ConfigValue: "82543GC",
Legend: "82543GC",
},
AvailableSelection{
ConfigValue: "82545EM",
Legend: "82545EM",
},
}
// DefaultExtNicArray is an array holding the default EXTNIC value
var DefaultExtNicArray = []AvailableSelection{
AvailableSelection{
ConfigValue: "",
Legend: "Select in terminal",
},
}
// GetAvailableSelectionID returns array id for a given ConfigValue
// in the given set of choices. Returns -1 if the configValue was not found.
func GetAvailableSelectionID(configValue string, choices []AvailableSelection, valueIfNotFound int) int {
for i, thisChoice := range choices {
if thisChoice.ConfigValue == configValue {
return i
}
}
return valueIfNotFound
}