From 6b8f82b5d3745ad87161f1ca45495995c73411ff Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Wed, 6 Aug 2014 21:31:43 -0700 Subject: [PATCH] datasource: Fix ec2 URLs _ vs - --- datasource/configdrive/configdrive.go | 8 ++++---- datasource/configdrive/configdrive_test.go | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/datasource/configdrive/configdrive.go b/datasource/configdrive/configdrive.go index 870f3be..6947a7f 100644 --- a/datasource/configdrive/configdrive.go +++ b/datasource/configdrive/configdrive.go @@ -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")) } diff --git a/datasource/configdrive/configdrive_test.go b/datasource/configdrive/configdrive_test.go index 26bc46b..b283f92 100644 --- a/datasource/configdrive/configdrive_test.go +++ b/datasource/configdrive/configdrive_test.go @@ -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}