Skip to content

Commit

Permalink
Merge pull request #34 from indigo-dc/deep-devel
Browse files Browse the repository at this point in the history
Added support for new parameters, fix #33
  • Loading branch information
maricaantonacci authored Nov 2, 2018
2 parents 789f461 + 8ab8f99 commit c5d0175
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ For more information and more examples please see the [documentation](https://in

## using Docker
If your system is not supported you can still use orchent through a lightweight Docker container.
Download the container in the release section and import it using the `docker load` command:
Download the container in the [release section](https://github.com/indigo-dc/orchent/releases)(choose the latest stable version) and import it using the `docker load` command, e.g.:
```
docker load --input orchent_container_1.1.0.tar
```
Expand Down
2 changes: 1 addition & 1 deletion gitbook/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ yum install golang

#### Importing the Docker Container
If your system is not supported you can still use orchent through a lightweight Docker container.
Download the container in the release section and import it using the `docker load` command:
Download the container in the [release section](https://github.com/indigo-dc/orchent/releases) (choose the latest stable version) and import it using the `docker load` command, e.g.:
```
docker load --input orchent_container_1.0.4.tar
```
Expand Down
12 changes: 7 additions & 5 deletions gitbook/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ usage: orchent depcreate [<flags>] <template> <parameter>
create a new deployment
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--version Show application version.
-u, --url=URL the base url of the orchestrator rest interface. Alternative the environment
variable 'ORCHENT_URL' can be used: 'export ORCHENT_URL=<the_url>'
--callback="" the callback url
--help Show context-sensitive help (also try --help-long and --help-man).
--version Show application version.
-u, --url=URL the base url of the orchestrator rest interface. Alternative the environment variable 'ORCHENT_URL' can be used: 'export ORCHENT_URL=<the_url>'
--callback="" the callback url
--maxProvidersRetry=MAXPROVIDERSRETRY
Maximum number of cloud providers to be used in case of failure (Default: UNBOUNDED).
--keepLastAttempt=true In case of failure, keep the resources allocated in the last try (Default: true).
Args:
<template> the tosca template file
Expand Down
43 changes: 26 additions & 17 deletions orchent.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"
)

const OrchentVersion string = "1.2.0"
const OrchentVersion string = "1.2.1"

var (
app = kingpin.New("orchent", "The orchestrator client. \n \nPlease either store your access token in 'ORCHENT_TOKEN' or set the account to use with oidc-agent in the 'ORCHENT_AGENT_ACCOUNT' and the socket of the oidc-agent in the 'OIDC_SOCK' environment variable: \n export ORCHENT_TOKEN=<your access token> \n OR \n export OIDC_SOCK=<path to the oidc-agent socket> (usually this is already exported) \n export ORCHENT_AGENT_ACCOUNT=<account to use> \nIf you need to specify the file containing the trusted root CAs use the 'ORCHENT_CAFILE' environment variable: \n export ORCHENT_CAFILE=<path to file containing trusted CAs>\n \n").Version(OrchentVersion)
Expand All @@ -32,16 +32,20 @@ var (
showDep = app.Command("depshow", "show a specific deployment")
showDepUuid = showDep.Arg("uuid", "the uuid of the deployment to display").Required().String()

createDep = app.Command("depcreate", "create a new deployment")
createDepCallback = createDep.Flag("callback", "the callback url").Default("").String()
createDepTemplate = createDep.Arg("template", "the tosca template file").Required().File()
createDepParameter = createDep.Arg("parameter", "the parameter to set (json object)").Required().String()

updateDep = app.Command("depupdate", "update the given deployment")
updateDepCallback = updateDep.Flag("callback", "the callback url").Default("").String()
updateDepUuid = updateDep.Arg("uuid", "the uuid of the deployment to update").Required().String()
updateDepTemplate = updateDep.Arg("template", "the tosca template file").Required().File()
updateDepParameter = updateDep.Arg("parameter", "the parameter to set (json object)").Required().String()
createDep = app.Command("depcreate", "create a new deployment")
createDepCallback = createDep.Flag("callback", "the callback url").Default("").String()
createDepMaxProvidersRetry = createDep.Flag("maxProvidersRetry", "Maximum number of cloud providers to be used in case of failure (Default: UNBOUNDED).").Uint8()
createDepKeepLastAttempt = createDep.Flag("keepLastAttempt", "In case of failure, keep the resources allocated in the last try (Default: true).").Default("true").Enum("true", "false")
createDepTemplate = createDep.Arg("template", "the tosca template file").Required().File()
createDepParameter = createDep.Arg("parameter", "the parameter to set (json object)").Required().String()

updateDep = app.Command("depupdate", "update the given deployment")
updateDepCallback = updateDep.Flag("callback", "the callback url").Default("").String()
updateDepMaxProvidersRetry = updateDep.Flag("maxProvidersRetry", "Maximum number of cloud providers to be used in case of failure (Default: UNBOUNDED).").Uint8()
updateDepKeepLastAttempt = updateDep.Flag("keepLastAttempt", "In case of failure, keep the resources allocated in the last try (Default: true).").Default("true").Enum("true", "false")
updateDepUuid = updateDep.Arg("uuid", "the uuid of the deployment to update").Required().String()
updateDepTemplate = updateDep.Arg("template", "the tosca template file").Required().File()
updateDepParameter = updateDep.Arg("parameter", "the parameter to set (json object)").Required().String()

depTemplate = app.Command("deptemplate", "show the template of the given deployment")
templateDepUuid = depTemplate.Arg("uuid", "the uuid of the deployment to get the template").Required().String()
Expand Down Expand Up @@ -177,9 +181,11 @@ type OrchentResourceList struct {
}

type OrchentCreateRequest struct {
Template string `json:"template"`
Parameters map[string]interface{} `json:"parameters"`
Callback string `json:"callback,omitempty"`
Template string `json:"template"`
Parameters map[string]interface{} `json:"parameters"`
Callback string `json:"callback,omitempty"`
MaxProvidersRetry uint8 `json:"maxProvidersRetry,omitempty"`
KeepLastAttempt string `json:"keepLastAttempt,omitempty"`
}

func (depList OrchentDeploymentList) String() string {
Expand Down Expand Up @@ -371,7 +377,8 @@ func receive_and_print_deploymentlist(complete *sling.Sling, before int, after i
}
}

func deployment_create_update(templateFile *os.File, parameter string, callback string, depUuid *string, base *sling.Sling) {
func deployment_create_update(templateFile *os.File, parameter string, callback string, maxProvidersRetry uint8, keepLastAttempt string, depUuid *string, base *sling.Sling) {

var parameterMap map[string]interface{}
paramErr := json.Unmarshal([]byte(parameter), &parameterMap)
if paramErr != nil {
Expand All @@ -396,6 +403,8 @@ func deployment_create_update(templateFile *os.File, parameter string, callback
Template: template,
Parameters: parameterMap,
Callback: callback,
MaxProvidersRetry: maxProvidersRetry,
KeepLastAttempt: keepLastAttempt,
}
deployment := new(OrchentDeployment)
orchentError := new(OrchentError)
Expand Down Expand Up @@ -700,13 +709,13 @@ func main() {
case createDep.FullCommand():
baseUrl := get_base_url()
base := base_connection(baseUrl)
deployment_create_update(*createDepTemplate, *createDepParameter, *createDepCallback, nil, base)
deployment_create_update(*createDepTemplate, *createDepParameter, *createDepCallback, *createDepMaxProvidersRetry, *createDepKeepLastAttempt, nil, base)

case updateDep.FullCommand():
baseUrl := get_base_url()
base := base_connection(baseUrl)
uuid := try_alias_uuid(*updateDepUuid, aliases)
deployment_create_update(*updateDepTemplate, *updateDepParameter, *updateDepCallback, &uuid, base)
deployment_create_update(*updateDepTemplate, *updateDepParameter, *updateDepCallback, *updateDepMaxProvidersRetry, *updateDepKeepLastAttempt, &uuid, base)

case depTemplate.FullCommand():
baseUrl := get_base_url()
Expand Down

0 comments on commit c5d0175

Please sign in to comment.