From 585ce5fcd9120d7d3fd58c737c90034a1e3366a7 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Sat, 13 Sep 2014 21:01:42 -0700 Subject: [PATCH 1/2] Revert "metadata: don't fail if no network config was provided" This reverts commit c1f373e648e1d8950faef668b5a70968db2408a3. --- coreos-cloudinit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreos-cloudinit.go b/coreos-cloudinit.go index 16c7035..0bd6026 100644 --- a/coreos-cloudinit.go +++ b/coreos-cloudinit.go @@ -163,7 +163,7 @@ func main() { os.Exit(1) } - if ccm != nil && ccm.NetworkConfigPath != "" { + if ccm != nil { fmt.Printf("Fetching network config from datasource of type %q\n", ds.Type()) netconfBytes, err := ds.FetchNetworkConfig(ccm.NetworkConfigPath) if err != nil { From a0fe6d0884209eb7fd6c17ba02acef0c9133d1db Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Sat, 13 Sep 2014 21:02:08 -0700 Subject: [PATCH 2/2] configdrive: return an empty network config when filename is empty Additionally, don't bother checking for a network config if it isn't going to be processed. --- coreos-cloudinit.go | 2 +- datasource/configdrive/configdrive.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/coreos-cloudinit.go b/coreos-cloudinit.go index 0bd6026..81b7d10 100644 --- a/coreos-cloudinit.go +++ b/coreos-cloudinit.go @@ -163,7 +163,7 @@ func main() { os.Exit(1) } - if ccm != nil { + if ccm != nil && flags.convertNetconf != "" { fmt.Printf("Fetching network config from datasource of type %q\n", ds.Type()) netconfBytes, err := ds.FetchNetworkConfig(ccm.NetworkConfigPath) if err != nil { diff --git a/datasource/configdrive/configdrive.go b/datasource/configdrive/configdrive.go index 81d401e..0dea221 100644 --- a/datasource/configdrive/configdrive.go +++ b/datasource/configdrive/configdrive.go @@ -42,6 +42,9 @@ func (cd *configDrive) FetchUserdata() ([]byte, error) { } func (cd *configDrive) FetchNetworkConfig(filename string) ([]byte, error) { + if filename == "" { + return []byte{}, nil + } return cd.tryReadFile(path.Join(cd.openstackRoot(), filename)) }