Skip to content

Commit

Permalink
Merge pull request #88 from aiyengar2/relocate_resolve_nsg_ref
Browse files Browse the repository at this point in the history
Relocate resolveNSGReference in Azure node driver
  • Loading branch information
aiyengar2 authored Jun 8, 2020
2 parents d32ea31 + 3cf91ab commit f675ca2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,6 @@ func (d *Driver) SetConfigFromFlags(fl drivers.DriverOptions) error {
d.UpdateCount = fl.Int(flAzureUpdateDomainCount)
d.DiskSize = fl.Int(flAzureDiskSize)
d.NSG = fl.String(flAzureNSG)
var err error
d.nsgUsedInPool = len(d.NSG) > 0
if d.nsgResource, err = d.resolveNSGReference(d.NSG); err != nil {
return err
}

d.ClientID = fl.String(flAzureClientID)
d.ClientSecret = fl.String(flAzureClientSecret)
Expand Down Expand Up @@ -414,6 +409,10 @@ func (d *Driver) Create() error {
}
customData = base64.StdEncoding.EncodeToString(buf)
}
d.nsgUsedInPool = len(d.NSG) > 0
if d.nsgResource, err = d.resolveNSGReference(d.NSG); err != nil {
return err
}

if err := c.CreateResourceGroup(ctx, d.ResourceGroup, d.Location); err != nil {
return err
Expand Down Expand Up @@ -483,6 +482,10 @@ func (d *Driver) Remove() error {
if err != nil {
return err
}
d.nsgUsedInPool = len(d.NSG) > 0
if d.nsgResource, err = d.resolveNSGReference(d.NSG); err != nil {
return err
}

if err := c.DeleteVirtualMachineIfExists(ctx, d.ResourceGroup, d.naming().VM()); err != nil {
return err
Expand Down

0 comments on commit f675ca2

Please sign in to comment.