Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #368 from obedmr/ciao-cli
Browse files Browse the repository at this point in the history
ciao-cli: Add tenant name evironment variable
  • Loading branch information
Tim Pepper authored Jul 22, 2016
2 parents 6a16a5a + c6dcd31 commit 756be39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ciao-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ credentials and networking information:
* `CIAO_COMPUTEPORT` exports the Ciao compute alternative port
* `CIAO_USERNAME` exports the Ciao username
* `CIAO_PASSWORD` export the Ciao password for `CIAO_USERNAME`
* `CIAO_TENANT_NAME` export the Ciao tenant name for `CIAO_USERNAME`

All those environment variables can be set through an rc file.
For example:
Expand All @@ -80,6 +81,7 @@ export CIAO_CONTROLLER=ciao-ctl.intel.com
export CIAO_IDENTITY=https://ciao-identity.intel.com:35357
export CIAO_USERNAME=user
export CIAO_PASSWORD=ciaouser
export CIAO_TENANT_NAME=admin
```

Exporting those variables is not compulsory and they can be defined
Expand Down Expand Up @@ -146,6 +148,7 @@ Let's assume we're running a Ciao cluster with the following settings:
* The `user` user is part of only one project: `project1`
* The password for `user` is `ciaouser`
* `project1` UUID is `68a76514-5c8e-40a8-8c9e-0570a11d035b`
*

This can be defined through the following Ciao rc file:

Expand All @@ -156,6 +159,7 @@ export CIAO_CONTROLLER=ciao-ctl.intel.com
export CIAO_IDENTITY=https://ciao-identity.intel.com:35357
export CIAO_USERNAME=user
export CIAO_PASSWORD=ciaouser
export CIAO_TENANT_NAME=project1
```

### Cluster status (Privileged)
Expand Down
6 changes: 6 additions & 0 deletions ciao-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const (
ciaoUsernameEnv = "CIAO_USERNAME"
ciaoPasswordEnv = "CIAO_PASSWORD"
ciaoComputePortEnv = "CIAO_COMPUTEPORT"
ciaoTenantNameEnv = "CIAO_TENANT_NAME"
)

type queryValue struct {
Expand Down Expand Up @@ -262,13 +263,15 @@ func getCiaoEnvVariables() {
username := os.Getenv(ciaoUsernameEnv)
password := os.Getenv(ciaoPasswordEnv)
port := os.Getenv(ciaoComputePortEnv)
tenant := os.Getenv(ciaoTenantNameEnv)

infof("Ciao environment variables:\n")
infof("\t%s:%s\n", ciaoIdentityEnv, identity)
infof("\t%s:%s\n", ciaoControllerEnv, controller)
infof("\t%s:%s\n", ciaoUsernameEnv, username)
infof("\t%s:%s\n", ciaoPasswordEnv, password)
infof("\t%s:%s\n", ciaoComputePortEnv, port)
infof("\t%s:%s\n", ciaoTenantNameEnv, tenantName)

if identity != "" && *identityURL == "" {
*identityURL = identity
Expand All @@ -290,6 +293,9 @@ func getCiaoEnvVariables() {
*computePort, _ = strconv.Atoi(port)
}

if tenant != "" && *tenantName == "" {
*tenantName = tenant
}
}

func checkCompulsoryOptions() {
Expand Down

0 comments on commit 756be39

Please sign in to comment.