host-local: add DataDir IPAM conf option and use it for testcases

Add an e2e host-local plugin testcase, which requires being able
to pass the datadir into the plugin so we can erase it later.
We're not always guaranteed to have access to the default data
dir location, plus it should probably be configurable anyway.
This commit is contained in:
Dan Williams
2016-11-10 10:50:58 -06:00
parent 79643855f7
commit e085226f82
4 changed files with 100 additions and 4 deletions

View File

@ -31,8 +31,11 @@ type Store struct {
dataDir string
}
func New(network string) (*Store, error) {
dir := filepath.Join(defaultDataDir, network)
func New(network, dataDir string) (*Store, error) {
if dataDir == "" {
dataDir = defaultDataDir
}
dir := filepath.Join(dataDir, network)
if err := os.MkdirAll(dir, 0644); err != nil {
return nil, err
}