Merge pull request #233 from crawford/configdrive

configdrive: don't fail if no network config was provided
This commit is contained in:
Alex Crawford 2014-09-14 08:18:14 -07:00
commit 3e015cc3a1
2 changed files with 4 additions and 1 deletions

View File

@ -163,7 +163,7 @@ func main() {
os.Exit(1)
}
if ccm != nil && ccm.NetworkConfigPath != "" {
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 {

View File

@ -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))
}