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/06/28 00:36:02 UTC
[GitHub] tz70s closed pull request #3817: Generate whisk.conf as default
config for wskadmin-next.
tz70s closed pull request #3817: Generate whisk.conf as default config for wskadmin-next.
URL: https://github.com/apache/incubator-openwhisk/pull/3817
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/.gitignore b/.gitignore
index 44a18f8ec9..426c27382a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# Whisk
nginx.conf
whisk.properties
+whisk.conf
default.props
/tests/src/test/resources/application.conf
diff --git a/ansible/tasks/writeWhiskProperties.yml b/ansible/tasks/writeWhiskProperties.yml
index 1bbec34679..516306b48b 100644
--- a/ansible/tasks/writeWhiskProperties.yml
+++ b/ansible/tasks/writeWhiskProperties.yml
@@ -13,3 +13,8 @@
template:
src: "{{ openwhisk_home }}/tests/src/test/resources/application.conf.j2"
dest: "{{ openwhisk_home }}/tests/src/test/resources/application.conf"
+
+- name: write whisk.conf template for wskadmin to openwhisk_home
+ template:
+ src: whisk.conf.j2
+ dest: "{{ openwhisk_home }}/whisk.conf"
diff --git a/ansible/templates/whisk.conf.j2 b/ansible/templates/whisk.conf.j2
new file mode 100644
index 0000000000..2f9b9492cc
--- /dev/null
+++ b/ansible/templates/whisk.conf.j2
@@ -0,0 +1,17 @@
+include classpath("application.conf")
+
+whisk {
+ couchdb {
+ protocol = {{ db_protocol }}
+ host = {{ db_host }}
+ port = {{ db_port }}
+ username = {{ db_username }}
+ password = {{ db_password }}
+ provider = {{ db_provider }}
+ databases {
+ WhiskAuth = {{ db.whisk.auth }}
+ WhiskEntity = {{ db.whisk.actions }}
+ WhiskActivation = {{ db.whisk.activations }}
+ }
+ }
+}
diff --git a/tools/admin/README-NEXT.md b/tools/admin/README-NEXT.md
index 6d74e52fbf..30de6c3920 100644
--- a/tools/admin/README-NEXT.md
+++ b/tools/admin/README-NEXT.md
@@ -35,8 +35,7 @@ This creates a jar at `tools/admin/build/libs/openwhisk-admin-tools-1.0.0-SNAPSH
### Setup
-Build task creates an executable at `bin/wskadmin-next`. This script requires config related to `ArtifactStore`
-for accessing database. For example to access user details from default CouchDB setup create a file `application-cli.conf`.
+Build task creates an executable at `bin/wskadmin-next`. By default, the config related to `ArtifactStore` for accessing database will read the `$OPENWHISK_HOME/whisk.conf`, which was generated by ansible `properties` deployment. Alternatively, the required config can be also passed by an overwritten config file. For example to access user details from default CouchDB setup create a file `application-cli.conf`.
include classpath("application.conf")
@@ -70,40 +69,40 @@ and list all keys that have access to a particular namespace.
Some examples:
```bash
# create a new user
-$ wskadmin-next -c application-cli.conf user create userA
+$ wskadmin-next user create userA
<prints key>
# add user to a specific namespace
-$ wskadmin-next -c application-cli.conf user create userA -ns space1
+$ wskadmin-next user create userA -ns space1
<prints new key specific to userA and space1>
# add second user to same space
-$ wskadmin-next -c application-cli.conf user create userB -ns space1
+$ wskadmin-next user create userB -ns space1
<prints new key specific to userB and space1>
# list all users sharing a space
-$ wskadmin-next -c application-cli.conf user list space1 -a
+$ wskadmin-next user list space1 -a
<key for userA> userA
<key for userB> userB
# remove user access to a namespace
-$ wskadmin-next -c application-cli.conf user delete userB -ns space1
+$ wskadmin-next user delete userB -ns space1
Namespace deleted
# get key for userA default namespaces
-$ wskadmin-next -c application-cli.conf user get userA
+$ wskadmin-next user get userA
<prints key specific to userA default namespace>
# block a user
-$ wskadmin-next -c application-cli.conf user block userA
+$ wskadmin-next user block userA
"userA" blocked successfully
# unblock a user
-$ wskadmin-next -c application-cli.conf user unblock userA
+$ wskadmin-next user unblock userA
"userA" unblocked successfully
# delete user
-$ wskadmin-next -c application-cli.conf user delete userB
+$ wskadmin-next user delete userB
Subject deleted
```
@@ -111,16 +110,16 @@ The `wskadmin-next limits` commands allow you set action and trigger throttles p
```bash
# see if custom limits are set for a namespace
-$ wskadmin-next -c application-cli.conf limits get space1
+$ wskadmin-next limits get space1
No limits found, default system limits apply
# set limits
-$ wskadmin-next -c application-cli.conf limits set space1 --invocationsPerMinute 1
+$ wskadmin-next limits set space1 --invocationsPerMinute 1
Limits successfully set for "space1"
```
Note that limits apply to a namespace and will survive even if all users that share a namespace are deleted. You must manually delete them.
```bash
-$ wskadmin-next -c application-cli.conf limits delete space1
+$ wskadmin-next limits delete space1
Limits deleted
```
diff --git a/tools/admin/src/main/scala/whisk/core/cli/Main.scala b/tools/admin/src/main/scala/whisk/core/cli/Main.scala
index 58d6e4db5a..8b09472fae 100644
--- a/tools/admin/src/main/scala/whisk/core/cli/Main.scala
+++ b/tools/admin/src/main/scala/whisk/core/cli/Main.scala
@@ -54,7 +54,7 @@ class Conf(arguments: Seq[String]) extends ScallopConf(arguments) {
}
}
val verbose = tally()
- val configFile = opt[File](descr = "application.conf path")(fileConverter)
+ val configFile = opt[File](descr = "application.conf which overwrites the default whisk.conf")(fileConverter)
val timeout =
opt[Duration](descr = "time to wait for asynchronous task to finish", default = Some(30.seconds))(durationConverter)
printedName = Main.printedName
@@ -132,7 +132,10 @@ object Main {
}
private def initConfig(conf: Conf): Unit = {
- conf.configFile.foreach(f => System.setProperty("config.file", f.getAbsolutePath))
+ val file = conf.configFile.getOrElse {
+ new File("../whisk.conf")
+ }
+ System.setProperty("config.file", file.getAbsolutePath)
}
private def initLogging(conf: Conf): Unit = {
----------------------------------------------------------------
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