This is an automated email from the ASF dual-hosted git repository.

csantanapr 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 ff5c6a3  only print info messages when the verbose flag is enabled 
(#1027)
ff5c6a3 is described below

commit ff5c6a399bb09dd6487fe7f87d2e00d31abc9d66
Author: Mark Deuser <[email protected]>
AuthorDate: Thu Jan 31 09:13:26 2019 -0500

    only print info messages when the verbose flag is enabled (#1027)
    
    - also remove the openwhisk banner from the --preview
    fixes #788
---
 deployers/servicedeployer.go | 8 ++------
 deployers/whiskclient.go     | 8 ++++----
 parsers/manifest_parser.go   | 2 +-
 runtimes/runtimes.go         | 4 ++--
 wskprint/console.go          | 6 ++++++
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/deployers/servicedeployer.go b/deployers/servicedeployer.go
index 2e266c0..c7b848c 100644
--- a/deployers/servicedeployer.go
+++ b/deployers/servicedeployer.go
@@ -1463,10 +1463,6 @@ func (deployer *ServiceDeployer) getQualifiedName(name 
string) string {
 
 func (deployer *ServiceDeployer) printDeploymentAssets(assets 
*DeploymentProject) {
 
-       // pretty ASCII OpenWhisk graphic
-       // TODO() move to separate function and suppress using some flag
-       wskprint.PrintlnOpenWhiskOutput("         ____      ___                 
  _    _ _     _     _\n        /\\   \\    / _ \\ _ __   ___ _ __ | |  | | |__ 
(_)___| | __\n   /\\  /__\\   \\  | | | | '_ \\ / _ \\ '_ \\| |  | | '_ \\| / 
__| |/ /\n  /  \\____ \\  /  | |_| | |_) |  __/ | | | |/\\| | | | | \\__ \\   
<\n  \\   \\  /  \\/    \\___/| .__/ \\___|_| |_|__/\\__|_| |_|_|___/_|\\_\\ \n 
  \\___\\/              |_|\n")
-
        // TODO() review format
        
wskprint.PrintlnOpenWhiskOutput(strings.Title(parsers.YAML_KEY_PACKAGES) + ":")
        for _, pack := range assets.Packages {
@@ -1623,7 +1619,7 @@ func displayPreprocessingInfo(entity string, name string, 
onDeploy bool) {
                map[string]interface{}{
                        wski18n.KEY_KEY:  entity,
                        wski18n.KEY_NAME: name})
-       wskprint.PrintlnOpenWhiskInfo(msg)
+       wskprint.PrintlnOpenWhiskVerbose(utils.Flags.Verbose, msg)
 }
 
 func displayPostprocessingInfo(entity string, name string, onDeploy bool) {
@@ -1638,7 +1634,7 @@ func displayPostprocessingInfo(entity string, name 
string, onDeploy bool) {
                map[string]interface{}{
                        wski18n.KEY_KEY:  entity,
                        wski18n.KEY_NAME: name})
-       wskprint.PrintlnOpenWhiskInfo(msg)
+       wskprint.PrintlnOpenWhiskVerbose(utils.Flags.Verbose, msg)
 }
 
 func createWhiskClientError(err *whisk.WskError, response *http.Response, 
entity string, onCreate bool) *wskderrors.WhiskClientError {
diff --git a/deployers/whiskclient.go b/deployers/whiskclient.go
index 2f5aa28..93da0ef 100644
--- a/deployers/whiskclient.go
+++ b/deployers/whiskclient.go
@@ -275,20 +275,20 @@ func validateClientConfig(credential PropertyValue, 
apiHost PropertyValue, names
        // Show caller what final values we used for credential, apihost and 
namespace
        stdout := 
wski18n.T(wski18n.ID_MSG_CONFIG_INFO_APIHOST_X_host_X_source_X,
                map[string]interface{}{wski18n.KEY_HOST: apiHost.Value, 
wski18n.KEY_SOURCE: apiHost.Source})
-       wskprint.PrintOpenWhiskInfo(stdout)
+       wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout)
 
        stdout = wski18n.T(wski18n.ID_MSG_CONFIG_INFO_AUTHKEY_X_source_X,
                map[string]interface{}{wski18n.KEY_SOURCE: credential.Source})
-       wskprint.PrintOpenWhiskInfo(stdout)
+       wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout)
 
        stdout = 
wski18n.T(wski18n.ID_MSG_CONFIG_INFO_NAMESPACE_X_namespace_X_source_X,
                map[string]interface{}{wski18n.KEY_NAMESPACE: namespace.Value, 
wski18n.KEY_SOURCE: namespace.Source})
-       wskprint.PrintOpenWhiskInfo(stdout)
+       wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout)
 
        if len(apigwAccessToken.Value) != 0 {
                stdout = 
wski18n.T(wski18n.ID_MSG_CONFIG_INFO_APIGE_ACCESS_TOKEN_X_source_X,
                        map[string]interface{}{wski18n.KEY_SOURCE: 
apigwAccessToken.Source})
-               wskprint.PrintOpenWhiskInfo(stdout)
+               wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout)
        }
 
        return nil
diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index dcbc0ed..fd9b121 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -432,7 +432,7 @@ func (dm *YAMLParser) ComposePackage(pkg Package, 
packageName string, filePath s
        // and in this case wskdeploy deploys openwhisk entities under
        // /namespace instead of /namespace/package
        if strings.ToLower(pag.Name) == DEFAULT_PACKAGE {
-               
wskprint.PrintlnOpenWhiskInfo(wski18n.T(wski18n.ID_MSG_DEFAULT_PACKAGE))
+               wskprint.PrintlnOpenWhiskVerbose(utils.Flags.Verbose, 
wski18n.T(wski18n.ID_MSG_DEFAULT_PACKAGE))
                // when a package is marked public with "Public: true" in 
manifest file
                // the package is visible to anyone and created with publish 
state
                // set to shared otherwise publish state is set to private
diff --git a/runtimes/runtimes.go b/runtimes/runtimes.go
index 843ba00..d91546e 100644
--- a/runtimes/runtimes.go
+++ b/runtimes/runtimes.go
@@ -135,7 +135,7 @@ func ParseOpenWhisk(apiHost string) (op OpenWhiskInfo, err 
error) {
        // Local openwhisk deployment sometimes only returns "application/json" 
as the content type
        if err != nil || !strings.Contains(HTTP_CONTENT_TYPE_VALUE, 
res.Header.Get(HTTP_CONTENT_TYPE_KEY)) {
                stdout := wski18n.T(wski18n.ID_MSG_UNMARSHAL_LOCAL)
-               wskprint.PrintOpenWhiskInfo(stdout)
+               wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout)
                err = json.Unmarshal(RUNTIME_DETAILS, &op)
                if err != nil {
                        errMessage := 
wski18n.T(wski18n.ID_ERR_RUNTIME_PARSER_ERROR,
@@ -147,7 +147,7 @@ func ParseOpenWhisk(apiHost string) (op OpenWhiskInfo, err 
error) {
                if b != nil && len(b) > 0 {
                        stdout := 
wski18n.T(wski18n.ID_MSG_UNMARSHAL_NETWORK_X_url_X,
                                map[string]interface{}{"url": opURL})
-                       wskprint.PrintOpenWhiskInfo(stdout)
+                       wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, 
stdout)
                        err = json.Unmarshal(b, &op)
                        if err != nil {
                                errMessage := 
wski18n.T(wski18n.ID_ERR_RUNTIME_PARSER_ERROR,
diff --git a/wskprint/console.go b/wskprint/console.go
index 1863bda..3c2427d 100644
--- a/wskprint/console.go
+++ b/wskprint/console.go
@@ -119,6 +119,12 @@ func PrintlnOpenWhiskTrace(trace bool, message string) {
        }
 }
 
+func PrintOpenWhiskBanner(verbose bool) {
+       if verbose {
+               PrintlnOpenWhiskOutput("         ____      ___                  
 _    _ _     _     _\n        /\\   \\    / _ \\ _ __   ___ _ __ | |  | | |__ 
(_)___| | __\n   /\\  /__\\   \\  | | | | '_ \\ / _ \\ '_ \\| |  | | '_ \\| / 
__| |/ /\n  /  \\____ \\  /  | |_| | |_) |  __/ | | | |/\\| | | | | \\__ \\   
<\n  \\   \\  /  \\/    \\___/| .__/ \\___|_| |_|__/\\__|_| |_|_|___/_|\\_\\ \n 
  \\___\\/              |_|\n")
+       }
+}
+
 // Display "trace" output if either param is true OR we are running Go test 
verbose (i.e., "go test -v")
 // Typical Args for "go test" looks as follows:
 // arg[0] = 
[/var/folders/nj/<uuid>/T/<build-id>/github.com/apache/incubator-openwhisk-wskdeploy/deployers/_test/deployers.test

Reply via email to