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.
This commit is contained in:
parent
585ce5fcd9
commit
a0fe6d0884
@ -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 {
|
||||
|
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user