commit
97d5538533
@ -33,15 +33,15 @@ func (cd *configDrive) ConfigRoot() string {
|
||||
return cd.openstackRoot()
|
||||
}
|
||||
|
||||
// FetchMetadata attempts to retrieve metadata from ec2/2009-04-04/meta_data.json.
|
||||
// FetchMetadata attempts to retrieve metadata from ec2/2009-04-04/meta-data.json.
|
||||
func (cd *configDrive) FetchMetadata() ([]byte, error) {
|
||||
return cd.tryReadFile(path.Join(cd.ec2Root(), "meta_data.json"))
|
||||
return cd.tryReadFile(path.Join(cd.ec2Root(), "meta-data.json"))
|
||||
}
|
||||
|
||||
// FetchUserdata attempts to retrieve the userdata from ec2/2009-04-04/user_data.
|
||||
// FetchUserdata attempts to retrieve the userdata from ec2/2009-04-04/user-data.
|
||||
// If no data is found, it will attempt to read from openstack/latest/user_data.
|
||||
func (cd *configDrive) FetchUserdata() ([]byte, error) {
|
||||
bytes, err := cd.tryReadFile(path.Join(cd.ec2Root(), "user_data"))
|
||||
bytes, err := cd.tryReadFile(path.Join(cd.ec2Root(), "user-data"))
|
||||
if bytes == nil && err == nil {
|
||||
bytes, err = cd.tryReadFile(path.Join(cd.openstackRoot(), "user_data"))
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ func TestCDFetchMetadata(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"/",
|
||||
"/ec2/2009-04-04/meta_data.json",
|
||||
mockFilesystem([]string{"/ec2/2009-04-04/meta_data.json"}),
|
||||
"/ec2/2009-04-04/meta-data.json",
|
||||
mockFilesystem([]string{"/ec2/2009-04-04/meta-data.json"}),
|
||||
},
|
||||
{
|
||||
"/media/configdrive",
|
||||
"/media/configdrive/ec2/2009-04-04/meta_data.json",
|
||||
mockFilesystem([]string{"/media/configdrive/ec2/2009-04-04/meta_data.json"}),
|
||||
"/media/configdrive/ec2/2009-04-04/meta-data.json",
|
||||
mockFilesystem([]string{"/media/configdrive/ec2/2009-04-04/meta-data.json"}),
|
||||
},
|
||||
} {
|
||||
cd := configDrive{tt.root, tt.files.readFile}
|
||||
@ -62,8 +62,8 @@ func TestCDFetchUserdata(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"/",
|
||||
"/ec2/2009-04-04/user_data",
|
||||
mockFilesystem([]string{"/ec2/2009-04-04/user_data"}),
|
||||
"/ec2/2009-04-04/user-data",
|
||||
mockFilesystem([]string{"/ec2/2009-04-04/user-data"}),
|
||||
},
|
||||
{
|
||||
"/",
|
||||
@ -72,13 +72,13 @@ func TestCDFetchUserdata(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"/",
|
||||
"/ec2/2009-04-04/user_data",
|
||||
mockFilesystem([]string{"/openstack/latest/user_data", "/ec2/2009-04-04/user_data"}),
|
||||
"/ec2/2009-04-04/user-data",
|
||||
mockFilesystem([]string{"/openstack/latest/user_data", "/ec2/2009-04-04/user-data"}),
|
||||
},
|
||||
{
|
||||
"/media/configdrive",
|
||||
"/media/configdrive/ec2/2009-04-04/user_data",
|
||||
mockFilesystem([]string{"/media/configdrive/ec2/2009-04-04/user_data"}),
|
||||
"/media/configdrive/ec2/2009-04-04/user-data",
|
||||
mockFilesystem([]string{"/media/configdrive/ec2/2009-04-04/user-data"}),
|
||||
},
|
||||
} {
|
||||
cd := configDrive{tt.root, tt.files.readFile}
|
||||
|
Loading…
Reference in New Issue
Block a user