24850430 dns/client disabled in container
authorshreya.jain@oracle.com <shreya.jain@oracle.com>
Mon, 07 Nov 2016 11:25:12 -0800
changeset 7254 b5b14b374b25
parent 7253 8b61bf5be99d
child 7257 779372532897
24850430 dns/client disabled in container
components/docker/patches/0001-Solaris-v1.10.3.patch
--- a/components/docker/patches/0001-Solaris-v1.10.3.patch	Mon Nov 07 10:43:40 2016 -0800
+++ b/components/docker/patches/0001-Solaris-v1.10.3.patch	Mon Nov 07 11:25:12 2016 -0800
@@ -1,6 +1,6 @@
-From e71700670d67ea6eca368ec2703782b0a58a47f9 Mon Sep 17 00:00:00 2001
-From: "[email protected]" <[email protected]>
-Date: Tue, 1 Nov 2016 10:54:49 -0700
+From dd4abad90dcd396fc3d61a0dd0d16e9c0b611700 Mon Sep 17 00:00:00 2001
+From: Shreya Jain <[email protected]>
+Date: Mon, 7 Nov 2016 11:14:24 -0800
 Subject: [PATCH] Solaris-v1.10.3
 
 ---
@@ -33,7 +33,7 @@
  daemon/execdriver/driver_solaris.go                |   76 ++
  daemon/execdriver/driver_unix.go                   |    2 +-
  .../execdriver/execdrivers/execdrivers_solaris.go  |   13 +
- daemon/execdriver/zones/driver.go                  |  767 ++++++++++++++
+ daemon/execdriver/zones/driver.go                  |  819 +++++++++++++++
  daemon/execdriver/zones/driver_unsupported.go      |   12 +
  .../execdriver/zones/driver_unsupported_nocgo.go   |   13 +
  daemon/graphdriver/driver_solaris.go               |    8 +
@@ -197,7 +197,7 @@
  vendor/src/gopkg.in/fsnotify.v1/fsnotify.go        |    2 +-
  volume/local/local_unix.go                         |    2 +-
  volume/store/store_unix.go                         |    2 +-
- 193 files changed, 9144 insertions(+), 1241 deletions(-)
+ 193 files changed, 9196 insertions(+), 1241 deletions(-)
  create mode 100644 Dockerfile.solaris
  create mode 100644 container/container_solaris.go
  create mode 100644 container/state_solaris.go
@@ -3292,10 +3292,10 @@
 +}
 diff --git a/daemon/execdriver/zones/driver.go b/daemon/execdriver/zones/driver.go
 new file mode 100644
-index 0000000..d23b95b
+index 0000000..e0ac9f6
 --- /dev/null
 +++ b/daemon/execdriver/zones/driver.go
-@@ -0,0 +1,767 @@
+@@ -0,0 +1,819 @@
 +// +build solaris,cgo
 +
 +package zones
@@ -3314,6 +3314,7 @@
 +	"strings"
 +	"sync"
 +	"syscall"
++	"bufio"
 +
 +	"github.com/Sirupsen/logrus"
 +	"github.com/docker/docker/daemon/execdriver"
@@ -3874,13 +3875,64 @@
 +		return execdriver.ExitStatus{ExitCode: -1}, err
 +	}
 +
++	cmd := exec.Command(SVCCFG, "-s", "svc:/network/dns/client:default", "listprop", "general/enabled")
++	outbufgen := new(bytes.Buffer)
++	cmd.Stdout = outbufgen
++	if err = cmd.Run(); err != nil {
++		logrus.Errorf("Error listing property: %s", err)
++		return execdriver.ExitStatus{ExitCode: -1}, err
++	}
++
++	cmd = exec.Command(SVCCFG, "-s", "svc:/network/dns/client:default", "listprop", "general_ovr/enabled")
++	outbufgenovr := new(bytes.Buffer)
++	cmd.Stdout = outbufgenovr
++	if err = cmd.Run(); err != nil {
++		logrus.Errorf("Error listing property: %s", err)
++		return execdriver.ExitStatus{ExitCode: -1}, err
++	}
++
++	if strings.Contains(outbufgen.String(), "false") && strings.Contains(outbufgenovr.String(), "true") {
++		PathDnsOvrXml := filepath.Join(ProfilesPath, "/dns_ovr_client.xml")
++		var f *os.File
++		FoundDnsClient := false
++
++		if f, err = os.Open(PathDnsXml); err != nil {
++			logrus.Errorf("Error opening file: %v", err)
++			return execdriver.ExitStatus{ExitCode: -1}, err
++		}
++		scanner := bufio.NewScanner(f)
++
++		if f, err = os.Create(PathDnsOvrXml); err != nil {
++			logrus.Errorf("Error creating file: %v", err)
++			return execdriver.ExitStatus{ExitCode: -1}, err
++		}
++		wr := bufio.NewWriter(f)
++
++		for scanner.Scan() {
++			line := scanner.Text()
++			if strings.Contains(line, "network/dns/client") {
++				FoundDnsClient = true
++			}
++			if (strings.Contains(line, "<instance name=\"default\"") || strings.Contains(line, "<create_default_instance")) && FoundDnsClient == true {
++				if strings.Contains(line, "enabled") {
++					src := bytes.Replace([]byte(line), []byte("false"), []byte("true"), -1)
++					line = string(src[:])
++				}
++				FoundDnsClient = false
++			}
++			wr.WriteString(line)
++			wr.Flush()
++		}
++		os.Remove(PathDnsXml)
++	}
++
 +	err = exec.Command(SVCCFG, "extract", "name-service/switch", ">", PathNSSwitchXml).Run()
 +	if err != nil {
 +		logrus.Errorf("Error exporting name-service/switch: %v", err)
 +		return execdriver.ExitStatus{ExitCode: -1}, err
 +	}
 +
-+	cmd := exec.Command(RUNZ, "run", c.Name, filepath.Dir(filepath.Dir(c.Rootfs)))
++	cmd = exec.Command(RUNZ, "run", c.Name, filepath.Dir(filepath.Dir(c.Rootfs)))
 +	cmd.Dir = filepath.Dir(filepath.Dir(c.Rootfs))
 +	cmd.Stdout = pipes.Stdout
 +	cmd.Stderr = pipes.Stderr