Skip to content

Commit

Permalink
Fixed network create command.
Browse files Browse the repository at this point in the history
Instead of host's address the CLI now send the host's ID.

Change-Id: I659e9f000fbdc9066ca8ab0afcd769226e5c03d1
Reviewed-on: http://bellevue-ci.eng.vmware.com:8080/5902
Upgrade-Verified: jenkins <[email protected]>
Bellevue-Verified: jenkins <[email protected]>
Reviewed-by: Sergio Sanchez <[email protected]>
CS-Verified: jenkins <[email protected]>
  • Loading branch information
angel-ivanov committed Jan 24, 2017
1 parent 5479f11 commit 245d715
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions cli/src/admiral/networks/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,28 +170,13 @@ type NetworkOperation struct {
}

func (no *NetworkOperation) SetHosts(hostsIds []string) {
no.CustomProperties = make(map[string]string, 0)
fullHostIds, err := selflink.GetFullIds(hostsIds, new(hosts.HostsList), utils.HOST)
utils.CheckBlockingError(err)
if len(hostsIds) < 1 {
if len(fullHostIds) < 1 {
return
}
hostAddresses := make([]string, 0)
for _, hostId := range fullHostIds {
host, err := hosts.GetHost(hostId)
if err != nil {
continue
}
schemeRegex, _ := regexp.Compile("^https?:\\/\\/")
address := schemeRegex.ReplaceAllString(host.Address, "")
if strings.TrimSpace(address) == "" {
continue
}
hostAddresses = append(hostAddresses, address)
}
if len(hostAddresses) > 0 {
no.CustomProperties["__containerHostId"] = strings.Join(hostAddresses, ",")
}
no.CustomProperties = make(map[string]string)
no.CustomProperties["__containerHostId"] = strings.Join(fullHostIds, ",")
}

func (nl *NetworkList) FetchNetworks() (int, error) {
Expand Down

0 comments on commit 245d715

Please sign in to comment.