You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/21 02:12:28 UTC
[GitHub] mrutkows closed pull request #811: Deprecating WithinOpenWhisk flag
mrutkows closed pull request #811: Deprecating WithinOpenWhisk flag
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/811
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/cmd/root.go b/cmd/root.go
index ca660a96..0f936747 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 6ecae60d..278527e0 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 b9ffde58..b22c9175 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, "/")...)...)
}
-
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services