Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/GH-218-NFS-client
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentganne committed Dec 13, 2018
2 parents f2c6b0b + 7cc2cb7 commit c5dd062
Show file tree
Hide file tree
Showing 20 changed files with 939 additions and 341 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### ENHANCEMENTS

* Generate Alien 2.1-compatible events ([GH-148](https://github.com/ystia/yorc/issues/148))

### BUG FIXES

* Bootstrap of HA setup fails on GCP, at step configuring the NFS Client component [GH-218](https://github.com/ystia/yorc/issues/218))
Expand Down
104 changes: 76 additions & 28 deletions commands/deployments/dep_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,38 +128,86 @@ func StreamsEvents(client *httputil.YorcClient, deploymentID string, colorize, f
}
lastIdx = evts.LastIndex
for _, event := range evts.Events {
ts := event.Timestamp
if colorize {
ts = color.CyanString("%s", event.Timestamp)
}
evType, err := events.StatusUpdateTypeString(event.Type)
if err != nil {
if colorize {
fmt.Printf("%s: ", color.MagentaString("Warning"))
} else {
fmt.Print("Warning: ")
}
fmt.Printf("Unknown event type: %q\n", event.Type)
}
switch evType {
case events.InstanceStatusChangeType:
fmt.Printf("%s:\t Deployment: %s\t Node: %s\t Instance: %s\t State: %s\n", ts, event.DeploymentID, event.Node, event.Instance, event.Status)
case events.DeploymentStatusChangeType:
fmt.Printf("%s:\t Deployment: %s\t Deployment Status: %s\n", ts, event.DeploymentID, event.Status)
case events.CustomCommandStatusChangeType:
fmt.Printf("%s:\t Deployment: %s\t Task %q (custom command)\t Status: %s\n", ts, event.DeploymentID, event.TaskID, event.Status)
case events.ScalingStatusChangeType:
fmt.Printf("%s:\t Deployment: %s\t Task %q (scaling)\t Status: %s\n", ts, event.DeploymentID, event.TaskID, event.Status)
case events.WorkflowStatusChangeType:
fmt.Printf("%s:\t Deployment: %s\t Task %q (workflow)\t Status: %s\n", ts, event.DeploymentID, event.TaskID, event.Status)
}

fmt.Printf("%s\n", formatEvent(event, colorize))
}

response.Body.Close()

if stop {
return
}
}
}

func formatEvent(event json.RawMessage, colorize bool) string {
//fmt.Printf("%q", event)
var ret string
var data map[string]string
err := json.Unmarshal(event, &data)
if err != nil {
if colorize {
ret += fmt.Sprintf("%s: ", color.MagentaString("Warning"))
} else {
ret += fmt.Sprintf("Warning: ")
}
ret += fmt.Sprintf("Failed to unmarshal json:%q", event)
return ret
}

evType, is := data[events.EType.String()]
if !is {
if colorize {
ret += fmt.Sprintf("%s: ", color.MagentaString("Warning"))
} else {
ret += fmt.Sprintf("Warning: ")
}
ret += fmt.Sprintf("Misssing event type in json event:%q", event)
return ret
}

ts := data[events.ETimestamp.String()]
if colorize {
ts = color.CyanString("%s", ts)
}

statusChange, err := events.ParseStatusChangeType(evType)
if err != nil {
if colorize {
ret += fmt.Sprintf("%s: ", color.MagentaString("Warning"))
} else {
ret += fmt.Sprintf("Warning: ")
}
ret += fmt.Sprintf("Unknown event type: %q\n", evType)
return ret
}

switch statusChange {
case events.StatusChangeTypeInstance:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Node: %s\t Instance: %s\t Status: %s\n", ts, data[events.EDeploymentID.String()], data[events.ENodeID.String()], data[events.EInstanceID.String()], data[events.EStatus.String()])
case events.StatusChangeTypeDeployment:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Deployment Status: %s\n", ts, data[events.EDeploymentID.String()], data[events.EStatus.String()])
case events.StatusChangeTypeCustomCommand:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Task %q (custom command)\t Status: %s\n", ts, data[events.EDeploymentID.String()], data[events.ETaskID.String()], data[events.EStatus.String()])
case events.StatusChangeTypeScaling:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Task %q (scaling)\t Status: %s\n", ts, data[events.EDeploymentID.String()], data[events.ETaskID.String()], data[events.EStatus.String()])
case events.StatusChangeTypeWorkflow:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Task %q (workflow)\t Workflow: %s\t Status: %s\n", ts, data[events.EDeploymentID.String()], data[events.ETaskID.String()], data[events.EWorkflowID.String()], data[events.EStatus.String()])
case events.StatusChangeTypeWorkflowStep:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Task %q (workflowStep)\t Workflow: %s\t Instance: %s\t Step: %s\t Node: %s\t Operation: %s%s\t Status: %s\n", ts, data[events.EDeploymentID.String()],
data[events.ETaskID.String()], data[events.EWorkflowID.String()], data[events.EInstanceID.String()], data[events.EWorkflowStepID.String()], data[events.ENodeID.String()], data[events.EOperationName.String()], formatOptionalInfo(data), data[events.EStatus.String()])
case events.StatusChangeTypeAlienTask:
ret = fmt.Sprintf("%s:\t Deployment: %s\t Task %q (Execution)\t Execution: %q\t Workflow: %s\t Instance: %s\t Step: %s\t Node: %s\t Operation: %s%s\t Status: %s\n", ts, data[events.EDeploymentID.String()],
data[events.ETaskID.String()], data[events.ETaskExecutionID.String()], data[events.EWorkflowID.String()], data[events.EInstanceID.String()], data[events.EWorkflowStepID.String()], data[events.ENodeID.String()], data[events.EOperationName.String()], formatOptionalInfo(data), data[events.EStatus.String()])
}

return ret
}

func formatOptionalInfo(data map[string]string) string {
var ret string
if targetInst, is := data[events.ETargetInstanceID.String()]; is && targetInst != "" {
ret += fmt.Sprintf("\t TargetInstance: %s", targetInst)
}
if targetNode, is := data[events.ETargetNodeID.String()]; is && targetNode != "" {
ret += fmt.Sprintf("\t TargetNode: %s", targetNode)
}
return ret
}
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ Yorc |release| Documentation
telemetry
performance
upgrade
issues

35 changes: 35 additions & 0 deletions doc/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
..
Copyright 2018 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---

.. _yorc_issues_section:

Known issues
============

.. _yorc_ber_issue_section:

BER for SSH private key is not supported
----------------------------------------

Yorc uses SSH to connect to provisioned Computes or to hosts from hosts pool.

Default behavior is to add related private keys to SSH-agent in order to handle authentication.

But in some cases, SSH-agent can't be used and authentication must be done with private key file with the :ref:`--disable_ssh_agent <option_disable_ssh_agent_cmd>` command-line flag

As we use Golang ssh package (https://godoc.org/golang.org/x/crypto/ssh) to parse the private key, we don't support
BER encoding format (https://github.com/golang/go/issues/14145).
This kind of format is especially used by OpenStack Liberty SSH keypair generator.
6 changes: 6 additions & 0 deletions events/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ func TestRunConsulEventsPackageTests(t *testing.T) {
t.Run("TestWorkflowStatusChange", func(t *testing.T) {
testconsulWorkflowStatusChange(t, kv)
})
t.Run("TestWorkflowStepStatusChange", func(t *testing.T) {
testconsulWorkflowStepStatusChange(t, kv)
})
t.Run("testAlienTaskStatusChange", func(t *testing.T) {
testconsulAlienTaskStatusChange(t, kv)
})
t.Run("TestGetStatusEvents", func(t *testing.T) {
testconsulGetStatusEvents(t, kv)
})
Expand Down
Loading

0 comments on commit c5dd062

Please sign in to comment.