Skip to content

Commit

Permalink
Chown socket
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefaille committed Sep 3, 2015
1 parent 5334b75 commit 59cfc0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions docker-upstart.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ post-start script
echo "Waiting for /var/run/{{.Name}}.sock"
sleep 0.1
done
chown {{.Name}} /var/run/{{.Name}}.sock
echo "/var/run/{{.Name}} is up"

end script
5 changes: 3 additions & 2 deletions dockerGrp/upstart.tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ ZiAvZXRjL2RlZmF1bHQvJFVQU1RBUlRfSk9CIF07IHRoZW4KCQkuIC9ldGMvZGVmYXVsdC8kVVBT
VEFSVF9KT0IKCWZpCgoJd2hpbGUgISBbIC1lIC92YXIvcnVuL3t7Lk5hbWV9fS5zb2NrIF07IGRv
CgkgICAgaW5pdGN0bCBzdGF0dXMgJFVQU1RBUlRfSk9CIHwgZ3JlcCAtcUUgIihzdG9wfHJlc3Bh
d24pLyIgJiYgZXhpdCAxCgkgICAgZWNobyAiV2FpdGluZyBmb3IgL3Zhci9ydW4ve3suTmFtZX19
LnNvY2siCgkgICAgc2xlZXAgMC4xCglkb25lCgllY2hvICIvdmFyL3J1bi97ey5OYW1lfX0gaXMg
dXAiCgplbmQgc2NyaXB0Cg==
LnNvY2siCgkgICAgc2xlZXAgMC4xCglkb25lCiAgICAgICAgY2hvd24ge3suTmFtZX19IC92YXIv
cnVuL3t7Lk5hbWV9fS5zb2NrCgllY2hvICIvdmFyL3J1bi97ey5OYW1lfX0gaXMgdXAiCgplbmQg
c2NyaXB0Cg==
`
b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(Based6Tmpl))
data, _ := ioutil.ReadAll(b64)
Expand Down
25 changes: 9 additions & 16 deletions unixGrp/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"bufio"
"log"
"os"
"strconv"
"strings"
)

type Group struct {
Name string
Members []string
Guid int64
}

func TakeAllGroups() (chanGroup chan Group) {
Expand All @@ -29,12 +31,7 @@ func TakeAllGroups() (chanGroup chan Group) {
copy(lineB, out)
line := string(lineB[:])

currentG := takeGroup(line)

members, err := takeGroupMember(line)
if err == nil {
currentG.Members = members
}
currentG := takeGroupArray(line)

currentChanGroup <- currentG

Expand All @@ -51,19 +48,15 @@ func TakeAllGroups() (chanGroup chan Group) {

}

func takeGroup(s string) Group {
groupEnd := strings.Index(s, ":")
g := Group{Name: s[:groupEnd], Members: []string{}}
func takeGroupArray(groupLine string) Group {
group := strings.Split(groupLine, ":")
guid := group[2]
intGuid, _ := strconv.ParseInt(guid, 10, 64)
members := strings.Split(group[3], ",")
g := Group{Name: group[0], Guid: intGuid, Members: members}
return g
}

func takeGroupMember(s string) (members []string, err error) {

membersString := strings.LastIndex(s, ":")
members = strings.Split(s[membersString+1:], ",")
return
}

func check(e error) {
if e != nil {
panic(e)
Expand Down

0 comments on commit 59cfc0b

Please sign in to comment.