You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2019/05/07 11:53:45 UTC
[incubator-openwhisk-cli] branch master updated: remove namespace
property from wskprops (#434)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git
The following commit(s) were added to refs/heads/master by this push:
new 2d2d673 remove namespace property from wskprops (#434)
2d2d673 is described below
commit 2d2d6736cb8c9f36b689fcb3247530b1683e0c89
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Tue May 7 07:53:39 2019 -0400
remove namespace property from wskprops (#434)
---
commands/action.go | 4 +-
commands/api.go | 10 +-
commands/commands.go | 2 +-
commands/property.go | 104 +++++----------------
commands/sdk.go | 2 +-
commands/trigger.go | 2 +-
commands/util.go | 2 +-
tests/src/integration/command_test.go | 11 +--
tests/src/integration/integration_test.go | 17 +---
.../openwhisk/core/cli/test/WskConfigTests.scala | 51 ++--------
wski18n/resources/en_US.all.json | 8 --
11 files changed, 51 insertions(+), 162 deletions(-)
diff --git a/commands/action.go b/commands/action.go
index fb01c0b..5830d5d 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -939,7 +939,7 @@ func nonNestedError(errorMessage string) error {
}
func actionParseError(cmd *cobra.Command, args []string, err error) error {
- whisk.Debug(whisk.DbgError, "parseAction(%s, %s) error: %s\n", cmd, args, err)
+ whisk.Debug(whisk.DbgError, "parseAction(%s, %s) error: %s\n", cmd.Name(), args, err)
errMsg := wski18n.T(
"Invalid argument(s). {{.required}}",
@@ -1028,7 +1028,7 @@ func actionGetError(entityName string, fetchCode bool, err error) error {
func handleInvocationError(err error, entityName string) error {
whisk.Debug(
whisk.DbgError,
- "Client.Actions.Invoke(%s, %t) error: %s\n",
+ "Client.Actions.Invoke(%s) error: %s\n",
entityName,
err)
diff --git a/commands/api.go b/commands/api.go
index 7ded1c5..450f175 100644
--- a/commands/api.go
+++ b/commands/api.go
@@ -205,7 +205,7 @@ var apiCreateCmd = &cobra.Command{
}
api, qname, err = parseApi(cmd, args)
if err != nil {
- whisk.Debug(whisk.DbgError, "parseApi(%s, %s) error: %s\n", cmd, args, err)
+ whisk.Debug(whisk.DbgError, "parseApi(%s, %s) error: %s\n", cmd.Name(), args, err)
errMsg := wski18n.T("Unable to parse api command arguments: {{.err}}",
map[string]interface{}{"err": err})
whiskErr := whisk.MakeWskErrorFromWskError(errors.New(errMsg), err, whisk.EXIT_CODE_ERR_GENERAL,
@@ -653,7 +653,7 @@ func genFilteredList(resultApi *whisk.RetApi, apiPath string, apiVerb string) []
actionName = "/" + opv.XOpenWhisk.Namespace + "/" + opv.XOpenWhisk.ActionName
}
orderInfo = AssignListInfo(actionName, op, apiName, basePath, path, baseUrl+path)
- whisk.Debug(whisk.DbgInfo, "Appening to orderInfoArr: %s %s\n", orderInfo.RelPath)
+ whisk.Debug(whisk.DbgInfo, "Appening to orderInfoArr: %s\n", orderInfo.RelPath)
orderInfoArr = append(orderInfoArr, orderInfo)
}
}
@@ -692,7 +692,7 @@ func genFilteredRow(resultApi *whisk.RetApi, apiPath string, apiVerb string, max
}
orderInfo = AssignRowInfo(actionName[0:min(len(actionName), maxActionNameSize)], op, apiName[0:min(len(apiName), maxApiNameSize)], basePath, path, baseUrl+path)
orderInfo.FmtString = fmtString
- whisk.Debug(whisk.DbgInfo, "Appening to orderInfoArr: %s %s\n", orderInfo.RelPath)
+ whisk.Debug(whisk.DbgInfo, "Appening to orderInfoArr: %s\n", orderInfo.RelPath)
orderInfoArr = append(orderInfoArr, orderInfo)
}
}
@@ -987,7 +987,7 @@ func parseSwaggerApi(configfile string, namespace string) (*whisk.Api, error) {
}
if swaggerObj.BasePath == "" || swaggerObj.SwaggerName == "" || swaggerObj.Info == nil || swaggerObj.Paths == nil {
- whisk.Debug(whisk.DbgError, "Swagger file is invalid.\n", configfile, err)
+ whisk.Debug(whisk.DbgError, "Swagger file is invalid.\n")
errMsg := wski18n.T("Swagger file is invalid (missing basePath, info, paths, or swagger fields)")
whiskErr := whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL,
whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
@@ -995,7 +995,7 @@ func parseSwaggerApi(configfile string, namespace string) (*whisk.Api, error) {
}
if _, ok := isValidBasepath(swaggerObj.BasePath); !ok {
- whisk.Debug(whisk.DbgError, "Swagger file basePath is invalid.\n", configfile, err)
+ whisk.Debug(whisk.DbgError, "Swagger file basePath is invalid.\n")
errMsg := wski18n.T("Swagger file basePath must start with a leading slash (/)")
whiskErr := whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL,
whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
diff --git a/commands/commands.go b/commands/commands.go
index 6a7a070..2704b48 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -41,7 +41,7 @@ func SetupClientConfig(cmd *cobra.Command, args []string) error {
// Determine if the parent command will require the API host to be set
apiHostRequired := (cmd.Parent().Name() == "property" && cmd.Name() == "get" && (Flags.property.auth ||
- Flags.property.cert || Flags.property.key || Flags.property.apihost || Flags.property.namespace ||
+ Flags.property.cert || Flags.property.key || Flags.property.apihost ||
Flags.property.apiversion || Flags.property.cliversion)) ||
(cmd.Parent().Name() == "property" && cmd.Name() == "set" && (len(Flags.property.apihostSet) > 0 ||
len(Flags.property.apiversionSet) > 0 || len(Flags.Global.Auth) > 0)) ||
diff --git a/commands/property.go b/commands/property.go
index a66f7f0..0d955f0 100644
--- a/commands/property.go
+++ b/commands/property.go
@@ -145,38 +145,6 @@ var propertySetCmd = &cobra.Command{
map[string]interface{}{"ok": color.GreenString("ok:"), "version": boldString(apiVersion)}))
}
- if namespace := Flags.property.namespaceSet; len(namespace) > 0 {
- namespaces, _, err := Client.Namespaces.List()
- if err != nil {
- whisk.Debug(whisk.DbgError, "Client.Namespaces.List() failed: %s\n", err)
- errStr := fmt.Sprintf(
- wski18n.T("Authenticated user does not have namespace '{{.name}}'; set command failed: {{.err}}",
- map[string]interface{}{"name": namespace, "err": err}))
- werr = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
- } else {
- whisk.Debug(whisk.DbgInfo, "Validating namespace '%s' is in user namespace list %#v\n", namespace, namespaces)
- var validNamespace bool
- for _, ns := range namespaces {
- if ns.Name == namespace {
- whisk.Debug(whisk.DbgInfo, "Namespace '%s' is valid\n", namespace)
- validNamespace = true
- }
- }
- if !validNamespace {
- whisk.Debug(whisk.DbgError, "Namespace '%s' is not in the list of entitled namespaces\n", namespace)
- errStr := fmt.Sprintf(
- wski18n.T("Namespace '{{.name}}' is not in the list of entitled namespaces",
- map[string]interface{}{"name": namespace}))
- werr = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
- } else {
- props["NAMESPACE"] = namespace
- okMsg += fmt.Sprintf(
- wski18n.T("{{.ok}} whisk namespace set to {{.name}}\n",
- map[string]interface{}{"ok": color.GreenString("ok:"), "name": boldString(namespace)}))
- }
- }
- }
-
err = WriteProps(Properties.PropsFile, props)
if err != nil {
whisk.Debug(whisk.DbgError, "writeProps(%s, %#v) failed: %s\n", Properties.PropsFile, props, err)
@@ -236,21 +204,6 @@ var propertyUnsetCmd = &cobra.Command{
map[string]interface{}{"ok": color.GreenString("ok:")}))
}
- if Flags.property.namespace {
- delete(props, "NAMESPACE")
- okMsg += fmt.Sprintf(
- wski18n.T("{{.ok}} whisk namespace unset",
- map[string]interface{}{"ok": color.GreenString("ok:")}))
- if len(DefaultNamespace) > 0 {
- okMsg += fmt.Sprintf(
- wski18n.T("; the default value of {{.default}} will be used.\n",
- map[string]interface{}{"default": boldString(DefaultNamespace)}))
- } else {
- okMsg += fmt.Sprint(
- wski18n.T("; there is no default value that can be used.\n"))
- }
- }
-
if Flags.property.apihost {
delete(props, "APIHOST")
okMsg += fmt.Sprintf(
@@ -305,8 +258,8 @@ var propertyGetCmd = &cobra.Command{
case "raw":
outputFormat = "raw"
break
- //case "json": For future implementation
- //case "yaml": For future implementation
+ //case "json": For future implementation
+ //case "yaml": For future implementation
default:
errStr := fmt.Sprintf(
wski18n.T("Supported output format are std|raw"))
@@ -323,6 +276,7 @@ var propertyGetCmd = &cobra.Command{
Flags.property.apihost || Flags.property.apibuildno) {
Flags.property.all = true
}
+
if Flags.property.all {
// Currently with all only standard output format is supported.
if outputFormat != "std" {
@@ -332,14 +286,23 @@ var propertyGetCmd = &cobra.Command{
return werr
}
+ fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayAPIHost), boldString(Properties.APIHost))
+ fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayAuth), boldString(Properties.Auth))
+ fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayNamespace), boldString(getNamespace()))
fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayCert), boldString(Properties.Cert))
fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayKey), boldString(Properties.Key))
- fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayAuth), boldString(Properties.Auth))
- fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayAPIHost), boldString(Properties.APIHost))
fmt.Fprintf(color.Output, "%s\t%s\n", wski18n.T(propDisplayAPIVersion), boldString(Properties.APIVersion))
- fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(propDisplayNamespace), boldString(Properties.Namespace))
fmt.Fprintf(color.Output, "%s\t%s\n", wski18n.T(propDisplayCLIVersion), boldString(Properties.CLIVersion))
} else {
+ if Flags.property.apihost {
+ printProperty(Properties.APIHost, propDisplayAPIHost, outputFormat)
+ }
+ if Flags.property.auth {
+ printProperty(Properties.Auth, propDisplayAuth, outputFormat)
+ }
+ if Flags.property.namespace {
+ printProperty(getNamespace(), propDisplayNamespace, outputFormat)
+ }
if Flags.property.cert {
printProperty(Properties.Cert, propDisplayCert, outputFormat)
}
@@ -349,18 +312,9 @@ var propertyGetCmd = &cobra.Command{
if Flags.property.cliversion {
printProperty(Properties.CLIVersion, propDisplayCLIVersion, outputFormat, "%s\t%s\n")
}
- if Flags.property.apihost {
- printProperty(Properties.APIHost, propDisplayAPIHost, outputFormat)
- }
- if Flags.property.auth {
- printProperty(Properties.Auth, propDisplayAuth, outputFormat)
- }
if Flags.property.apiversion {
printProperty(Properties.APIVersion, propDisplayAPIVersion, outputFormat, "%s\t%s\n")
}
- if Flags.property.namespace {
- printProperty(Properties.Namespace, propDisplayNamespace, outputFormat)
- }
}
if Flags.property.all || Flags.property.apibuild || Flags.property.apibuildno {
@@ -418,15 +372,12 @@ func init() {
propertySetCmd.Flags().StringVar(&Flags.Global.Key, "key", "", wski18n.T(propDisplayKey))
propertySetCmd.Flags().StringVar(&Flags.property.apihostSet, "apihost", "", wski18n.T("whisk API `HOST`"))
propertySetCmd.Flags().StringVar(&Flags.property.apiversionSet, "apiversion", "", wski18n.T("whisk API `VERSION`"))
- propertySetCmd.Flags().StringVar(&Flags.property.namespaceSet, "namespace", "", wski18n.T("whisk `NAMESPACE`"))
propertyUnsetCmd.Flags().BoolVar(&Flags.property.cert, "cert", false, wski18n.T(propDisplayCert))
propertyUnsetCmd.Flags().BoolVar(&Flags.property.key, "key", false, wski18n.T(propDisplayKey))
propertyUnsetCmd.Flags().BoolVar(&Flags.property.auth, "auth", false, wski18n.T("authorization key"))
propertyUnsetCmd.Flags().BoolVar(&Flags.property.apihost, "apihost", false, wski18n.T(propDisplayAPIHost))
propertyUnsetCmd.Flags().BoolVar(&Flags.property.apiversion, "apiversion", false, wski18n.T(propDisplayAPIVersion))
- propertyUnsetCmd.Flags().BoolVar(&Flags.property.namespace, "namespace", false, wski18n.T(propDisplayNamespace))
-
}
func SetDefaultProperties() {
@@ -527,14 +478,6 @@ func loadProperties() error {
Properties.APIHost = apiHost
}
- if namespace, hasProp := props["NAMESPACE"]; hasProp && len(namespace) > 0 {
- Properties.Namespace = namespace
- }
-
- if namespace := os.Getenv("WHISK_NAMESPACE"); len(namespace) > 0 {
- Properties.Namespace = namespace
- }
-
return nil
}
@@ -561,13 +504,6 @@ func parseConfigFlags(cmd *cobra.Command, args []string) error {
}
}
- if namespace := Flags.property.namespaceSet; len(namespace) > 0 {
- Properties.Namespace = namespace
- if Client != nil {
- Client.Config.Namespace = namespace
- }
- }
-
if apiVersion := Flags.Global.Apiversion; len(apiVersion) > 0 {
Properties.APIVersion = apiVersion
if Client != nil {
@@ -619,3 +555,13 @@ func printProperty(propertyName string, displayText string, formatType string, f
fmt.Fprintf(color.Output, "%s\t\t%s\n", wski18n.T(displayText), boldString(propertyName))
}
}
+
+func getNamespace() string {
+ var namespaces, _, err = Client.Namespaces.List()
+ whisk.Debug(whisk.DbgError, "Client.Namespaces.List() failed: %s\n", err)
+ if err != nil {
+ return "_"
+ } else {
+ return namespaces[0].Name
+ }
+}
diff --git a/commands/sdk.go b/commands/sdk.go
index 1974a12..76cf84b 100644
--- a/commands/sdk.go
+++ b/commands/sdk.go
@@ -86,7 +86,7 @@ var sdkInstallCmd = &cobra.Command{
} else {
err = WskCmd.GenBashCompletionFile(BASH_AUTOCOMPLETE_FILENAME)
if err != nil {
- whisk.Debug(whisk.DbgError, "GenBashCompletionFile('%s`) error: \n", BASH_AUTOCOMPLETE_FILENAME, err)
+ whisk.Debug(whisk.DbgError, "GenBashCompletionFile('%s`) error: %s\n", BASH_AUTOCOMPLETE_FILENAME, err)
errStr := wski18n.T("Unable to generate '{{.name}}': {{.err}}",
map[string]interface{}{"name": BASH_AUTOCOMPLETE_FILENAME, "err": err})
werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
diff --git a/commands/trigger.go b/commands/trigger.go
index b482fde..65ed46c 100644
--- a/commands/trigger.go
+++ b/commands/trigger.go
@@ -83,7 +83,7 @@ func createOrUpdate(Client *whisk.Client, fqn *QualifiedName, trigger *whisk.Tri
_, _, err := Client.Triggers.Insert(trigger, overwrite)
if err != nil {
- whisk.Debug(whisk.DbgError, "Client.Triggers.Insert(%+v, %s) failed: %s\n", trigger, overwrite, err)
+ whisk.Debug(whisk.DbgError, "Client.Triggers.Insert(%+v, %t) failed: %s\n", trigger, overwrite, err)
var errStr string
if !overwrite {
errStr = wski18n.T("Unable to create trigger '{{.name}}': {{.err}}",
diff --git a/commands/util.go b/commands/util.go
index 757ecff..ddabb34 100644
--- a/commands/util.go
+++ b/commands/util.go
@@ -75,7 +75,7 @@ func getParameters(params []string, keyValueFormat bool, annotation bool) interf
parameters, err = getJSONFromStrings(params, keyValueFormat)
if err != nil {
- whisk.Debug(whisk.DbgError, "getJSONFromStrings(%#v, %s) failed: %s\n", params, keyValueFormat, err)
+ whisk.Debug(whisk.DbgError, "getJSONFromStrings(%#v, %t) failed: %s\n", params, keyValueFormat, err)
var errStr string
if !annotation {
diff --git a/tests/src/integration/command_test.go b/tests/src/integration/command_test.go
index 92e33aa..a7df9e6 100644
--- a/tests/src/integration/command_test.go
+++ b/tests/src/integration/command_test.go
@@ -82,7 +82,7 @@ func TestShowAPIVersion(t *testing.T) {
// Test case to verify the default namespace _.
func TestDefaultNamespace(t *testing.T) {
common.CreateFile(tmpProp)
- common.WriteFile(tmpProp, []string{"NAMESPACE="})
+ common.WriteFile(tmpProp, []string{"APIHOST=xyz"})
os.Setenv("WSK_CONFIG_FILE", tmpProp)
assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.")
@@ -101,7 +101,7 @@ func TestValidateDefaultProperties(t *testing.T) {
os.Setenv("WSK_CONFIG_FILE", tmpProp)
assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.")
- stdout, err := wsk.RunCommand("property", "unset", "--auth", "--apihost", "--apiversion", "--namespace")
+ stdout, err := wsk.RunCommand("property", "unset", "--auth", "--apihost", "--apiversion")
assert.Equal(t, nil, err, "The command property unset failed to run.")
outputString := string(stdout)
assert.Contains(t, outputString, "ok: whisk auth unset",
@@ -110,8 +110,6 @@ func TestValidateDefaultProperties(t *testing.T) {
"The output of the command does not contain \"ok: whisk API host unset\".")
assert.Contains(t, outputString, "ok: whisk API version unset",
"The output of the command does not contain \"ok: whisk API version unset\".")
- assert.Contains(t, outputString, "ok: whisk namespace unset",
- "The output of the command does not contain \"ok: whisk namespace unset\".")
stdout, err = wsk.RunCommand("property", "get", "--auth")
assert.Equal(t, nil, err, "The command property get --auth failed to run.")
@@ -123,11 +121,6 @@ func TestValidateDefaultProperties(t *testing.T) {
assert.Equal(t, common.PropDisplayAPIHost, common.RemoveRedundentSpaces(string(stdout)),
"The output of the command does not equal to "+common.PropDisplayAPIHost)
- stdout, err = wsk.RunCommand("property", "get", "--namespace")
- assert.Equal(t, nil, err, "The command property get --namespace failed to run.")
- assert.Equal(t, common.PropDisplayNamespace+" _", common.RemoveRedundentSpaces(string(stdout)),
- "The output of the command does not equal to "+common.PropDisplayNamespace+" _")
-
common.DeleteFile(tmpProp)
}
diff --git a/tests/src/integration/integration_test.go b/tests/src/integration/integration_test.go
index 78038b6..928d96a 100644
--- a/tests/src/integration/integration_test.go
+++ b/tests/src/integration/integration_test.go
@@ -22,7 +22,6 @@ package tests
import (
"fmt"
"os"
- "strings"
"testing"
"github.com/apache/incubator-openwhisk-cli/tests/src/integration/common"
@@ -331,7 +330,7 @@ func initInvalidArgs() {
var wsk *common.Wsk = common.NewWsk()
var tmpProp = common.GetRepoPath() + "/wskprops.tmp"
-// Test case to set apihost, auth, and namespace.
+// Test case to set apihost and auth.
func TestSetAPIHostAuthNamespace(t *testing.T) {
common.CreateFile(tmpProp)
common.WriteFile(tmpProp, []string{})
@@ -339,21 +338,15 @@ func TestSetAPIHostAuthNamespace(t *testing.T) {
os.Setenv("WSK_CONFIG_FILE", tmpProp)
assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.")
- namespace, _ := wsk.ListNamespaces()
- namespaces := strings.Split(strings.TrimSpace(string(namespace)), "\n")
- expectedNamespace := string(namespaces[len(namespaces)-1])
fmt.Println(wsk.Wskprops.APIHost)
if wsk.Wskprops.APIHost != "" && wsk.Wskprops.AuthKey != "" {
- stdout, err := wsk.RunCommand("property", "set", "--apihost", wsk.Wskprops.APIHost,
- "--auth", wsk.Wskprops.AuthKey, "--namespace", expectedNamespace)
+ stdout, err := wsk.RunCommand("property", "set", "--apihost", wsk.Wskprops.APIHost, "--auth", wsk.Wskprops.AuthKey)
ouputString := string(stdout)
- assert.Equal(t, nil, err, "The command property set --apihost --auth --namespace failed to run.")
+ assert.Equal(t, nil, err, "The command property set --apihost --auth failed to run.")
assert.Contains(t, ouputString, "ok: whisk auth set. Run 'wsk property get --auth' to see the new value.",
- "The output of the command property set --apihost --auth --namespace does not contain \"whisk auth set\".")
+ "The output of the command property set --apihost --auth does not contain \"whisk auth set\".")
assert.Contains(t, ouputString, "ok: whisk API host set to "+wsk.Wskprops.APIHost,
- "The output of the command property set --apihost --auth --namespace does not contain \"whisk API host set\".")
- assert.Contains(t, ouputString, "ok: whisk namespace set to "+expectedNamespace,
- "The output of the command property set --apihost --auth --namespace does not contain \"whisk namespace set\".")
+ "The output of the command property set --apihost --auth does not contain \"whisk API host set\".")
}
common.DeleteFile(tmpProp)
}
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskConfigTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskConfigTests.scala
index 91613d6..d8324d7 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskConfigTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskConfigTests.scala
@@ -64,7 +64,7 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
val tmpwskprops = File.createTempFile("wskprops", ".tmp")
val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
val stdout = wsk
- .cli(Seq("property", "unset", "--auth", "--cert", "--key", "--apihost", "--apiversion", "--namespace"), env = env)
+ .cli(Seq("property", "unset", "--auth", "--cert", "--key", "--apihost", "--apiversion"), env = env)
.stdout
try {
stdout should include regex ("ok: whisk auth unset")
@@ -72,7 +72,6 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
stdout should include regex ("ok: client key unset")
stdout should include regex ("ok: whisk API host unset")
stdout should include regex ("ok: whisk API version unset")
- stdout should include regex ("ok: whisk namespace unset")
wsk
.cli(Seq("property", "get", "--auth"), env = env)
@@ -86,9 +85,6 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
wsk
.cli(Seq("property", "get", "--apihost"), env = env)
.stdout should include regex ("""(?i)whisk API host\s*$""") // default = empty string
- wsk
- .cli(Seq("property", "get", "--namespace"), env = env)
- .stdout should include regex ("""(?i)whisk namespace\s*_$""") // default = _
} finally {
tmpwskprops.delete()
}
@@ -147,28 +143,16 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
}
}
- it should "set apihost, auth, and namespace" in {
+ it should "set apihost, auth" in {
val tmpwskprops = File.createTempFile("wskprops", ".tmp")
try {
val namespace = wsk.namespace.whois()
val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
val stdout = wsk
- .cli(
- Seq(
- "property",
- "set",
- "-i",
- "--apihost",
- wskprops.apihost,
- "--auth",
- wskprops.authKey,
- "--namespace",
- namespace),
- env = env)
+ .cli(Seq("property", "set", "-i", "--apihost", wskprops.apihost, "--auth", wskprops.authKey), env = env)
.stdout
- stdout should include(s"ok: whisk auth set")
stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
- stdout should include(s"ok: whisk namespace set to ${namespace}")
+ stdout should include(s"ok: whisk auth set")
} finally {
tmpwskprops.delete()
}
@@ -196,16 +180,13 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
"--cert",
wskprops.cert,
"--key",
- wskprops.key,
- "--namespace",
- namespace),
+ wskprops.key),
env = env)
.stdout
+ stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
+ stdout should include(s"ok: whisk auth set")
stdout should include(s"ok: client cert set")
stdout should include(s"ok: client key set")
- stdout should include(s"ok: whisk auth set")
- stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
- stdout should include(s"ok: whisk namespace set to ${namespace}")
} finally {
tmpwskprops.delete()
}
@@ -228,9 +209,7 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
"--cert",
"invalid-cert.pem",
"--key",
- "invalid-key.pem",
- "--namespace",
- namespace),
+ "invalid-key.pem"),
env = env)
thrown.getMessage should include("cannot validate certificate")
} finally {
@@ -239,20 +218,6 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
}
}
- it should "ensure default namespace is used when a blank namespace is set" in {
- val tmpwskprops = File.createTempFile("wskprops", ".tmp")
- try {
- val writer = new BufferedWriter(new FileWriter(tmpwskprops))
- writer.write(s"NAMESPACE=")
- writer.close()
- val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
- val stdout = wsk.cli(Seq("property", "get", "-i", "--namespace"), env = env).stdout
- stdout should include regex ("whisk namespace\\s+_")
- } finally {
- tmpwskprops.delete()
- }
- }
-
it should "show api build version using property file" in {
val tmpwskprops = File.createTempFile("wskprops", ".tmp")
try {
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index a0e81b1..fbcdfb8 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -285,10 +285,6 @@
"translation": "Namespace '{{.name}}' is not in the list of entitled namespaces"
},
{
- "id": "{{.ok}} whisk namespace set to {{.name}}\n",
- "translation": "{{.ok}} whisk namespace set to {{.name}}\n"
- },
- {
"id": "Unable to set the property value(s): {{.err}}",
"translation": "Unable to set the property value(s): {{.err}}"
},
@@ -313,10 +309,6 @@
"translation": "{{.ok}} whisk auth unset.\n"
},
{
- "id": "{{.ok}} whisk namespace unset",
- "translation": "{{.ok}} whisk namespace unset"
- },
- {
"id": "{{.ok}} whisk API host unset.\n",
"translation": "{{.ok}} whisk API host unset.\n"
},