2016-03-18 18:53:27 +00:00
|
|
|
package libcontainerd
|
|
|
|
|
2016-06-24 22:24:06 +00:00
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
)
|
2016-03-18 18:53:27 +00:00
|
|
|
|
2016-08-29 10:37:14 +00:00
|
|
|
// setupEnvironmentVariables converts a string array of environment variables
|
2016-03-18 18:53:27 +00:00
|
|
|
// into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
|
|
|
|
func setupEnvironmentVariables(a []string) map[string]string {
|
|
|
|
r := make(map[string]string)
|
|
|
|
for _, s := range a {
|
2016-09-04 22:44:13 +00:00
|
|
|
arr := strings.SplitN(s, "=", 2)
|
2016-03-18 18:53:27 +00:00
|
|
|
if len(arr) == 2 {
|
|
|
|
r[arr[0]] = arr[1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return r
|
|
|
|
}
|
2016-04-13 20:34:07 +00:00
|
|
|
|
|
|
|
// Apply for a servicing option is a no-op.
|
|
|
|
func (s *ServicingOption) Apply(interface{}) error {
|
|
|
|
return nil
|
|
|
|
}
|
2016-06-24 22:24:06 +00:00
|
|
|
|
|
|
|
// buildFromVersion takes an image version string and returns the Windows build
|
|
|
|
// number. It returns 0 if the build number is not present.
|
|
|
|
func buildFromVersion(osver string) int {
|
|
|
|
v := strings.Split(osver, ".")
|
|
|
|
if len(v) < 3 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
if build, err := strconv.Atoi(v[2]); err == nil {
|
|
|
|
return build
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|