Skip to content

Commit

Permalink
use different method to add license for vsphere and standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
girishramnani-crest committed Aug 10, 2017
1 parent 6cfc998 commit 3495fd2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion vsphere/resource_vsphere_license.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vsphere

import (
"errors"
"fmt"
"log"

"github.com/hashicorp/terraform/helper/schema"
Expand Down Expand Up @@ -95,7 +96,18 @@ func resourceVSphereLicenseCreate(d *schema.ResourceData, meta interface{}) erro
return err
}
}
info, err := manager.Add(context.TODO(), key, finalLabels)

var info types.LicenseManagerLicenseInfo

switch t := client.ServiceContent.About.ApiType; t {
case "HostAgent":
info, err = manager.Update(context.TODO(), key, finalLabels)
case "VirtualCenter":
info, err = manager.Add(context.TODO(), key, finalLabels)
default:
return fmt.Errorf("unsupported ApiType: %s", t)
}

if err != nil {
return err
}
Expand Down

0 comments on commit 3495fd2

Please sign in to comment.