Skip to content

Commit

Permalink
Add more error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
johscheuer committed Feb 28, 2017
1 parent 8aadb77 commit 66a7aef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ env:
install:
- go fmt ./...
- CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match) -X main.revision=$(git log -1 --format=%h)" -a -installsuffix cgo -o bin/docker-quobyte-plugin
.

before_deploy:
- tar cfvz docker-quobyte-plugin.tar.gz bin systemd
Expand Down
5 changes: 5 additions & 0 deletions quobyte_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (driver quobyteDriver) Create(request volume.Request) volume.Response {
RootUserID: user,
RootGroupID: group,
}); err != nil {
log.Println(err)
return volume.Response{Err: err.Error()}
}

Expand All @@ -60,6 +61,7 @@ func (driver quobyteDriver) Remove(request volume.Request) volume.Response {
defer driver.m.Unlock()

if err := driver.client.DeleteVolumeByName(request.Name, ""); err != nil {
log.Println(err)
return volume.Response{Err: err.Error()}
}

Expand All @@ -72,6 +74,7 @@ func (driver quobyteDriver) Mount(request volume.MountRequest) volume.Response {
mPoint := filepath.Join(driver.quobyteMount, request.Name)
log.Printf("Mounting volume %s on %s\n", request.Name, mPoint)
if fi, err := os.Lstat(mPoint); err != nil || !fi.IsDir() {
log.Println(err)
return volume.Response{Err: fmt.Sprintf("%v not mounted", mPoint)}
}

Expand All @@ -93,6 +96,7 @@ func (driver quobyteDriver) Get(request volume.Request) volume.Response {
mPoint := filepath.Join(driver.quobyteMount, request.Name)

if fi, err := os.Lstat(mPoint); err != nil || !fi.IsDir() {
log.Println(err)
return volume.Response{Err: fmt.Sprintf("%v not mounted", mPoint)}
}

Expand All @@ -106,6 +110,7 @@ func (driver quobyteDriver) List(request volume.Request) volume.Response {
var vols []*volume.Volume
files, err := ioutil.ReadDir(driver.quobyteMount)
if err != nil {
log.Println(err)
return volume.Response{Err: err.Error()}
}

Expand Down
1 change: 1 addition & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func isMounted(mountPath string) bool {
func mountAll(mountQuobyteOptions, quobyteRegistry, mountQuobytePath string) {
cmdStr := fmt.Sprintf("mount %s -t quobyte %s %s", mountQuobyteOptions, fmt.Sprintf("%s/", quobyteRegistry), mountQuobytePath)
if out, err := exec.Command("/bin/sh", "-c", cmdStr).CombinedOutput(); err != nil {
log.Println(err)
log.Fatalln(string(out))
}
}

0 comments on commit 66a7aef

Please sign in to comment.