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 7d72ab0  deprecating WithinOpenWhisk flag (#811)
7d72ab0 is described below

commit 7d72ab05a6bc5707d5d818b2416f6204eae15d1f
Author: Priti Desai <[email protected]>
AuthorDate: Tue Mar 20 19:12:26 2018 -0700

    deprecating WithinOpenWhisk flag (#811)
---
 cmd/root.go               | 44 --------------------------------------------
 utils/flags.go            |  1 -
 wski18n/i18n_resources.go | 34 +++++++++++++++++-----------------
 3 files changed, 17 insertions(+), 62 deletions(-)

diff --git a/cmd/root.go b/cmd/root.go
index ca660a9..0f93674 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -18,13 +18,9 @@
 package cmd
 
 import (
-       "encoding/json"
-       "errors"
-       "fmt"
        "os"
        "path"
        "path/filepath"
-       "regexp"
        "strings"
 
        "github.com/apache/incubator-openwhisk-client-go/whisk"
@@ -57,53 +53,13 @@ func RootCmdImp(cmd *cobra.Command, args []string) error {
 // Execute adds all child commands to the root command sets flags 
appropriately.
 // This is called by main.main(). It only needs to happen once to the rootCmd.
 func Execute() {
-       if utils.Flags.WithinOpenWhisk {
-               err := substCmdArgs()
-               if err != nil {
-                       wskprint.PrintOpenWhiskFromError(err)
-                       return
-               }
-       }
-
        if err := RootCmd.Execute(); err != nil {
                wskprint.PrintOpenWhiskFromError(err)
                os.Exit(-1)
-       } else {
-               if utils.Flags.WithinOpenWhisk {
-                       // TODO() Why are we printing success here?
-                       // TODO() maybe return report of what has been deployed.
-                       
wskprint.PrintlnOpenWhiskSuccess(wski18n.T(wski18n.ID_MSG_DEPLOYMENT_SUCCEEDED))
-               }
        }
 }
 
-// This function is only used when wskdeploy is being called as an Action and 
its input
-// (i.e., command and arguments) is JSON data (map).
-func substCmdArgs() error {
-       // Extract arguments from input JSON string
-       // { "cmd": ".." } // space-separated arguments
-
-       arg := os.Args[1]
-
-       // TODO() Move to proper status output/debug/trace
-       fmt.Println("arg is " + arg)
-       // unmarshal the string to a JSON object
-       var obj map[string]interface{}
-       json.Unmarshal([]byte(arg), &obj)
-
-       if v, ok := obj["cmd"].(string); ok {
-               regex, _ := regexp.Compile("[ ]+")
-               os.Args = regex.Split("wskdeploy "+strings.TrimSpace(v), -1)
-       } else {
-               return 
errors.New(wski18n.T(wski18n.ID_ERR_JSON_MISSING_KEY_CMD))
-       }
-       return nil
-}
-
 func init() {
-       // TODO() move Env var. to some global const
-       utils.Flags.WithinOpenWhisk = len(os.Getenv("__OW_API_HOST")) > 0
-
        cobra.OnInitialize(initConfig)
 
        // Defining Persistent Flags of Whisk Deploy Root command (wskdeploy)
diff --git a/utils/flags.go b/utils/flags.go
index 6ecae60..278527e 100644
--- a/utils/flags.go
+++ b/utils/flags.go
@@ -23,7 +23,6 @@ import (
 )
 
 type WskDeployFlags struct {
-       WithinOpenWhisk  bool   // is this running within an OpenWhisk action?
        ApiHost          string // OpenWhisk API host
        Auth             string // OpenWhisk API key
        Namespace        string
diff --git a/wski18n/i18n_resources.go b/wski18n/i18n_resources.go
index b9ffde5..b22c917 100644
--- a/wski18n/i18n_resources.go
+++ b/wski18n/i18n_resources.go
@@ -329,14 +329,14 @@ func AssetNames() []string {
 
 // _bindata is a table, holding each asset generator, mapped to its name.
 var _bindata = map[string]func() (*asset, error){
-       "wski18n/resources/de_DE.all.json": wski18nResourcesDe_deAllJson,
-       "wski18n/resources/en_US.all.json": wski18nResourcesEn_usAllJson,
-       "wski18n/resources/es_ES.all.json": wski18nResourcesEs_esAllJson,
-       "wski18n/resources/fr_FR.all.json": wski18nResourcesFr_frAllJson,
-       "wski18n/resources/it_IT.all.json": wski18nResourcesIt_itAllJson,
-       "wski18n/resources/ja_JA.all.json": wski18nResourcesJa_jaAllJson,
-       "wski18n/resources/ko_KR.all.json": wski18nResourcesKo_krAllJson,
-       "wski18n/resources/pt_BR.all.json": wski18nResourcesPt_brAllJson,
+       "wski18n/resources/de_DE.all.json":   wski18nResourcesDe_deAllJson,
+       "wski18n/resources/en_US.all.json":   wski18nResourcesEn_usAllJson,
+       "wski18n/resources/es_ES.all.json":   wski18nResourcesEs_esAllJson,
+       "wski18n/resources/fr_FR.all.json":   wski18nResourcesFr_frAllJson,
+       "wski18n/resources/it_IT.all.json":   wski18nResourcesIt_itAllJson,
+       "wski18n/resources/ja_JA.all.json":   wski18nResourcesJa_jaAllJson,
+       "wski18n/resources/ko_KR.all.json":   wski18nResourcesKo_krAllJson,
+       "wski18n/resources/pt_BR.all.json":   wski18nResourcesPt_brAllJson,
        "wski18n/resources/zh_Hans.all.json": wski18nResourcesZh_hansAllJson,
        "wski18n/resources/zh_Hant.all.json": wski18nResourcesZh_hantAllJson,
 }
@@ -380,17 +380,18 @@ type bintree struct {
        Func     func() (*asset, error)
        Children map[string]*bintree
 }
+
 var _bintree = &bintree{nil, map[string]*bintree{
        "wski18n": &bintree{nil, map[string]*bintree{
                "resources": &bintree{nil, map[string]*bintree{
-                       "de_DE.all.json": 
&bintree{wski18nResourcesDe_deAllJson, map[string]*bintree{}},
-                       "en_US.all.json": 
&bintree{wski18nResourcesEn_usAllJson, map[string]*bintree{}},
-                       "es_ES.all.json": 
&bintree{wski18nResourcesEs_esAllJson, map[string]*bintree{}},
-                       "fr_FR.all.json": 
&bintree{wski18nResourcesFr_frAllJson, map[string]*bintree{}},
-                       "it_IT.all.json": 
&bintree{wski18nResourcesIt_itAllJson, map[string]*bintree{}},
-                       "ja_JA.all.json": 
&bintree{wski18nResourcesJa_jaAllJson, map[string]*bintree{}},
-                       "ko_KR.all.json": 
&bintree{wski18nResourcesKo_krAllJson, map[string]*bintree{}},
-                       "pt_BR.all.json": 
&bintree{wski18nResourcesPt_brAllJson, map[string]*bintree{}},
+                       "de_DE.all.json":   
&bintree{wski18nResourcesDe_deAllJson, map[string]*bintree{}},
+                       "en_US.all.json":   
&bintree{wski18nResourcesEn_usAllJson, map[string]*bintree{}},
+                       "es_ES.all.json":   
&bintree{wski18nResourcesEs_esAllJson, map[string]*bintree{}},
+                       "fr_FR.all.json":   
&bintree{wski18nResourcesFr_frAllJson, map[string]*bintree{}},
+                       "it_IT.all.json":   
&bintree{wski18nResourcesIt_itAllJson, map[string]*bintree{}},
+                       "ja_JA.all.json":   
&bintree{wski18nResourcesJa_jaAllJson, map[string]*bintree{}},
+                       "ko_KR.all.json":   
&bintree{wski18nResourcesKo_krAllJson, map[string]*bintree{}},
+                       "pt_BR.all.json":   
&bintree{wski18nResourcesPt_brAllJson, map[string]*bintree{}},
                        "zh_Hans.all.json": 
&bintree{wski18nResourcesZh_hansAllJson, map[string]*bintree{}},
                        "zh_Hant.all.json": 
&bintree{wski18nResourcesZh_hantAllJson, map[string]*bintree{}},
                }},
@@ -443,4 +444,3 @@ func _filePath(dir, name string) string {
        cannonicalName := strings.Replace(name, "\\", "/", -1)
        return filepath.Join(append([]string{dir}, 
strings.Split(cannonicalName, "/")...)...)
 }
-

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to