configdrive: check the network config path

Check to make sure that a network config path has been specified before
trying to read from it. Otherwise, it will end up trying to read a
directory.
This commit is contained in:
Alex Crawford 2015-02-13 22:28:09 -08:00
parent 47ac4f6931
commit 987aa21883

View File

@ -69,7 +69,9 @@ func (cd *configDrive) FetchMetadata() (metadata datasource.Metadata, err error)
metadata.SSHPublicKeys = m.SSHAuthorizedKeyMap metadata.SSHPublicKeys = m.SSHAuthorizedKeyMap
metadata.Hostname = m.Hostname metadata.Hostname = m.Hostname
metadata.NetworkConfig, err = cd.tryReadFile(path.Join(cd.openstackRoot(), m.NetworkConfig.ContentPath)) if m.NetworkConfig.ContentPath != "" {
metadata.NetworkConfig, err = cd.tryReadFile(path.Join(cd.openstackRoot(), m.NetworkConfig.ContentPath))
}
return return
} }