Sfoglia il codice sorgente

libnetwork: un-export SetExternalKey

It's only called as part of the "libnetwork-setkey" re-exec, so un-exporting
it to make clear it's not for external use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 anni fa
parent
commit
8376595621

+ 2 - 2
libnetwork/libnetwork_linux_test.go

@@ -477,7 +477,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
 	if reexec {
 		err := reexecSetKey("this-must-fail", containerID, controller.ID())
 		if err == nil {
-			t.Fatalf("SetExternalKey must fail if the corresponding namespace is not created")
+			t.Fatalf("libnetwork-setkey must fail if the corresponding namespace is not created")
 		}
 	} else {
 		// Setting an non-existing key (namespace) must fail
@@ -500,7 +500,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
 	if reexec {
 		err := reexecSetKey("ValidKey", containerID, controller.ID())
 		if err != nil {
-			t.Fatalf("SetExternalKey failed with %v", err)
+			t.Fatalf("libnetwork-setkey failed with %v", err)
 		}
 	} else {
 		if err := sbox.SetKey("ValidKey"); err != nil {

+ 3 - 3
libnetwork/sandbox_externalkey_unix.go

@@ -65,11 +65,11 @@ func setKey() error {
 		return err
 	}
 
-	return SetExternalKey(shortCtlrID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot)
+	return setExternalKey(shortCtlrID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot)
 }
 
-// SetExternalKey provides a convenient way to set an External key to a sandbox
-func SetExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error {
+// setExternalKey provides a convenient way to set an External key to a sandbox
+func setExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error {
 	uds := filepath.Join(execRoot, execSubdir, shortCtlrID+".sock")
 	c, err := net.Dial("unix", uds)
 	if err != nil {