Compare commits

...

4 Commits

Author SHA1 Message Date
Alex Crawford
2fe0b0b2a8 coreos-cloudinit: bump to v1.3.1 2015-02-13 10:24:41 -08:00
Alex Crawford
19ce7ac849 Merge pull request #317 from crawford/json
configdrive: check metadata length before parsing
2015-02-13 10:22:57 -08:00
Alex Crawford
477053ffde configdrive: check metadata length before parsing
This was lost in some of the recent refactoring.
2015-02-13 10:20:08 -08:00
Alex Crawford
eb0d2dbfa3 coreos-cloudinit: bump to v1.3.0+git 2015-02-11 17:19:32 -08:00
3 changed files with 6 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ import (
)
const (
version = "1.3.0"
version = "1.3.1"
datasourceInterval = 100 * time.Millisecond
datasourceMaxInterval = 30 * time.Second
datasourceTimeout = 5 * time.Minute

View File

@@ -60,7 +60,7 @@ func (cd *configDrive) FetchMetadata() (metadata datasource.Metadata, err error)
} `json:"network_config"`
}
if data, err = cd.tryReadFile(path.Join(cd.openstackVersionRoot(), "meta_data.json")); err != nil {
if data, err = cd.tryReadFile(path.Join(cd.openstackVersionRoot(), "meta_data.json")); err != nil || len(data) == 0 {
return
}
if err = json.Unmarshal([]byte(data), &m); err != nil {

View File

@@ -29,6 +29,10 @@ func TestFetchMetadata(t *testing.T) {
metadata datasource.Metadata
}{
{
root: "/",
files: test.MockFilesystem{"/openstack/latest/meta_data.json": ""},
},
{
root: "/",
files: test.MockFilesystem{"/openstack/latest/meta_data.json": `{"ignore": "me"}`},