Skip to content

Commit

Permalink
Merge pull request #22 from indigo-dc/fix/output
Browse files Browse the repository at this point in the history
add task and cloudprovider output, fix #21
  • Loading branch information
bwegh authored May 2, 2017
2 parents 9508092 + fc10937 commit 0de3c17
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions orchent.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
)

const OrchentVersion string = "1.0.3"
const OrchentVersion string = "1.0.4"

var (
app = kingpin.New("orchent", "The orchestrator client. Please store your access token in the 'ORCHENT_TOKEN' environment variable: 'export ORCHENT_TOKEN=<your access token>'. If you need to specify the file containing the trusted root CAs use the 'ORCHENT_CAFILE' environment variable: 'export ORCHENT_CAFILE=<path to file containing trusted CAs>'.").Version(OrchentVersion)
Expand Down Expand Up @@ -94,15 +94,16 @@ type OrchentPage struct {
}

type OrchentDeployment struct {
Uuid string `json:"uuid"`
CreationTime string `json:"creationTime"`
UpdateTime string `json:"updateTime"`
Status string `json:"status"`
StatusReason string `json:"statusReason"`
Task string `json:"task"`
Callback string `json:"callback"`
Outputs map[string]interface{} `json:"outputs"`
Links []OrchentLink `json:"links"`
Uuid string `json:"uuid"`
CreationTime string `json:"creationTime"`
UpdateTime string `json:"updateTime"`
Status string `json:"status"`
StatusReason string `json:"statusReason"`
Task string `json:"task"`
CloudProviderName string `json:"CloudProviderName"`
Callback string `json:"callback"`
Outputs map[string]interface{} `json:"outputs"`
Links []OrchentLink `json:"links"`
}

type OrchentResource struct {
Expand Down Expand Up @@ -164,6 +165,8 @@ func deployment_to_string(dep OrchentDeployment, short bool) string {
outputs, _ := json.MarshalIndent(dep.Outputs, " ", " ")
more_lines := []string{
" status reason: " + dep.StatusReason,
" task: " + dep.Task,
" CloudProviderName: " + dep.CloudProviderName,
" outputs: \n " + fmt.Sprintf("%s", outputs),
" links:"}
lines = append(lines, more_lines...)
Expand Down Expand Up @@ -226,7 +229,7 @@ func client() *http.Client {
ca_file, use_other_ca := os.LookupEnv("ORCHENT_CAFILE")

if use_other_ca {
rootCAs := x509.NewCertPool()
rootCAs := x509.NewCertPool()
rootCAs.AppendCertsFromPEM(read_ca_file(ca_file))
tr := &http.Transport{
TLSClientConfig: &tls.Config{RootCAs: rootCAs},
Expand All @@ -236,29 +239,28 @@ func client() *http.Client {
return http.DefaultClient
}

func read_ca_file(caFileName string) []byte {
func read_ca_file(caFileName string) []byte {
data := make([]byte, 0)
caFile, openErr := os.Open(caFileName)
if openErr != nil {
fmt.Printf("error opening ca-file: %s\n", openErr)
return data[:0]
return data[:0]
}
info, infoErr := caFile.Stat()
if infoErr != nil {
fmt.Printf("error getting ca-file size: %s\n", infoErr)
return data[:0]
return data[:0]
}
size := info.Size()
data = make([]byte, size)
count, readErr := caFile.Read(data)
if readErr != nil || int64(count) < size {
fmt.Printf("error reading the ca-file: %s\n (read %d/%d)\n", readErr, count, size)
return data[:0]
return data[:0]
}
return data[:count]
}


func deployments_list(base *sling.Sling) {
base = base.Get("./deployments")
fmt.Println("retrieving deployment list:")
Expand Down

0 comments on commit 0de3c17

Please sign in to comment.