Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for cloud licensing and infoblox-go-client version to v0.3.0 #50

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ can be defined using the create-ea-defs tool in the infoblox/docker-ipam-tools d

To run create-ea-defs:
```
docker run infoblox/docker-ipam-tools:1.1.0 create-ea-defs --debug --grid-host 10.120.21.150 --wapi-username=admin --wapi-password=infoblox --wapi-version=2.3
docker run infoblox/container-ipam-tool:0.0.1 create-ea-defs --debug --grid-host 10.120.21.150 --wapi-username=admin --wapi-password=infoblox --wapi-version=2.3
```

To use the configuration file for create-ea-defs:
```
docker run -v /etc/infoblox:/etc/infoblox infoblox/docker-ipam-tools:1.1.0 create-ea-defs --debug --conf-file docker-infoblox.conf
docker run -v /etc/infoblox:/etc/infoblox infoblox/container-ipam-tool:0.0.1 create-ea-defs --debug --conf-file docker-infoblox.conf
```

IPAM Driver Configuration
Expand Down
9 changes: 5 additions & 4 deletions driver/ipam_driver.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package main

import (
"os"
"reflect"
"strings"

"github.com/Sirupsen/logrus"
apiclient "github.com/docker/engine-api/client"
ipamPluginSdk "github.com/docker/go-plugins-helpers/ipam"
"github.com/infobloxopen/docker-infoblox/common"
ibclient "github.com/infobloxopen/infoblox-go-client"
ctx "golang.org/x/net/context"
"os"
"reflect"
"strings"
)

const socketAddress = "/run/docker/plugins/infoblox.sock"
Expand Down Expand Up @@ -100,7 +101,7 @@ func main() {
logrus.Infof("Docker id is '%s'\n", dockerID)
}
objMgr := ibclient.NewObjectManager(conn, "Docker", dockerID)

CheckForCloudLicense(objMgr)
ipamDrv := NewInfobloxDriver(objMgr, config.GlobalNetview, config.GlobalNetworkContainer, config.GlobalPrefixLength,
config.LocalNetview, config.LocalNetworkContainer, config.LocalPrefixLength)

Expand Down
33 changes: 33 additions & 0 deletions driver/license.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"fmt"
"strings"

ibclient "github.com/infobloxopen/infoblox-go-client"
"github.com/sirupsen/logrus"
)

//Checks for cloud license in nios
func CheckForCloudLicense(objMgr *ibclient.ObjectManager) {
err := CheckLicense(objMgr, "cloud")
if err != nil {
logrus.Fatal("Error while checking for cloud license: ", err)
}
}

func CheckLicense(objMgr *ibclient.ObjectManager, licenseType string) (err error) {
license, err := objMgr.GetLicense()
if err != nil {
return
}
for _, v := range license {
if strings.ToLower(v.Licensetype) == licenseType {
if v.ExpirationStatus != "DELETED" && v.ExpirationStatus != "EXPIRED" {
return
}
}
}
err = fmt.Errorf("%s License not available/applied. Apply the license for the grid and try again", licenseType)
return
}
2 changes: 1 addition & 1 deletion glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import:
subpackages:
- netlabel
- package: github.com/infobloxopen/infoblox-go-client
version: a7011ba7a38b75b63269695c4c392ebd1d8b0c72
version: v0.3.0
- package: golang.org/x/net
subpackages:
- context
Expand Down