Merge pull request #656 from gravitl/bugfix_v0.10.0_get_system_networks

Bugfix v0.10.0 get system networks
This commit is contained in:
dcarns 2022-01-31 13:19:31 -05:00 committed by GitHub
commit a4582dd14d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,19 +450,21 @@ func PrintLog(message string, loglevel int) {
// GetSystemNetworks - get networks locally
func GetSystemNetworks() ([]string, error) {
var networks []string
files, err := filepath.Glob(GetNetclientPathSpecific() + "netconfig-*")
if err != nil {
return nil, err
}
i := 0
for _, file := range files {
//don't want files such as *.bak, *.swp
if filepath.Ext(file) == "" {
files[i] = filepath.Base(file)
i++
if filepath.Ext(file) != "" {
continue
}
file := filepath.Base(file)
temp := strings.Split(file, "-")
networks = append(networks, temp[1])
}
return files[:i], nil
return networks, nil
}
func stringAfter(original string, substring string) string {