You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by pd...@apache.org on 2018/05/30 17:51:09 UTC
[incubator-openwhisk-wskdeploy] branch master updated: Add the help
message, if manifest file is not accesible to wskdeploy and undeploy (#943)
This is an automated email from the ASF dual-hosted git repository.
pdesai 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 ae54ff3 Add the help message, if manifest file is not accesible to wskdeploy and undeploy (#943)
ae54ff3 is described below
commit ae54ff333c80e05501cc2164dd657ea78329fe04
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Wed May 30 13:51:00 2018 -0400
Add the help message, if manifest file is not accesible to wskdeploy and undeploy (#943)
---
cmd/report.go | 2 +-
cmd/root.go | 25 +++++++++++++++++--------
cmd/sync.go | 2 +-
cmd/undeploy.go | 2 +-
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/cmd/report.go b/cmd/report.go
index 8ec5860..52289a2 100644
--- a/cmd/report.go
+++ b/cmd/report.go
@@ -33,7 +33,7 @@ var reportCmd = &cobra.Command{
func ReportCmdImp(cmd *cobra.Command, args []string) error {
utils.Flags.Report = true
- return Deploy()
+ return Deploy(cmd)
}
func init() {
diff --git a/cmd/root.go b/cmd/root.go
index 2af8424..7d4469a 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -46,7 +46,7 @@ var RootCmd = &cobra.Command{
}
func RootCmdImp(cmd *cobra.Command, args []string) error {
- return Deploy()
+ return Deploy(cmd)
}
// Execute adds all child commands to the root command sets flags appropriately.
@@ -137,7 +137,7 @@ func displayCommandUsingFilenameMessage(command string, filetype string, path st
wskprint.PrintlnOpenWhiskVerbose(utils.Flags.Verbose, msg)
}
-func loadDefaultManifestFileFromProjectPath(command string, projectPath string) error {
+func loadDefaultManifestFileFromProjectPath(command string, projectPath string, cmd *cobra.Command) (error, bool) {
if _, err := os.Stat(path.Join(projectPath, utils.ManifestFileNameYaml)); err == nil {
utils.Flags.ManifestPath = path.Join(projectPath, utils.ManifestFileNameYaml)
@@ -146,10 +146,15 @@ func loadDefaultManifestFileFromProjectPath(command string, projectPath string)
} else {
stderr = wski18n.T(wski18n.ID_ERR_MANIFEST_FILE_NOT_FOUND_X_path_X,
map[string]interface{}{wski18n.KEY_PATH: projectPath})
- return wskderrors.NewErrorManifestFileNotFound(projectPath, stderr)
+ if cmd != nil {
+ stdout := stderr + wski18n.T(cmd.UsageString())
+ wskprint.PrintlnOpenWhiskOutput(stdout)
+ return nil, true
+ }
+ return wskderrors.NewErrorManifestFileNotFound(projectPath, stderr), false
}
displayCommandUsingFilenameMessage(command, wski18n.MANIFEST_FILE, utils.Flags.ManifestPath)
- return nil
+ return nil, false
}
func loadDefaultDeploymentFileFromProjectPath(command string, projectPath string) error {
@@ -163,7 +168,7 @@ func loadDefaultDeploymentFileFromProjectPath(command string, projectPath string
return nil
}
-func Deploy() error {
+func Deploy(cmd *cobra.Command) error {
// Convey flags for verbose and trace to Go client
whisk.SetVerbose(utils.Flags.Verbose)
@@ -179,8 +184,10 @@ func Deploy() error {
// default manifests are manifest.yaml and manifest.yml
// return failure if none of the default manifest files were found
if utils.Flags.ManifestPath == "" {
- if err := loadDefaultManifestFileFromProjectPath(wski18n.CMD_DEPLOY, projectPath); err != nil {
+ if err, returnRoot := loadDefaultManifestFileFromProjectPath(wski18n.CMD_DEPLOY, projectPath, cmd); err != nil {
return err
+ } else if returnRoot == true {
+ return nil
}
}
@@ -251,7 +258,7 @@ func Deploy() error {
}
-func Undeploy() error {
+func Undeploy(cmd *cobra.Command) error {
// Convey flags for verbose and trace to Go client
whisk.SetVerbose(utils.Flags.Verbose)
@@ -293,8 +300,10 @@ func Undeploy() error {
// If manifest filename is not provided, attempt to load default manifests from project path
if utils.Flags.ManifestPath == "" {
- if err := loadDefaultManifestFileFromProjectPath(wski18n.CMD_UNDEPLOY, projectPath); err != nil {
+ if err, returnRoot := loadDefaultManifestFileFromProjectPath(wski18n.CMD_UNDEPLOY, projectPath, cmd); err != nil {
return err
+ } else if returnRoot == true {
+ return nil
}
}
diff --git a/cmd/sync.go b/cmd/sync.go
index 4e1279c..f95458e 100644
--- a/cmd/sync.go
+++ b/cmd/sync.go
@@ -34,7 +34,7 @@ var syncCmd = &cobra.Command{
func SyncCmdImp(cmd *cobra.Command, args []string) error {
utils.Flags.Sync = true
- return Deploy()
+ return Deploy(cmd)
}
func init() {
diff --git a/cmd/undeploy.go b/cmd/undeploy.go
index 294ddf2..9f10f62 100644
--- a/cmd/undeploy.go
+++ b/cmd/undeploy.go
@@ -32,7 +32,7 @@ var undeployCmd = &cobra.Command{
}
func UndeployCmdImp(cmd *cobra.Command, args []string) error {
- return Undeploy()
+ return Undeploy(cmd)
}
func init() {
--
To stop receiving notification emails like this one, please contact
pdesai@apache.org.