Skip to content

Commit

Permalink
Merge pull request #324 from akutz/feature/opt-in-local-drivers
Browse files Browse the repository at this point in the history
Opt In Integration Driver
  • Loading branch information
akutz committed Nov 8, 2016
2 parents 6f84db6 + 500b24d commit 159b773
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ before_install:

script:
- make gometalinter-all
- BUILD_TAGS="gofig pflag" make -j build
- BUILD_TAGS="gofig pflag" make -j test
- make -j build
- make -j test
- VFS_INSTANCEID_USE_FIELDS=true ./drivers/storage/vfs/tests/vfs.test
- go clean -i ./client && go build ./client

Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
SHELL := /bin/bash

ifeq (undefined,$(origin BUILD_TAGS))
BUILD_TAGS := gofig pflag libstorage_integration_driver_docker
endif

all:
# if docker is running, then let's use docker to build it
ifneq (,$(shell if docker version &> /dev/null; then echo -; fi))
Expand Down Expand Up @@ -82,7 +86,9 @@ else
@tar -C $(GOPATH)/src -c $(DTARC) $(DLOCAL_IMPORTS_FILES) | docker cp - $(DNAME):$(DPATH)/vendor
endif
endif
docker exec -t $(DNAME) env GOOS=$(DGOOS) GOARCH=$(DGOARCH) DOCKER=1 make -C $(DPATH) -j build
docker exec -t $(DNAME) \
env BUILD_TAGS="$(BUILD_TAGS)" GOOS=$(DGOOS) GOARCH=$(DGOARCH) DOCKER=1 \
make -C $(DPATH) -j build

docker-build: docker-init
@docker cp $(DNAME):$(DPROG1_PATH) $(DPROG1_NAME)
Expand All @@ -102,7 +108,9 @@ endif
docker-test: DGOOS=linux
docker-test: DTEST_ENV_VARS=TRAVIS=true LIBSTORAGE_DISABLE_STARTUP_INFO=true
docker-test: docker-init
docker exec -t $(DNAME) env $(DTEST_ENV_VARS) make -C $(DPATH) test
docker exec -t $(DNAME) \
env BUILD_TAGS="$(BUILD_TAGS)" $(DTEST_ENV_VARS) \
make -C $(DPATH) test

docker-clean:
-docker stop $(DNAME) &> /dev/null && docker rm $(DNAME) &> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion api/registry/registry_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (d *idm) initPathCache(ctx types.Context) {
return
}

if _, ok := context.ServiceName(ctx); !ok {
if name, ok := context.ServiceName(ctx); !ok || name == "" {
ctx.Info("path cache initializion disabled; no service name in ctx")
return
}
Expand Down
1 change: 0 additions & 1 deletion imports/config/imports_config.go

This file was deleted.

5 changes: 5 additions & 0 deletions imports/config/imports_config_00.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package config

var (
defaultIntDriver = ""
)
7 changes: 7 additions & 0 deletions imports/config/imports_config_11_int_docker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build libstorage_integration_driver_docker

package config

func init() {
defaultIntDriver = "docker"
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ func init() {
}

defaultAEM := types.UnixEndpoint.String()
defaultOSDriver := runtime.GOOS
defaultStorageDriver := types.LibStorageDriverName
defaultIntDriver := "docker"
defaultLogLevel := logLevel.String()
defaultClientType := types.IntegrationClient.String()

rk(gofig.String, "", "", types.ConfigHost)
rk(gofig.String, "", "", types.ConfigService)
rk(gofig.String, defaultAEM, "", types.ConfigServerAutoEndpointMode)
rk(gofig.String, defaultOSDriver, "", types.ConfigOSDriver)
rk(gofig.String, runtime.GOOS, "", types.ConfigOSDriver)
rk(gofig.String, defaultStorageDriver, "", types.ConfigStorageDriver)
rk(gofig.String, defaultIntDriver, "", types.ConfigIntegrationDriver)
rk(gofig.String, defaultClientType, "", types.ConfigClientType)
Expand Down
7 changes: 0 additions & 7 deletions imports/local/imports_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,4 @@ import (

// load the libStorage storage driver
_ "github.com/codedellemc/libstorage/drivers/storage/libstorage"

// load the os drivers
_ "github.com/codedellemc/libstorage/drivers/os/darwin"
_ "github.com/codedellemc/libstorage/drivers/os/linux"

// load the integration drivers
_ "github.com/codedellemc/libstorage/drivers/integration/docker"
)
2 changes: 1 addition & 1 deletion imports/local/imports_local_gofig.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package local

import (
// load the client drivers
// load the packages
_ "github.com/codedellemc/libstorage/drivers/storage/vfs/client"
)
8 changes: 8 additions & 0 deletions imports/local/imports_local_int_docker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// +build libstorage_integration_driver_docker

package local

import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/integration/docker"
)
6 changes: 6 additions & 0 deletions imports/local/imports_local_os_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package local

import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/os/darwin"
)
6 changes: 6 additions & 0 deletions imports/local/imports_local_os_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package local

import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/os/linux"
)

0 comments on commit 159b773

Please sign in to comment.