|
@@ -224,7 +224,7 @@ type CommonConfig struct {
|
|
|
|
|
|
DNSConfig
|
|
DNSConfig
|
|
LogConfig
|
|
LogConfig
|
|
- BridgeConfig // bridgeConfig holds bridge network specific configuration.
|
|
|
|
|
|
+ BridgeConfig // BridgeConfig holds bridge network specific configuration.
|
|
NetworkConfig
|
|
NetworkConfig
|
|
registry.ServiceOptions
|
|
registry.ServiceOptions
|
|
|
|
|
|
@@ -317,7 +317,7 @@ func GetConflictFreeLabels(labels []string) ([]string, error) {
|
|
if len(stringSlice) > 1 {
|
|
if len(stringSlice) > 1 {
|
|
// If there is a conflict we will return an error
|
|
// If there is a conflict we will return an error
|
|
if v, ok := labelMap[stringSlice[0]]; ok && v != stringSlice[1] {
|
|
if v, ok := labelMap[stringSlice[0]]; ok && v != stringSlice[1] {
|
|
- return nil, fmt.Errorf("conflict labels for %s=%s and %s=%s", stringSlice[0], stringSlice[1], stringSlice[0], v)
|
|
|
|
|
|
+ return nil, errors.Errorf("conflict labels for %s=%s and %s=%s", stringSlice[0], stringSlice[1], stringSlice[0], v)
|
|
}
|
|
}
|
|
labelMap[stringSlice[0]] = stringSlice[1]
|
|
labelMap[stringSlice[0]] = stringSlice[1]
|
|
}
|
|
}
|
|
@@ -325,7 +325,7 @@ func GetConflictFreeLabels(labels []string) ([]string, error) {
|
|
|
|
|
|
newLabels := []string{}
|
|
newLabels := []string{}
|
|
for k, v := range labelMap {
|
|
for k, v := range labelMap {
|
|
- newLabels = append(newLabels, fmt.Sprintf("%s=%s", k, v))
|
|
|
|
|
|
+ newLabels = append(newLabels, k+"="+v)
|
|
}
|
|
}
|
|
return newLabels, nil
|
|
return newLabels, nil
|
|
}
|
|
}
|
|
@@ -521,7 +521,7 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
|
|
for key := range unknownKeys {
|
|
for key := range unknownKeys {
|
|
unknown = append(unknown, key)
|
|
unknown = append(unknown, key)
|
|
}
|
|
}
|
|
- return fmt.Errorf("the following directives don't match any configuration option: %s", strings.Join(unknown, ", "))
|
|
|
|
|
|
+ return errors.Errorf("the following directives don't match any configuration option: %s", strings.Join(unknown, ", "))
|
|
}
|
|
}
|
|
|
|
|
|
var conflicts []string
|
|
var conflicts []string
|
|
@@ -555,7 +555,7 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
|
|
flags.Visit(duplicatedConflicts)
|
|
flags.Visit(duplicatedConflicts)
|
|
|
|
|
|
if len(conflicts) > 0 {
|
|
if len(conflicts) > 0 {
|
|
- return fmt.Errorf("the following directives are specified both as a flag and in the configuration file: %s", strings.Join(conflicts, ", "))
|
|
|
|
|
|
+ return errors.Errorf("the following directives are specified both as a flag and in the configuration file: %s", strings.Join(conflicts, ", "))
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
@@ -572,7 +572,7 @@ func Validate(config *Config) error {
|
|
// validate log-level
|
|
// validate log-level
|
|
if config.LogLevel != "" {
|
|
if config.LogLevel != "" {
|
|
if _, err := logrus.ParseLevel(config.LogLevel); err != nil {
|
|
if _, err := logrus.ParseLevel(config.LogLevel); err != nil {
|
|
- return fmt.Errorf("invalid logging level: %s", config.LogLevel)
|
|
|
|
|
|
+ return errors.Errorf("invalid logging level: %s", config.LogLevel)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -599,22 +599,22 @@ func Validate(config *Config) error {
|
|
|
|
|
|
// TODO(thaJeztah) Validations below should not accept "0" to be valid; see Validate() for a more in-depth description of this problem
|
|
// TODO(thaJeztah) Validations below should not accept "0" to be valid; see Validate() for a more in-depth description of this problem
|
|
if config.Mtu < 0 {
|
|
if config.Mtu < 0 {
|
|
- return fmt.Errorf("invalid default MTU: %d", config.Mtu)
|
|
|
|
|
|
+ return errors.Errorf("invalid default MTU: %d", config.Mtu)
|
|
}
|
|
}
|
|
if config.MaxConcurrentDownloads < 0 {
|
|
if config.MaxConcurrentDownloads < 0 {
|
|
- return fmt.Errorf("invalid max concurrent downloads: %d", config.MaxConcurrentDownloads)
|
|
|
|
|
|
+ return errors.Errorf("invalid max concurrent downloads: %d", config.MaxConcurrentDownloads)
|
|
}
|
|
}
|
|
if config.MaxConcurrentUploads < 0 {
|
|
if config.MaxConcurrentUploads < 0 {
|
|
- return fmt.Errorf("invalid max concurrent uploads: %d", config.MaxConcurrentUploads)
|
|
|
|
|
|
+ return errors.Errorf("invalid max concurrent uploads: %d", config.MaxConcurrentUploads)
|
|
}
|
|
}
|
|
if config.MaxDownloadAttempts < 0 {
|
|
if config.MaxDownloadAttempts < 0 {
|
|
- return fmt.Errorf("invalid max download attempts: %d", config.MaxDownloadAttempts)
|
|
|
|
|
|
+ return errors.Errorf("invalid max download attempts: %d", config.MaxDownloadAttempts)
|
|
}
|
|
}
|
|
|
|
|
|
// validate that "default" runtime is not reset
|
|
// validate that "default" runtime is not reset
|
|
if runtimes := config.GetAllRuntimes(); len(runtimes) > 0 {
|
|
if runtimes := config.GetAllRuntimes(); len(runtimes) > 0 {
|
|
if _, ok := runtimes[StockRuntimeName]; ok {
|
|
if _, ok := runtimes[StockRuntimeName]; ok {
|
|
- return fmt.Errorf("runtime name '%s' is reserved", StockRuntimeName)
|
|
|
|
|
|
+ return errors.Errorf("runtime name '%s' is reserved", StockRuntimeName)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -626,7 +626,7 @@ func Validate(config *Config) error {
|
|
if !builtinRuntimes[defaultRuntime] {
|
|
if !builtinRuntimes[defaultRuntime] {
|
|
runtimes := config.GetAllRuntimes()
|
|
runtimes := config.GetAllRuntimes()
|
|
if _, ok := runtimes[defaultRuntime]; !ok && !IsPermissibleC8dRuntimeName(defaultRuntime) {
|
|
if _, ok := runtimes[defaultRuntime]; !ok && !IsPermissibleC8dRuntimeName(defaultRuntime) {
|
|
- return fmt.Errorf("specified default runtime '%s' does not exist", defaultRuntime)
|
|
|
|
|
|
+ return errors.Errorf("specified default runtime '%s' does not exist", defaultRuntime)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|