github.com/noxiouz/docker@v0.7.3-0.20160629055221-3d231c78e8c5/libcontainerd/utils_windows.go (about)

     1  package libcontainerd
     2  
     3  import (
     4  	"strconv"
     5  	"strings"
     6  )
     7  
     8  // setupEnvironmentVariables convert a string array of environment variables
     9  // into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
    10  func setupEnvironmentVariables(a []string) map[string]string {
    11  	r := make(map[string]string)
    12  	for _, s := range a {
    13  		arr := strings.Split(s, "=")
    14  		if len(arr) == 2 {
    15  			r[arr[0]] = arr[1]
    16  		}
    17  	}
    18  	return r
    19  }
    20  
    21  // Apply for a servicing option is a no-op.
    22  func (s *ServicingOption) Apply(interface{}) error {
    23  	return nil
    24  }
    25  
    26  // buildFromVersion takes an image version string and returns the Windows build
    27  // number. It returns 0 if the build number is not present.
    28  func buildFromVersion(osver string) int {
    29  	v := strings.Split(osver, ".")
    30  	if len(v) < 3 {
    31  		return 0
    32  	}
    33  	if build, err := strconv.Atoi(v[2]); err == nil {
    34  		return build
    35  	}
    36  	return 0
    37  }