Merge pull request #201 from crawford/configdrive

configdrive: fix root path
This commit is contained in:
Alex Crawford 2014-08-11 20:11:17 -07:00
commit 1cf275bad6
2 changed files with 22 additions and 1 deletions

View File

@ -17,7 +17,7 @@ type configDrive struct {
} }
func NewDatasource(root string) *configDrive { func NewDatasource(root string) *configDrive {
return &configDrive{path.Join(root, "openstack"), ioutil.ReadFile} return &configDrive{root, ioutil.ReadFile}
} }
func (cd *configDrive) IsAvailable() bool { func (cd *configDrive) IsAvailable() bool {

View File

@ -112,3 +112,24 @@ func TestCDConfigRoot(t *testing.T) {
} }
} }
} }
func TestNewDatasource(t *testing.T) {
for _, tt := range []struct {
root string
expectRoot string
}{
{
root: "",
expectRoot: "",
},
{
root: "/media/configdrive",
expectRoot: "/media/configdrive",
},
} {
service := NewDatasource(tt.root)
if service.root != tt.expectRoot {
t.Fatalf("bad root (%q): want %q, got %q", tt.root, tt.expectRoot, service.root)
}
}
}