Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -37,7 +37,7 @@ func (bt *Tagger) TagImages(imageID image.ID) error {
|
| 37 | 37 |
for _, rt := range bt.repoAndTags {
|
| 38 | 38 |
// TODO @jhowardmsft LCOW support. Will need revisiting. |
| 39 | 39 |
platform := runtime.GOOS |
| 40 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 40 |
+ if system.LCOWSupported() {
|
|
| 41 | 41 |
platform = "linux" |
| 42 | 42 |
} |
| 43 | 43 |
if err := bt.imageComponent.TagImageWithReference(imageID, platform, rt); err != nil {
|
| ... | ... |
@@ -101,7 +101,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite |
| 101 | 101 |
// } |
| 102 | 102 |
// valid := []string{runtime.GOOS}
|
| 103 | 103 |
// |
| 104 |
- // if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 104 |
+ // if system.LCOWSupported() {
|
|
| 105 | 105 |
// valid = append(valid, "linux") |
| 106 | 106 |
// } |
| 107 | 107 |
// |
| ... | ... |
@@ -118,7 +118,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite |
| 118 | 118 |
// return err |
| 119 | 119 |
// } |
| 120 | 120 |
platform := runtime.GOOS |
| 121 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 121 |
+ if system.LCOWSupported() {
|
|
| 122 | 122 |
platform = "linux" |
| 123 | 123 |
} |
| 124 | 124 |
|
| ... | ... |
@@ -233,7 +233,7 @@ func (s *dispatchState) beginStage(stageName string, image builder.Image) {
|
| 233 | 233 |
func (s *dispatchState) setDefaultPath() {
|
| 234 | 234 |
// TODO @jhowardmsft LCOW Support - This will need revisiting later |
| 235 | 235 |
platform := runtime.GOOS |
| 236 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 236 |
+ if system.LCOWSupported() {
|
|
| 237 | 237 |
platform = "linux" |
| 238 | 238 |
} |
| 239 | 239 |
if system.DefaultPathEnv(platform) == "" {
|
| ... | ... |
@@ -91,8 +91,8 @@ var ( |
| 91 | 91 |
// DefaultEscapeToken is the default escape token |
| 92 | 92 |
const DefaultEscapeToken = '\\' |
| 93 | 93 |
|
| 94 |
-// DefaultPlatformToken is the platform assumed for the build if not explicitly provided |
|
| 95 |
-var DefaultPlatformToken = runtime.GOOS |
|
| 94 |
+// defaultPlatformToken is the platform assumed for the build if not explicitly provided |
|
| 95 |
+var defaultPlatformToken = runtime.GOOS |
|
| 96 | 96 |
|
| 97 | 97 |
// Directive is the structure used during a build run to hold the state of |
| 98 | 98 |
// parsing directives. |
| ... | ... |
@@ -119,7 +119,7 @@ func (d *Directive) setEscapeToken(s string) error {
|
| 119 | 119 |
func (d *Directive) setPlatformToken(s string) error {
|
| 120 | 120 |
s = strings.ToLower(s) |
| 121 | 121 |
valid := []string{runtime.GOOS}
|
| 122 |
- if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 122 |
+ if system.LCOWSupported() {
|
|
| 123 | 123 |
valid = append(valid, "linux") |
| 124 | 124 |
} |
| 125 | 125 |
for _, item := range valid {
|
| ... | ... |
@@ -154,7 +154,7 @@ func (d *Directive) possibleParserDirective(line string) error {
|
| 154 | 154 |
|
| 155 | 155 |
// TODO @jhowardmsft LCOW Support: Eventually this check can be removed, |
| 156 | 156 |
// but only recognise a platform token if running in LCOW mode. |
| 157 |
- if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 157 |
+ if system.LCOWSupported() {
|
|
| 158 | 158 |
tpcMatch := tokenPlatformCommand.FindStringSubmatch(strings.ToLower(line)) |
| 159 | 159 |
if len(tpcMatch) != 0 {
|
| 160 | 160 |
for i, n := range tokenPlatformCommand.SubexpNames() {
|
| ... | ... |
@@ -177,7 +177,7 @@ func (d *Directive) possibleParserDirective(line string) error {
|
| 177 | 177 |
func NewDefaultDirective() *Directive {
|
| 178 | 178 |
directive := Directive{}
|
| 179 | 179 |
directive.setEscapeToken(string(DefaultEscapeToken)) |
| 180 |
- directive.setPlatformToken(runtime.GOOS) |
|
| 180 |
+ directive.setPlatformToken(defaultPlatformToken) |
|
| 181 | 181 |
return &directive |
| 182 | 182 |
} |
| 183 | 183 |
|
| ... | ... |
@@ -1038,7 +1038,7 @@ func (container *Container) CreateDaemonEnvironment(tty bool, linkedEnv []string |
| 1038 | 1038 |
platform = runtime.GOOS |
| 1039 | 1039 |
} |
| 1040 | 1040 |
env := []string{}
|
| 1041 |
- if runtime.GOOS != "windows" || (runtime.GOOS == "windows" && system.LCOWSupported() && platform == "linux") {
|
|
| 1041 |
+ if runtime.GOOS != "windows" || (system.LCOWSupported() && platform == "linux") {
|
|
| 1042 | 1042 |
env = []string{
|
| 1043 | 1043 |
"PATH=" + system.DefaultPathEnv(platform), |
| 1044 | 1044 |
"HOSTNAME=" + container.Config.Hostname, |
| ... | ... |
@@ -1052,7 +1052,6 @@ func (container *Container) CreateDaemonEnvironment(tty bool, linkedEnv []string |
| 1052 | 1052 |
// because the env on the container can override certain default values |
| 1053 | 1053 |
// we need to replace the 'env' keys where they match and append anything |
| 1054 | 1054 |
// else. |
| 1055 |
- //return ReplaceOrAppendEnvValues(linkedEnv, container.Config.Env) |
|
| 1056 |
- foo := ReplaceOrAppendEnvValues(env, container.Config.Env) |
|
| 1057 |
- return foo |
|
| 1055 |
+ env = ReplaceOrAppendEnvValues(env, container.Config.Env) |
|
| 1056 |
+ return env |
|
| 1058 | 1057 |
} |
| ... | ... |
@@ -93,7 +93,7 @@ func (c *containerAdapter) pullImage(ctx context.Context) error {
|
| 93 | 93 |
// TODO @jhowardmsft LCOW Support: This will need revisiting as |
| 94 | 94 |
// the stack is built up to include LCOW support for swarm. |
| 95 | 95 |
platform := runtime.GOOS |
| 96 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 96 |
+ if system.LCOWSupported() {
|
|
| 97 | 97 |
platform = "linux" |
| 98 | 98 |
} |
| 99 | 99 |
err := c.backend.PullImage(ctx, c.container.image(), "", platform, metaHeaders, authConfig, pw) |
| ... | ... |
@@ -82,7 +82,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) ( |
| 82 | 82 |
if params.Platform == "" {
|
| 83 | 83 |
params.Platform = runtime.GOOS |
| 84 | 84 |
} |
| 85 |
- if params.Platform == "windows" && system.LCOWSupported() {
|
|
| 85 |
+ if system.LCOWSupported() {
|
|
| 86 | 86 |
params.Platform = "linux" |
| 87 | 87 |
} |
| 88 | 88 |
|
| ... | ... |
@@ -106,7 +106,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) ( |
| 106 | 106 |
if img != nil {
|
| 107 | 107 |
if params.Platform != img.Platform() {
|
| 108 | 108 |
// Ignore this in LCOW mode. @jhowardmsft TODO - This will need revisiting later. |
| 109 |
- if !(runtime.GOOS == "windows" && system.LCOWSupported()) {
|
|
| 109 |
+ if !system.LCOWSupported() {
|
|
| 110 | 110 |
return nil, fmt.Errorf("cannot create a %s container from a %s image", params.Platform, img.Platform())
|
| 111 | 111 |
} |
| 112 | 112 |
} |
| ... | ... |
@@ -118,7 +118,7 @@ func (d *Driver) terminateUvm(context string) error {
|
| 118 | 118 |
|
| 119 | 119 |
// FIXME: @jhowardmsft |
| 120 | 120 |
// This isn't thread-safe yet, but will change anyway with the lifetime |
| 121 |
- // changes and multiple instances. Defering that work for now. |
|
| 121 |
+ // changes and multiple instances. Deferring that work for now. |
|
| 122 | 122 |
uvm := d.config.Uvm |
| 123 | 123 |
d.config.Uvm = nil |
| 124 | 124 |
|
| ... | ... |
@@ -190,7 +190,6 @@ func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
| 190 | 190 |
// Make sure layers are created with the correct ACL so that VMs can access them. |
| 191 | 191 |
layerPath := d.dir(id) |
| 192 | 192 |
logrus.Debugf("lcowdriver: create: id %s: creating layerPath %s", id, layerPath)
|
| 193 |
- // Make sure the layers are created with the correct ACL so that VMs can access them. |
|
| 194 | 193 |
if err := system.MkdirAllWithACL(layerPath, 755, system.SddlNtvmAdministratorsLocalSystem); err != nil {
|
| 195 | 194 |
return err |
| 196 | 195 |
} |
| ... | ... |
@@ -154,7 +154,7 @@ func (d *Driver) Status() [][2]string {
|
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
// panicIfUsedByLcow does exactly what it says. |
| 157 |
-// TODO @jhowardmsft - this is an temporary measure for the bring-up of |
|
| 157 |
+// TODO @jhowardmsft - this is a temporary measure for the bring-up of |
|
| 158 | 158 |
// Linux containers on Windows. It is a failsafe to ensure that the right |
| 159 | 159 |
// graphdriver is used. |
| 160 | 160 |
func panicIfUsedByLcow() {
|
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
| 17 | 17 |
// TODO @jhowardmsft LCOW. This will need revisiting later. |
| 18 | 18 |
platform := runtime.GOOS |
| 19 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 19 |
+ if system.LCOWSupported() {
|
|
| 20 | 20 |
platform = "linux" |
| 21 | 21 |
} |
| 22 | 22 |
imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon) |
| ... | ... |
@@ -29,7 +29,7 @@ func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
| 29 | 29 |
func (daemon *Daemon) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
|
| 30 | 30 |
// TODO @jhowardmsft LCOW. This will need revisiting later. |
| 31 | 31 |
platform := runtime.GOOS |
| 32 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 32 |
+ if system.LCOWSupported() {
|
|
| 33 | 33 |
platform = "linux" |
| 34 | 34 |
} |
| 35 | 35 |
imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon) |
| ... | ... |
@@ -43,7 +43,7 @@ func (daemon *Daemon) PushImage(ctx context.Context, image, tag string, metaHead |
| 43 | 43 |
|
| 44 | 44 |
// TODO @jhowardmsft LCOW Support. This will require revisiting. For now, hard-code. |
| 45 | 45 |
platform := runtime.GOOS |
| 46 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 46 |
+ if system.LCOWSupported() {
|
|
| 47 | 47 |
platform = "linux" |
| 48 | 48 |
} |
| 49 | 49 |
|
| ... | ... |
@@ -38,7 +38,7 @@ func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
|
| 38 | 38 |
func (daemon *Daemon) Map() map[image.ID]*image.Image {
|
| 39 | 39 |
// TODO @jhowardmsft LCOW. This will need work to enumerate the stores for all platforms. |
| 40 | 40 |
platform := runtime.GOOS |
| 41 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 41 |
+ if system.LCOWSupported() {
|
|
| 42 | 42 |
platform = "linux" |
| 43 | 43 |
} |
| 44 | 44 |
return daemon.stores[platform].imageStore.Map() |
| ... | ... |
@@ -53,7 +53,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs |
| 53 | 53 |
|
| 54 | 54 |
// TODO @jhowardmsft LCOW. This will need work to enumerate the stores for all platforms. |
| 55 | 55 |
platform := runtime.GOOS |
| 56 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 56 |
+ if system.LCOWSupported() {
|
|
| 57 | 57 |
platform = "linux" |
| 58 | 58 |
} |
| 59 | 59 |
|
| ... | ... |
@@ -90,7 +90,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 90 | 90 |
|
| 91 | 91 |
// TODO @jhowardmsft LCOW support. For now, hard-code the platform shown for the driver status |
| 92 | 92 |
p := runtime.GOOS |
| 93 |
- if p == "windows" && system.LCOWSupported() {
|
|
| 93 |
+ if system.LCOWSupported() {
|
|
| 94 | 94 |
p = "linux" |
| 95 | 95 |
} |
| 96 | 96 |
|
| ... | ... |
@@ -161,7 +161,7 @@ func (daemon *Daemon) VolumesPrune(ctx context.Context, pruneFilters filters.Arg |
| 161 | 161 |
func (daemon *Daemon) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) {
|
| 162 | 162 |
// TODO @jhowardmsft LCOW Support: This will need revisiting later. |
| 163 | 163 |
platform := runtime.GOOS |
| 164 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 164 |
+ if system.LCOWSupported() {
|
|
| 165 | 165 |
platform = "linux" |
| 166 | 166 |
} |
| 167 | 167 |
|
| ... | ... |
@@ -491,7 +491,7 @@ func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverif |
| 491 | 491 |
// the history does, but unfortunately that's a string, so search through |
| 492 | 492 |
// all the history until hopefully we find one which indicates the os. |
| 493 | 493 |
platform := runtime.GOOS |
| 494 |
- if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 494 |
+ if system.LCOWSupported() {
|
|
| 495 | 495 |
type config struct {
|
| 496 | 496 |
Os string `json:"os,omitempty"` |
| 497 | 497 |
} |
| ... | ... |
@@ -3,7 +3,6 @@ package image |
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
"fmt" |
| 6 |
- "runtime" |
|
| 7 | 6 |
"strings" |
| 8 | 7 |
"sync" |
| 9 | 8 |
|
| ... | ... |
@@ -116,8 +115,9 @@ func (is *store) Create(config []byte) (ID, error) {
|
| 116 | 116 |
return "", err |
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 |
+ // TODO @jhowardmsft - LCOW Support. This will need revisiting. |
|
| 119 | 120 |
// Integrity check - ensure we are creating something for the correct platform |
| 120 |
- if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 121 |
+ if system.LCOWSupported() {
|
|
| 121 | 122 |
if strings.ToLower(img.Platform()) != strings.ToLower(is.platform) {
|
| 122 | 123 |
return "", fmt.Errorf("cannot create entry for platform %q in image store for platform %q", img.Platform(), is.platform)
|
| 123 | 124 |
} |
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"io" |
| 7 | 7 |
"io/ioutil" |
| 8 |
- "runtime" |
|
| 9 | 8 |
"strings" |
| 10 | 9 |
"sync" |
| 11 | 10 |
|
| ... | ... |
@@ -273,7 +272,7 @@ func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, platf |
| 273 | 273 |
var p *roLayer |
| 274 | 274 |
|
| 275 | 275 |
// Integrity check - ensure we are creating something for the correct platform |
| 276 |
- if runtime.GOOS == "windows" && system.LCOWSupported() {
|
|
| 276 |
+ if system.LCOWSupported() {
|
|
| 277 | 277 |
if strings.ToLower(ls.platform) != strings.ToLower(string(platform)) {
|
| 278 | 278 |
return nil, fmt.Errorf("cannot create entry for platform %q in layer store for platform %q", platform, ls.platform)
|
| 279 | 279 |
} |
| ... | ... |
@@ -353,7 +353,7 @@ func isEqualPrivilege(a, b types.PluginPrivilege) bool {
|
| 353 | 353 |
func configToRootFS(c []byte) (*image.RootFS, layer.Platform, error) {
|
| 354 | 354 |
// TODO @jhowardmsft LCOW - Will need to revisit this. For now, calculate the platform. |
| 355 | 355 |
platform := layer.Platform(runtime.GOOS) |
| 356 |
- if platform == "windows" && system.LCOWSupported() {
|
|
| 356 |
+ if system.LCOWSupported() {
|
|
| 357 | 357 |
platform = "linux" |
| 358 | 358 |
} |
| 359 | 359 |
var pluginConfig types.PluginConfig |