Browse code

Move utility package 'systemd' to pkg/systemd

Solomon Hykes authored on 2013/12/24 08:07:01
Showing 3 changed files
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"fmt"
11 11
 	"github.com/dotcloud/docker/archive"
12 12
 	"github.com/dotcloud/docker/auth"
13
-	"github.com/dotcloud/docker/systemd"
13
+	"github.com/dotcloud/docker/pkg/systemd"
14 14
 	"github.com/dotcloud/docker/utils"
15 15
 	"github.com/gorilla/mux"
16 16
 	"io"
17 17
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+package systemd
1
+
2
+import (
3
+	"errors"
4
+	"net"
5
+	"os"
6
+)
7
+
8
+var SdNotifyNoSocket = errors.New("No socket")
9
+
10
+// Send a message to the init daemon. It is common to ignore the error.
11
+func SdNotify(state string) error {
12
+	socketAddr := &net.UnixAddr{
13
+		Name: os.Getenv("NOTIFY_SOCKET"),
14
+		Net:  "unixgram",
15
+	}
16
+
17
+	if socketAddr.Name == "" {
18
+		return SdNotifyNoSocket
19
+	}
20
+
21
+	conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr)
22
+	if err != nil {
23
+		return err
24
+	}
25
+
26
+	_, err = conn.Write([]byte(state))
27
+	if err != nil {
28
+		return err
29
+	}
30
+
31
+	return nil
32
+}
0 33
deleted file mode 100644
... ...
@@ -1,33 +0,0 @@
1
-package systemd
2
-
3
-import (
4
-	"errors"
5
-	"net"
6
-	"os"
7
-)
8
-
9
-var SdNotifyNoSocket = errors.New("No socket")
10
-
11
-// Send a message to the init daemon. It is common to ignore the error.
12
-func SdNotify(state string) error {
13
-	socketAddr := &net.UnixAddr{
14
-		Name: os.Getenv("NOTIFY_SOCKET"),
15
-		Net:  "unixgram",
16
-	}
17
-
18
-	if socketAddr.Name == "" {
19
-		return SdNotifyNoSocket
20
-	}
21
-
22
-	conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr)
23
-	if err != nil {
24
-		return err
25
-	}
26
-
27
-	_, err = conn.Write([]byte(state))
28
-	if err != nil {
29
-		return err
30
-	}
31
-
32
-	return nil
33
-}