You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/09/20 02:07:08 UTC
[incubator-openwhisk-wskdeploy] branch master updated: Modify the
error messages (#493)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git
The following commit(s) were added to refs/heads/master by this push:
new ed64874 Modify the error messages (#493)
ed64874 is described below
commit ed64874865d99a9382a83da21e9c0010f2b618cb
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Tue Sep 19 22:07:06 2017 -0400
Modify the error messages (#493)
Closes #504
---
cmd/report.go | 2 +-
cmd/root.go | 28 ++++----
deployers/deploymentreader.go | 8 +--
deployers/filesystemreader.go | 5 +-
deployers/servicedeployer.go | 116 +++++++++++++++++++-----------
deployers/whiskclient.go | 6 +-
parsers/manifest_parser.go | 2 +-
tests/src/integration/common/wskdeploy.go | 46 ++++++------
utils/errorhandlers.go | 4 ++
utils/misc.go | 4 +-
utils/wskdeployerror.go | 21 ++++++
wski18n/i18n_resources.go | 4 +-
wski18n/resources/en_US.all.json | 54 +++++++++++++-
13 files changed, 202 insertions(+), 98 deletions(-)
diff --git a/cmd/report.go b/cmd/report.go
index 05a8c02..5604238 100644
--- a/cmd/report.go
+++ b/cmd/report.go
@@ -80,7 +80,7 @@ func printDeploymentInfo(*whisk.Client) error {
//We currently list packages, actions, triggers, rules.
wg.Add(4)
- fmt.Println("----==== OpenWhisk Deployment Status ====----")
+ utils.PrintOpenWhiskOutputln("----==== OpenWhisk Deployment Status ====----")
// we set the default package list options
pkgoptions := &whisk.PackageListOptions{false, 0, 0, 0, false}
packages, _, err := client.Packages.List(pkgoptions)
diff --git a/cmd/root.go b/cmd/root.go
index b01fd6d..b7111e2 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -128,7 +128,7 @@ func initConfig() {
_, err := whisk.ReadProps(utils.Flags.CfgFile)
if err != nil {
utils.Flags.CfgFile = defaultPath
- fmt.Println("Invalid config file detected, so by bdefault it is set to " + utils.Flags.CfgFile)
+ utils.PrintOpenWhiskOutputln("Invalid config file detected, so by bdefault it is set to " + utils.Flags.CfgFile)
}
} else {
@@ -171,9 +171,10 @@ func Deploy() error {
stderr = wski18n.T("Manifest file not found at path {{.projectPath}}.\n",
map[string]interface{}{"projectPath": projectPath})
whisk.Debug(whisk.DbgError, stderr)
- errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file.\n",
- map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml})
- return utils.NewInputYamlFileError(errString)
+ errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file. Manifest file not found at path {{.projectPath}}.\n",
+ map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml,
+ "projectPath": projectPath})
+ return utils.NewErrorManifestFileNotFound(errString)
}
whisk.Debug(whisk.DbgInfo, stdout)
}
@@ -229,10 +230,10 @@ func Deploy() error {
}
} else {
- errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file.\n",
- map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml})
+ errString := wski18n.T("Manifest file is not found at the path [{{.filePath}}].\n",
+ map[string]interface{}{"filePath": utils.Flags.ManifestPath})
whisk.Debug(whisk.DbgError, errString)
- return utils.NewInputYamlFileError(errString)
+ return utils.NewErrorManifestFileNotFound(errString)
}
}
@@ -263,9 +264,10 @@ func Undeploy() error {
stderr = wski18n.T("Manifest file not found at path {{.projectPath}}.\n",
map[string]interface{}{"projectPath": projectPath})
whisk.Debug(whisk.DbgError, stderr)
- errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file.\n",
- map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml})
- return utils.NewInputYamlFileError(errString)
+ errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file. Manifest file not found at path {{.projectPath}}.\n",
+ map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml,
+ "projectPath": projectPath})
+ return utils.NewErrorManifestFileNotFound(errString)
}
whisk.Debug(whisk.DbgInfo, stdout)
}
@@ -315,9 +317,9 @@ func Undeploy() error {
}
} else {
- errString := wski18n.T("Missing {{.yaml}}/{{.yml}} file.\n",
- map[string]interface{}{"yaml": utils.ManifestFileNameYaml, "yml": utils.ManifestFileNameYml})
+ errString := wski18n.T("Manifest file is not found at the path [{{.filePath}}].\n",
+ map[string]interface{}{"filePath": utils.Flags.ManifestPath})
whisk.Debug(whisk.DbgError, errString)
- return utils.NewInputYamlFileError(errString)
+ return utils.NewErrorManifestFileNotFound(errString)
}
}
diff --git a/deployers/deploymentreader.go b/deployers/deploymentreader.go
index 57b4c1a..9a0e145 100644
--- a/deployers/deploymentreader.go
+++ b/deployers/deploymentreader.go
@@ -18,8 +18,6 @@
package deployers
import (
- "fmt"
-
"github.com/apache/incubator-openwhisk-client-go/whisk"
"github.com/apache/incubator-openwhisk-wskdeploy/parsers"
"github.com/apache/incubator-openwhisk-wskdeploy/utils"
@@ -68,7 +66,7 @@ func (reader *DeploymentReader) bindPackageInputsAndAnnotations() {
if reader.DeploymentDescriptor.Application.Packages == nil {
// a single package is specified in deployment YAML file with "package" key
packMap[reader.DeploymentDescriptor.Application.Package.Packagename] = reader.DeploymentDescriptor.Application.Package
- fmt.Println("WARNING: The package YAML key in deployment file will soon be deprecated. Please use packages instead as described in specifications.")
+ utils.PrintOpenWhiskOutputln("WARNING: The package YAML key in deployment file will soon be deprecated. Please use packages instead as described in specifications.")
} else {
for packName, depPacks := range reader.DeploymentDescriptor.Application.Packages {
depPacks.Packagename = packName
@@ -81,7 +79,7 @@ func (reader *DeploymentReader) bindPackageInputsAndAnnotations() {
serviceDeployPack := reader.serviceDeployer.Deployment.Packages[packName]
if serviceDeployPack == nil {
- fmt.Println("WARNING: Package name in deployment file " + packName + " does not match with manifest file.")
+ utils.PrintOpenWhiskOutputln("WARNING: Package name in deployment file " + packName + " does not match with manifest file.")
break
}
@@ -242,7 +240,7 @@ func (reader *DeploymentReader) bindTriggerInputsAndAnnotations() {
}
for _, keyVal := range wskTrigger.Parameters {
- fmt.Println("Checking key " + keyVal.Key)
+ utils.PrintOpenWhiskOutputln("Checking key " + keyVal.Key)
if _, exists := depParams[keyVal.Key]; !exists {
keyValArr = append(keyValArr, keyVal)
}
diff --git a/deployers/filesystemreader.go b/deployers/filesystemreader.go
index a6ef289..c42a068 100644
--- a/deployers/filesystemreader.go
+++ b/deployers/filesystemreader.go
@@ -19,7 +19,6 @@ package deployers
import (
"errors"
- "fmt"
"os"
"path/filepath"
"strings"
@@ -45,7 +44,7 @@ func NewFileSystemReader(serviceDeployer *ServiceDeployer) *FileSystemReader {
func (reader *FileSystemReader) ReadProjectDirectory(manifest *parsers.ManifestYAML) ([]utils.ActionRecord, error) {
- fmt.Println("Inspecting project directory for actions....")
+ utils.PrintOpenWhiskOutputln("Inspecting project directory for actions....")
projectPathCount, err := reader.getFilePathCount(reader.serviceDeployer.ProjectPath)
actions := make([]utils.ActionRecord, 0)
@@ -89,7 +88,7 @@ func (reader *FileSystemReader) ReadProjectDirectory(manifest *parsers.ManifestY
}
}
} else if strings.HasPrefix(fpath, reader.serviceDeployer.ProjectPath+"/"+FileSystemSourceDirectoryName) {
- fmt.Println("Searching directory " + filepath.Base(fpath) + " for action source code.")
+ utils.PrintOpenWhiskOutputln("Searching directory " + filepath.Base(fpath) + " for action source code.")
} else {
return filepath.SkipDir
}
diff --git a/deployers/servicedeployer.go b/deployers/servicedeployer.go
index 0bdb8df..32dd4ca 100644
--- a/deployers/servicedeployer.go
+++ b/deployers/servicedeployer.go
@@ -309,6 +309,10 @@ func (deployer *ServiceDeployer) DeployDependencies() error {
error := deployer.createBinding(bindingPackage)
if error != nil {
return error
+ } else {
+ output := wski18n.T("Dependency {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": depName})
+ whisk.Debug(whisk.DbgInfo, output)
}
} else {
@@ -327,8 +331,6 @@ func (deployer *ServiceDeployer) DeployDependencies() error {
map[string]interface{}{"depName": depName})
utils.PrintOpenWhiskErrorMessage(errString)
return err
- } else {
- fmt.Println("Done!")
}
// if the RootPackageName is different from depName
@@ -350,8 +352,15 @@ func (deployer *ServiceDeployer) DeployDependencies() error {
bindingPackage.Parameters = depRecord.Parameters
bindingPackage.Annotations = depRecord.Annotations
- deployer.createBinding(bindingPackage)
- }
+ err = deployer.createBinding(bindingPackage)
+ if err != nil {
+ return err
+ } else {
+ output := wski18n.T("Dependency {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": depName})
+ whisk.Debug(whisk.DbgInfo, output)
+ }
+ }
}
}
}
@@ -451,8 +460,11 @@ func (deployer *ServiceDeployer) createBinding(packa *whisk.BindingPackage) erro
map[string]interface{}{"err": wskErr.Error(), "code": strconv.Itoa(wskErr.ExitCode)})
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
+ } else {
+ output := wski18n.T("Package binding {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": packa.Name})
+ whisk.Debug(whisk.DbgInfo, output)
}
- fmt.Println("Done!")
return nil
}
@@ -467,12 +479,18 @@ func (deployer *ServiceDeployer) createPackage(packa *whisk.Package) error {
map[string]interface{}{"err": wskErr.Error(), "code": strconv.Itoa(wskErr.ExitCode)})
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
+ } else {
+ output := wski18n.T("Package {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": packa.Name})
+ whisk.Debug(whisk.DbgInfo, output)
}
- fmt.Println("Done!")
return nil
}
func (deployer *ServiceDeployer) createTrigger(trigger *whisk.Trigger) error {
+ output := wski18n.T("Deploying trigger {{.output}} ...",
+ map[string]interface{}{"output": trigger.Name})
+ whisk.Debug(whisk.DbgInfo, output)
_, _, err := deployer.Client.Triggers.Insert(trigger, true)
if err != nil {
wskErr := err.(*whisk.WskError)
@@ -480,8 +498,11 @@ func (deployer *ServiceDeployer) createTrigger(trigger *whisk.Trigger) error {
map[string]interface{}{"err": wskErr.Error(), "code": strconv.Itoa(wskErr.ExitCode)})
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
+ } else {
+ output := wski18n.T("Trigger {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": trigger.Name})
+ whisk.Debug(whisk.DbgInfo, output)
}
- fmt.Println("Done!")
return nil
}
@@ -535,7 +556,9 @@ func (deployer *ServiceDeployer) createFeedAction(trigger *whisk.Trigger, feedNa
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
}
- fmt.Println("Done!")
+ output = wski18n.T("Trigger feed {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": trigger.Name})
+ whisk.Debug(whisk.DbgInfo, output)
return nil
}
@@ -574,7 +597,9 @@ func (deployer *ServiceDeployer) createRule(rule *whisk.Rule) error {
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
- fmt.Println("Done!")
+ output = wski18n.T("Rule {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": rule.Name})
+ whisk.Debug(whisk.DbgInfo, output)
return nil
}
@@ -596,8 +621,11 @@ func (deployer *ServiceDeployer) createAction(pkgname string, action *whisk.Acti
map[string]interface{}{"err": wskErr.Error(), "code": strconv.Itoa(wskErr.ExitCode)})
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
+ } else {
+ output := wski18n.T("Action {{.output}} has been successfully deployed.\n",
+ map[string]interface{}{"output": action.Name})
+ whisk.Debug(whisk.DbgInfo, output)
}
- fmt.Println("Done!")
return nil
}
@@ -611,7 +639,6 @@ func (deployer *ServiceDeployer) createApi(api *whisk.ApiCreateRequest) error {
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
- fmt.Println("Done!")
return nil
}
@@ -730,10 +757,11 @@ func (deployer *ServiceDeployer) UnDeployDependencies() error {
map[string]interface{}{"depName": depName})
whisk.Debug(whisk.DbgError, errString)
return err
- } else {
- fmt.Println("Done!")
}
}
+ output = wski18n.T("Dependency {{.depName}} has been successfully undeployed.\n",
+ map[string]interface{}{"depName": depName})
+ whisk.Debug(whisk.DbgInfo, output)
}
}
@@ -822,7 +850,6 @@ func (deployer *ServiceDeployer) deletePackage(packa *whisk.Package) error {
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
- fmt.Println("Done!")
return nil
}
@@ -837,8 +864,11 @@ func (deployer *ServiceDeployer) deleteTrigger(trigger *whisk.Trigger) error {
map[string]interface{}{"err": wskErr.Error(), "code": strconv.Itoa(wskErr.ExitCode)})
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
+ } else {
+ output := wski18n.T("Trigger {{.trigger}} has been removed.\n",
+ map[string]interface{}{"trigger": trigger.Name})
+ whisk.Debug(whisk.DbgInfo, output)
}
- fmt.Println("Done!")
return nil
}
@@ -883,7 +913,6 @@ func (deployer *ServiceDeployer) deleteFeedAction(trigger *whisk.Trigger, feedNa
}
}
- fmt.Println("Done!")
return nil
}
@@ -910,9 +939,10 @@ func (deployer *ServiceDeployer) deleteRule(rule *whisk.Rule) error {
whisk.Debug(whisk.DbgError, errString)
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
-
- fmt.Println("Done!")
}
+ output = wski18n.T("Rule {{.rule}} has been removed.\n",
+ map[string]interface{}{"rule": rule.Name})
+ whisk.Debug(whisk.DbgInfo, output)
return nil
}
@@ -937,7 +967,9 @@ func (deployer *ServiceDeployer) deleteAction(pkgname string, action *whisk.Acti
return utils.NewWhiskClientError(wskErr.Error(), wskErr.ExitCode)
}
- fmt.Println("Done!")
+ output = wski18n.T("Action {{.action}} has been removed.\n",
+ map[string]interface{}{"action": action.Name})
+ whisk.Debug(whisk.DbgInfo, output)
return nil
}
@@ -958,12 +990,12 @@ func (deployer *ServiceDeployer) getQualifiedName(name string, namespace string)
func (deployer *ServiceDeployer) printDeploymentAssets(assets *DeploymentApplication) {
// pretty ASCII OpenWhisk graphic
- fmt.Println(" ____ ___ _ _ _ _ _\n /\\ \\ / _ \\ _ __ ___ _ __ | | | | |__ (_)___| | __\n /\\ /__\\ \\ | | | | '_ \\ / _ \\ '_ \\| | | | '_ \\| / __| |/ /\n / \\____ \\ / | |_| | |_) | __/ | | | |/\\| | | | | \\__ \\ <\n \\ \\ / \\/ \\___/| .__/ \\___|_| |_|__/\\__|_| |_|_|___/_|\\_\\ \n \\___\\/ |_|\n")
+ utils.PrintOpenWhiskOutputln(" ____ ___ _ _ _ _ _\n /\\ \\ / _ \\ _ __ ___ _ __ | | | | |__ (_)___| | __\n /\\ /__\\ \\ | | | | '_ \\ / _ \\ '_ \\| | | | '_ \\| / __| |/ /\n / \\____ \\ / | |_| | |_) | __/ | | | |/\\| | | | | \\__ \\ <\n \\ \\ / \\/ \\___/| .__/ \\___|_| |_|__/\\__|_| |_|_|___/_|\\_\\ \n \\___\\/ |_|\n")
- fmt.Println("Packages:")
+ utils.PrintOpenWhiskOutputln("Packages:")
for _, pack := range assets.Packages {
- fmt.Println("Name: " + pack.Package.Name)
- fmt.Println(" bindings: ")
+ utils.PrintOpenWhiskOutputln("Name: " + pack.Package.Name)
+ utils.PrintOpenWhiskOutputln(" bindings: ")
for _, p := range pack.Package.Parameters {
jsonValue, err := utils.PrettyJSON(p.Value)
if err != nil {
@@ -974,18 +1006,18 @@ func (deployer *ServiceDeployer) printDeploymentAssets(assets *DeploymentApplica
}
for key, dep := range pack.Dependencies {
- fmt.Println(" * dependency: " + key)
- fmt.Println(" location: " + dep.Location)
+ utils.PrintOpenWhiskOutputln(" * dependency: " + key)
+ utils.PrintOpenWhiskOutputln(" location: " + dep.Location)
if !dep.IsBinding {
- fmt.Println(" local path: " + dep.ProjectPath)
+ utils.PrintOpenWhiskOutputln(" local path: " + dep.ProjectPath)
}
}
- fmt.Println("")
+ utils.PrintOpenWhiskOutputln("")
for _, action := range pack.Actions {
- fmt.Println(" * action: " + action.Action.Name)
- fmt.Println(" bindings: ")
+ utils.PrintOpenWhiskOutputln(" * action: " + action.Action.Name)
+ utils.PrintOpenWhiskOutputln(" bindings: ")
for _, p := range action.Action.Parameters {
jsonValue, err := utils.PrettyJSON(p.Value)
if err != nil {
@@ -994,25 +1026,25 @@ func (deployer *ServiceDeployer) printDeploymentAssets(assets *DeploymentApplica
fmt.Printf(" - %s : %v\n", p.Key, jsonValue)
}
}
- fmt.Println(" annotations: ")
+ utils.PrintOpenWhiskOutputln(" annotations: ")
for _, p := range action.Action.Annotations {
fmt.Printf(" - %s : %v\n", p.Key, p.Value)
}
}
- fmt.Println("")
+ utils.PrintOpenWhiskOutputln("")
for _, action := range pack.Sequences {
- fmt.Println(" * sequence: " + action.Action.Name)
+ utils.PrintOpenWhiskOutputln(" * sequence: " + action.Action.Name)
}
- fmt.Println("")
+ utils.PrintOpenWhiskOutputln("")
}
- fmt.Println("Triggers:")
+ utils.PrintOpenWhiskOutputln("Triggers:")
for _, trigger := range assets.Triggers {
- fmt.Println("* trigger: " + trigger.Name)
- fmt.Println(" bindings: ")
+ utils.PrintOpenWhiskOutputln("* trigger: " + trigger.Name)
+ utils.PrintOpenWhiskOutputln(" bindings: ")
for _, p := range trigger.Parameters {
jsonValue, err := utils.PrettyJSON(p.Value)
@@ -1023,24 +1055,24 @@ func (deployer *ServiceDeployer) printDeploymentAssets(assets *DeploymentApplica
}
}
- fmt.Println(" annotations: ")
+ utils.PrintOpenWhiskOutputln(" annotations: ")
for _, p := range trigger.Annotations {
value := "?"
if str, ok := p.Value.(string); ok {
value = str
}
- fmt.Println(" - name: " + p.Key + " value: " + value)
+ utils.PrintOpenWhiskOutputln(" - name: " + p.Key + " value: " + value)
}
}
- fmt.Println("\n Rules")
+ utils.PrintOpenWhiskOutputln("\n Rules")
for _, rule := range assets.Rules {
- fmt.Println("* rule: " + rule.Name)
- fmt.Println(" - trigger: " + rule.Trigger.(string) + "\n - action: " + rule.Action.(string))
+ utils.PrintOpenWhiskOutputln("* rule: " + rule.Name)
+ utils.PrintOpenWhiskOutputln(" - trigger: " + rule.Trigger.(string) + "\n - action: " + rule.Action.(string))
}
- fmt.Println("")
+ utils.PrintOpenWhiskOutputln("")
}
diff --git a/deployers/whiskclient.go b/deployers/whiskclient.go
index 0277380..1b7949f 100644
--- a/deployers/whiskclient.go
+++ b/deployers/whiskclient.go
@@ -127,17 +127,17 @@ func NewWhiskConfig(proppath string, deploymentPath string, manifestPath string,
whiskproperty, _ := GetWskPropFromWhiskProperty(pi)
credential = GetPropertyValue(credential, whiskproperty.AuthKey, WHISKPROPERTY)
if credential.Source == WHISKPROPERTY {
- fmt.Println("WARNING: The authentication key was retrieved from whisk.properties " +
+ utils.PrintOpenWhiskOutputln("WARNING: The authentication key was retrieved from whisk.properties " +
"which will soon be deprecated please do not use it outside of Travis builds.")
}
namespace = GetPropertyValue(namespace, whiskproperty.Namespace, WHISKPROPERTY)
if namespace.Source == WHISKPROPERTY {
- fmt.Println("WARNING: The namespace was retrieved from whisk.properties " +
+ utils.PrintOpenWhiskOutputln("WARNING: The namespace was retrieved from whisk.properties " +
"which will soon be deprecated please do not use it outside of Travis builds.")
}
apiHost = GetPropertyValue(apiHost, whiskproperty.APIHost, WHISKPROPERTY)
if apiHost.Source == WHISKPROPERTY {
- fmt.Println("WARNING: The API host was retrieved from whisk.properties " +
+ utils.PrintOpenWhiskOutputln("WARNING: The API host was retrieved from whisk.properties " +
"which will soon be deprecated please do not use it outside of Travis builds.")
}
diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 2b6a9a4..f926aec 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -304,7 +304,7 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string) (ar []
code = base64.StdEncoding.EncodeToString([]byte(dat))
}
if ext == ".zip" && action.Runtime == "" {
- fmt.Println("need explicit action Runtime value")
+ utils.PrintOpenWhiskOutputln("need explicit action Runtime value")
}
wskaction.Exec.Code = &code
}
diff --git a/tests/src/integration/common/wskdeploy.go b/tests/src/integration/common/wskdeploy.go
index 330b47f..098bd75 100644
--- a/tests/src/integration/common/wskdeploy.go
+++ b/tests/src/integration/common/wskdeploy.go
@@ -106,31 +106,29 @@ func printOutput(outs string) {
}
func (wskdeploy *Wskdeploy) RunCommand(s ...string) (string, error) {
- command := exec.Command(wskdeploy.Path, s...)
- command.Dir = wskdeploy.Dir
-
- fmt.Println("wskdeploy.Path is " + wskdeploy.Path)
- //fmt.Println("s is " + string(s))
- printCommand(command)
-
- var outb, errb bytes.Buffer
- command.Stdout = &outb
- command.Stderr = &errb
- err := command.Run()
-
- var returnError error = nil
- if err != nil {
- returnError = err
- } else {
- if len(errb.String()) > 0 {
- returnError = utils.NewTestCaseError(errb.String())
+ command := exec.Command(wskdeploy.Path, s...)
+ command.Dir = wskdeploy.Dir
+
+ printCommand(command)
+
+ var outb, errb bytes.Buffer
+ command.Stdout = &outb
+ command.Stderr = &errb
+ err := command.Run()
+
+ var returnError error = nil
+ if err != nil {
+ if len(errb.String()) > 0 {
+ returnError = utils.NewTestCaseError(errb.String())
+ } else {
+ returnError = err
}
- }
- printOutput(outb.String())
- if returnError != nil {
- printError(returnError.Error())
- }
- return outb.String(), returnError
+ }
+ printOutput(outb.String())
+ if returnError != nil {
+ printError(returnError.Error())
+ }
+ return outb.String(), returnError
}
func (wskdeploy *Wskdeploy) Deploy(manifestPath string, deploymentPath string) (string, error) {
diff --git a/utils/errorhandlers.go b/utils/errorhandlers.go
index a20fb29..5b7cbf4 100644
--- a/utils/errorhandlers.go
+++ b/utils/errorhandlers.go
@@ -57,6 +57,10 @@ func PrintOpenWhiskOutput(output string) {
fmt.Fprintf(outputStream, "%s", color.GreenString(output))
}
+func PrintOpenWhiskOutputln(output string) {
+ fmt.Println(output)
+}
+
func PrintOpenWhiskErrorMessage(err string) {
outputStream := colorable.NewColorableStderr()
fmt.Fprintf(outputStream, "%s", color.RedString(err))
diff --git a/utils/misc.go b/utils/misc.go
index 0f5c526..1c33deb 100644
--- a/utils/misc.go
+++ b/utils/misc.go
@@ -160,14 +160,14 @@ func GetEnvVar(key interface{}) interface{} {
if strings.Contains(keystr,"$"+substr) {
thisValue = os.Getenv(substr)
if thisValue == "" {
- fmt.Println("WARNING: Missing Environment Variable " + substr + ".")
+ PrintOpenWhiskOutputln("WARNING: Missing Environment Variable " + substr + ".")
}
keystr = strings.Replace(keystr,"$"+substr,thisValue,-1)
//if the substr is a ${ENV_VAR}
} else if strings.Contains(keystr,"${"+substr+"}") {
thisValue = os.Getenv(substr)
if thisValue == "" {
- fmt.Println("WARNING: Missing Environment Variable " + substr + ".")
+ PrintOpenWhiskOutputln("WARNING: Missing Environment Variable " + substr + ".")
}
keystr = strings.Replace(keystr,"${"+substr+"}",thisValue,-1)
}
diff --git a/utils/wskdeployerror.go b/utils/wskdeployerror.go
index d6b0939..decd13d 100644
--- a/utils/wskdeployerror.go
+++ b/utils/wskdeployerror.go
@@ -28,6 +28,7 @@ const (
INVALID_YAML_INPUT = "Invalid input of Yaml file"
INVALID_YAML_FORMAT = "Invalid input of Yaml format"
OPENWHISK_CLIENT_ERROR = "OpenWhisk Client Error"
+ MANIFEST_NOT_FOUND = INVALID_YAML_INPUT
UNKNOWN = "Unknown"
LINE = "line"
)
@@ -68,6 +69,26 @@ func (e *BaseErr) SetMessage(message string) {
e.Message = message
}
+type ErrorManifestFileNotFound struct {
+ BaseErr
+ errorType string
+}
+
+func NewErrorManifestFileNotFound(errMessage string) *ErrorManifestFileNotFound {
+ _, fn, lineNum, _ := runtime.Caller(1)
+ var err = &ErrorManifestFileNotFound{
+ errorType: wski18n.T(MANIFEST_NOT_FOUND),
+ }
+ err.SetFileName(fn)
+ err.SetLineNum(lineNum)
+ err.SetMessage(errMessage)
+ return err
+}
+
+func (e *ErrorManifestFileNotFound) Error() string {
+ return fmt.Sprintf("%s [%d]: %s =====> %s\n", e.FileName, e.LineNum, e.errorType, e.Message)
+}
+
type InputYamlFileError struct {
BaseErr
errorType string
diff --git a/wski18n/i18n_resources.go b/wski18n/i18n_resources.go
index 9c48f2c..7d3a7ea 100644
--- a/wski18n/i18n_resources.go
+++ b/wski18n/i18n_resources.go
@@ -114,7 +114,7 @@ func wski18nResourcesDe_deAllJson() (*asset, error) {
return a, nil
}
-var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x59\x4f\x6f\xe3\xb6\x13\xbd\xfb\x53\x0c\x72\xf1\x25\xd0\xef\x9e\x5b\xb0\xbf\x74\x37\xd8\x6e\x12\x24\x69\x17\x41\x5b\xc0\x8c\x38\xb2\x58\x53\xa4\x40\x0e\x1d\xb8\x82\xbe\x7b\x41\xc9\x76\xb2\x59\x89\xa2\xfc\xaf\x5b\xa0\x37\x4b\xe2\x7b\x6f\x86\x43\x0e\x67\xe8\xdf\x26\x00\xd5\x04\x00\xe0\x4c\xf0\xb3\x0b\x38\xfb\x84\x52\xea\xb3\xf3\xf6\x15\x19\xa6\xac\x64\x24\xb4\xf2\xdf\x2e\x15\x5c\xde\x5d\x43\xae\x2d\x41 [...]
+var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x59\x4d\x6f\xdb\x38\x13\xbe\xfb\x57\x0c\x72\xf1\x25\xd0\x7b\xef\x2d\xe8\x9b\x6d\x83\x6e\x93\x20\xc9\x6e\x11\x74\x0b\x84\x11\x47\x16\x1b\x8a\x14\x48\x2a\x85\x57\xf0\x7f\x5f\x50\x1f\xb6\x93\x90\x14\x25\x7f\xb4\x0b\xec\xcd\xb6\x38\xcf\xf3\x0c\x87\x9c\x0f\xf9\xeb\x0c\xa0\x9e\x01\x00\x9c\x30\x7a\xf2\x0e\x4e\x3e\x22\xe7\xf2\xe4\xb4\xfd\xc9\x28\x22\x34\x27\x86\x49\x61\x9f\x9d\x09\x38\xbb\xbe\x80\x5c\x6a\x03 [...]
func wski18nResourcesEn_usAllJsonBytes() ([]byte, error) {
return bindataRead(
@@ -129,7 +129,7 @@ func wski18nResourcesEn_usAllJson() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 8110, mode: os.FileMode(420), modTime: time.Unix(1505233045, 0)}
+ info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 10474, mode: os.FileMode(420), modTime: time.Unix(1505853001, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index 1319051..70a3063 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -32,8 +32,12 @@
"translation": "Manifest file not found at path {{.projectPath}}.\n"
},
{
- "id": "Missing {{.yaml}}/{{.yml}} file.\n",
- "translation": "Missing {{.yaml}}/{{.yml}} file.\n"
+ "id": "Missing {{.yaml}}/{{.yml}} file. Missing {{.yaml}}/{{.yml}} file. Manifest file not found at path {{.projectPath}}.\n",
+ "translation": "Missing {{.yaml}}/{{.yml}} file. Missing {{.yaml}}/{{.yml}} file. Manifest file not found at path {{.projectPath}}.\n"
+ },
+ {
+ "id": "Manifest file is not found at the path [{{.filePath}}].\n",
+ "translation": "Manifest file is not found at the path [{{.filePath}}].\n"
},
{
"id": "Using {{.manifestPath}} for deployment.\n",
@@ -222,5 +226,51 @@
{
"id": "Got error deleting binding package with error message: {{.err}} and error code: {{.code}}.\n",
"translation": "Got error deleting binding package with error message: {{.err}} and error code: {{.code}}.\n"
+ },
+ {
+ "id": "Dependency {{.output}} has been successfully deployed.\n",
+ "translation": "Dependency {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Package binding {{.output}} has been successfully deployed.\n",
+ "translation": "Package binding {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Package {{.output}} has been successfully deployed.\n",
+ "translation": "Package {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Trigger {{.output}} has been successfully deployed.\n",
+ "translation": "Trigger {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Trigger feed {{.output}} has been successfully deployed.\n",
+ "translation": "Trigger feed {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Rule {{.output}} has been successfully deployed.\n",
+ "translation": "Rule {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Action {{.output}} has been successfully deployed.\n",
+ "translation": "Action {{.output}} has been successfully deployed.\n"
+ },
+ {
+ "id": "Dependency {{.depName}} has been successfully undeployed.\n",
+ "translation": "Dependency {{.depName}} has been successfully undeployed.\n"
+ },
+ {
+ "id": "Trigger {{.trigger}} has been removed.\n",
+ "translation": "Trigger {{.trigger}} has been removed.\n"
+ },
+ {
+ "id": "Rule {{.rule}} has been removed.\n",
+ "translation": "Rule {{.rule}} has been removed.\n"
+ },
+ {
+ "id": "Action {{.action}} has been removed.\n",
+ "translation": "Action {{.action}} has been removed.\n"
}
+
+
]
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].