From de25daa9281709a90e4dc23b4c27cbcdcef32fd3 Mon Sep 17 00:00:00 2001 From: 5schatten Date: Sat, 29 Jun 2019 17:58:09 +0200 Subject: [PATCH] use Kodi addon storage location --- .../github.com/docker/docker/registry/config_unix.go | 2 +- .../github.com/docker/docker/registry/endpoint_v1.go | 2 +- components/engine/cmd/dockerd/daemon_unix.go | 4 ++-- components/engine/daemon/config/config_test.go | 2 +- .../engine/integration-cli/docker_cli_daemon_test.go | 12 ++++++------ .../docker_cli_external_volume_driver_unix_test.go | 8 ++++---- .../integration-cli/docker_cli_network_unix_test.go | 8 ++++---- .../engine/integration-cli/docker_cli_swarm_test.go | 8 ++++---- .../integration/plugin/authz/authz_plugin_test.go | 6 +++--- .../integration/plugin/graphdriver/external_test.go | 6 +++--- components/engine/pkg/plugins/discovery_unix.go | 2 +- components/engine/pkg/plugins/plugins.go | 2 +- components/engine/registry/config_unix.go | 2 +- components/engine/registry/endpoint_v1.go | 2 +- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/components/cli/vendor/github.com/docker/docker/registry/config_unix.go b/components/cli/vendor/github.com/docker/docker/registry/config_unix.go index 20fb47bcae..a023df7895 100644 --- a/components/cli/vendor/github.com/docker/docker/registry/config_unix.go +++ b/components/cli/vendor/github.com/docker/docker/registry/config_unix.go @@ -4,7 +4,7 @@ package registry // import "github.com/docker/docker/registry" var ( // CertsDir is the directory where certificates are stored - CertsDir = "/etc/docker/certs.d" + CertsDir = "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d" ) // cleanPath is used to ensure that a directory name is valid on the target diff --git a/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go b/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go index 832fdb95a4..606ddfaf96 100644 --- a/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go +++ b/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go @@ -49,7 +49,7 @@ func validateEndpoint(endpoint *V1Endpoint) error { if endpoint.IsSecure { // If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry` // in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fallback to HTTP. - return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) + return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) } // If registry is insecure and HTTPS failed, fallback to HTTP. diff --git a/components/engine/cmd/dockerd/daemon_unix.go b/components/engine/cmd/dockerd/daemon_unix.go index 7b03e28594..74fc0cfe24 100644 --- a/components/engine/cmd/dockerd/daemon_unix.go +++ b/components/engine/cmd/dockerd/daemon_unix.go @@ -19,7 +19,7 @@ import ( "golang.org/x/sys/unix" ) -const defaultDaemonConfigFile = "/etc/docker/daemon.json" +const defaultDaemonConfigFile = "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json" // setDefaultUmask sets the umask to 0022 to avoid problems // caused by custom umask @@ -34,7 +34,7 @@ func setDefaultUmask() error { } func getDaemonConfDir(_ string) string { - return "/etc/docker" + return "/storage/.kodi/userdata/addon_data/service.system.docker/config" } func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) { diff --git a/components/engine/daemon/config/config_test.go b/components/engine/daemon/config/config_test.go index 6998ed3312..c255b62146 100644 --- a/components/engine/daemon/config/config_test.go +++ b/components/engine/daemon/config/config_test.go @@ -463,7 +463,7 @@ func TestReloadSetConfigFileNotExist(t *testing.T) { func TestReloadDefaultConfigNotExist(t *testing.T) { skip.If(t, os.Getuid() != 0, "skipping test that requires root") reloaded := false - configFile := "/etc/docker/daemon.json" + configFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json" flags := pflag.NewFlagSet("test", pflag.ContinueOnError) flags.String("config-file", configFile, "") err := Reload(configFile, flags, func(c *Config) { diff --git a/components/engine/integration-cli/docker_cli_daemon_test.go b/components/engine/integration-cli/docker_cli_daemon_test.go index d3cd5f1676..b5e504489d 100644 --- a/components/engine/integration-cli/docker_cli_daemon_test.go +++ b/components/engine/integration-cli/docker_cli_daemon_test.go @@ -546,11 +546,11 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) { func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { // TODO: skip or update for Windows daemon - os.Remove("/etc/docker/key.json") + os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") s.d.Start(c) s.d.Stop(c) - k, err := libtrust.LoadKeyFile("/etc/docker/key.json") + k, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") if err != nil { c.Fatalf("Error opening key file") } @@ -1198,12 +1198,12 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { Y string `json:"y"` } - os.Remove("/etc/docker/key.json") + os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") s.d.Start(c) s.d.Stop(c) config := &Config{} - bytes, err := ioutil.ReadFile("/etc/docker/key.json") + bytes, err := ioutil.ReadFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") if err != nil { c.Fatalf("Error reading key.json file: %s", err) } @@ -1223,11 +1223,11 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { } // write back - if err := ioutil.WriteFile("/etc/docker/key.json", newBytes, 0400); err != nil { + if err := ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json", newBytes, 0400); err != nil { c.Fatalf("Error ioutil.WriteFile: %s", err) } - defer os.Remove("/etc/docker/key.json") + defer os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") if err := s.d.StartWithError(); err == nil { c.Fatalf("It should not be successful to start daemon with wrong key: %v", err) diff --git a/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go b/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go index da8bb7e011..605a162e79 100644 --- a/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go +++ b/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go @@ -267,10 +267,10 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin { send(w, `{"Capabilities": { "Scope": "global" }}`) }) - err := os.MkdirAll("/etc/docker/plugins", 0755) + err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) assert.NilError(c, err) - err = ioutil.WriteFile("/etc/docker/plugins/"+name+".spec", []byte(s.Server.URL), 0644) + err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/"+name+".spec", []byte(s.Server.URL), 0644) assert.NilError(c, err) return s } @@ -278,7 +278,7 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin { func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) { s.volumePlugin.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") assert.NilError(c, err) } @@ -371,7 +371,7 @@ func hostVolumePath(name string) string { // Make sure a request to use a down driver doesn't block other requests func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) { - specPath := "/etc/docker/plugins/down-driver.spec" + specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/down-driver.spec" err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644) c.Assert(err, check.IsNil) defer os.RemoveAll(specPath) diff --git a/components/engine/integration-cli/docker_cli_network_unix_test.go b/components/engine/integration-cli/docker_cli_network_unix_test.go index d3d6256a75..a0f0ae973d 100644 --- a/components/engine/integration-cli/docker_cli_network_unix_test.go +++ b/components/engine/integration-cli/docker_cli_network_unix_test.go @@ -208,14 +208,14 @@ func setupRemoteNetworkDrivers(c *check.C, mux *http.ServeMux, url, netDrv, ipam } }) - err := os.MkdirAll("/etc/docker/plugins", 0755) + err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) assert.NilError(c, err) - fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv) + fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv) err = ioutil.WriteFile(fileName, []byte(url), 0644) assert.NilError(c, err) - ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv) + ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv) err = ioutil.WriteFile(ipamFileName, []byte(url), 0644) assert.NilError(c, err) } @@ -227,7 +227,7 @@ func (s *DockerNetworkSuite) TearDownSuite(c *check.C) { s.server.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") assert.NilError(c, err) } diff --git a/components/engine/integration-cli/docker_cli_swarm_test.go b/components/engine/integration-cli/docker_cli_swarm_test.go index f6fadcf995..5d0b5256c1 100644 --- a/components/engine/integration-cli/docker_cli_swarm_test.go +++ b/components/engine/integration-cli/docker_cli_swarm_test.go @@ -783,14 +783,14 @@ func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, } }) - err := os.MkdirAll("/etc/docker/plugins", 0755) + err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) assert.NilError(c, err) - fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv) + fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv) err = ioutil.WriteFile(fileName, []byte(url), 0644) assert.NilError(c, err) - ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv) + ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv) err = ioutil.WriteFile(ipamFileName, []byte(url), 0644) assert.NilError(c, err) } @@ -802,7 +802,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) { setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin) defer func() { s.server.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") assert.NilError(c, err) }() diff --git a/components/engine/integration/plugin/authz/authz_plugin_test.go b/components/engine/integration/plugin/authz/authz_plugin_test.go index 105affc1af..fa631a377a 100644 --- a/components/engine/integration/plugin/authz/authz_plugin_test.go +++ b/components/engine/integration/plugin/authz/authz_plugin_test.go @@ -55,15 +55,15 @@ func setupTestV1(t *testing.T) func() { ctrl = &authorizationController{} teardown := setupTest(t) - err := os.MkdirAll("/etc/docker/plugins", 0755) + err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) assert.NilError(t, err) - fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin) + fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", testAuthZPlugin) err = ioutil.WriteFile(fileName, []byte(server.URL), 0644) assert.NilError(t, err) return func() { - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") assert.NilError(t, err) teardown() diff --git a/components/engine/integration/plugin/graphdriver/external_test.go b/components/engine/integration/plugin/graphdriver/external_test.go index 99ce60ceef..53242b1ee0 100644 --- a/components/engine/integration/plugin/graphdriver/external_test.go +++ b/components/engine/integration/plugin/graphdriver/external_test.go @@ -79,7 +79,7 @@ func TestExternalGraphDriver(t *testing.T) { sserver.Close() jserver.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") assert.NilError(t, err) } @@ -344,10 +344,10 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu respond(w, &graphDriverResponse{Size: size}) }) - err = os.MkdirAll("/etc/docker/plugins", 0755) + err = os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) assert.NilError(t, err) - specFile := "/etc/docker/plugins/" + name + "." + ext + specFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/" + name + "." + ext err = ioutil.WriteFile(specFile, b, 0644) assert.NilError(t, err) } diff --git a/components/engine/pkg/plugins/discovery_unix.go b/components/engine/pkg/plugins/discovery_unix.go index 58058f2828..a7b449ca25 100644 --- a/components/engine/pkg/plugins/discovery_unix.go +++ b/components/engine/pkg/plugins/discovery_unix.go @@ -2,4 +2,4 @@ package plugins // import "github.com/docker/docker/pkg/plugins" -var specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"} +var specsPaths = []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"} diff --git a/components/engine/pkg/plugins/plugins.go b/components/engine/pkg/plugins/plugins.go index 6962079df9..77b69265b1 100644 --- a/components/engine/pkg/plugins/plugins.go +++ b/components/engine/pkg/plugins/plugins.go @@ -4,7 +4,7 @@ // Docker discovers plugins by looking for them in the plugin directory whenever // a user or container tries to use one by name. UNIX domain socket files must // be located under /run/docker/plugins, whereas spec files can be located -// either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled +// either under /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins or /usr/lib/docker/plugins. This is handled // by the Registry interface, which lets you list all plugins or get a plugin by // its name if it exists. // diff --git a/components/engine/registry/config_unix.go b/components/engine/registry/config_unix.go index 20fb47bcae..a023df7895 100644 --- a/components/engine/registry/config_unix.go +++ b/components/engine/registry/config_unix.go @@ -4,7 +4,7 @@ package registry // import "github.com/docker/docker/registry" var ( // CertsDir is the directory where certificates are stored - CertsDir = "/etc/docker/certs.d" + CertsDir = "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d" ) // cleanPath is used to ensure that a directory name is valid on the target diff --git a/components/engine/registry/endpoint_v1.go b/components/engine/registry/endpoint_v1.go index 832fdb95a4..606ddfaf96 100644 --- a/components/engine/registry/endpoint_v1.go +++ b/components/engine/registry/endpoint_v1.go @@ -49,7 +49,7 @@ func validateEndpoint(endpoint *V1Endpoint) error { if endpoint.IsSecure { // If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry` // in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fallback to HTTP. - return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) + return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) } // If registry is insecure and HTTPS failed, fallback to HTTP.