Skip to content

Commit

Permalink
Merge pull request #19 from nutanix/v3.0.1
Browse files Browse the repository at this point in the history
url encoding for search filter ( fix #18 )
  • Loading branch information
tuxtof authored Dec 25, 2021
2 parents 45525f8 + 52e349b commit b9e9d89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If you want to use Nutanix Node Driver, you need add it in order to start using
2. Click *Add Node Driver*.
3. Complete the Add Node Driver form. Then click Create.

- *Download URL*: `https://github.com/nutanix/docker-machine/releases/download/v3.0.0/docker-machine-driver-nutanix_v3.0.0_linux`
- *Download URL*: `https://github.com/nutanix/docker-machine/releases/download/v3.0.1/docker-machine-driver-nutanix_v3.0.1_linux`
- *Custom UI URL*: `https://nutanix.github.io/rancher-ui-driver/v3.0.0/component.js`
- *Whitelist Domains*: `nutanix.github.io`

Expand Down
13 changes: 10 additions & 3 deletions machine/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"net"
"net/url"
"strings"
"time"

Expand Down Expand Up @@ -101,7 +102,9 @@ func (d *NutanixDriver) Create() error {
}

// Search target cluster
clusterFilter := fmt.Sprintf("name==%s", d.Cluster)
c := &url.URL{Path: d.Cluster}
encodedCluster := c.String()
clusterFilter := fmt.Sprintf("name==%s", encodedCluster)
clusters, err := conn.V3.ListAllCluster(clusterFilter)
if err != nil {
log.Errorf("Error getting clusters: [%v]", err)
Expand Down Expand Up @@ -131,7 +134,9 @@ func (d *NutanixDriver) Create() error {
subnetFilter += ","
}

subnetFilter += fmt.Sprintf("name==%s", subnet)
t := &url.URL{Path: subnet}
encodedSubnet := t.String()
subnetFilter += fmt.Sprintf("name==%s", encodedSubnet)
}

subnets, err := conn.V3.ListAllSubnet(subnetFilter)
Expand Down Expand Up @@ -181,7 +186,9 @@ func (d *NutanixDriver) Create() error {
}

// Search image template
imageFilter := fmt.Sprintf("name==%s", d.Image)
i := &url.URL{Path: d.Image}
encodedImage := i.String()
imageFilter := fmt.Sprintf("name==%s", encodedImage)
images, err := conn.V3.ListAllImage(imageFilter)
if err != nil {
log.Errorf("Error getting images: [%v]", err)
Expand Down

0 comments on commit b9e9d89

Please sign in to comment.