[GitHub] csantanapr opened a new pull request #3404: bump dockerskeleton to pick up curl and wget 1.2.0

2018-03-06 Thread GitBox
csantanapr opened a new pull request #3404: bump dockerskeleton to pick up curl 
and wget 1.2.0
URL: https://github.com/apache/incubator-openwhisk/pull/3404
 
 
   ## Description
   Updating dockskeleton image to pick up curl and wget.
   
   ## My changes affect the following components
   - [x] Runtime for Docker Actions
   
   ## Types of changes
   - [x] Enhancement or new feature (adds new functionality).
   
   ## Checklist:
   - [x] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [x] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3366: Adds method 
deleteAttachments to ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172757550
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 }
   }
 
+  override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: 
DocInfo)(
+implicit transid: TransactionId,
+notifier: Option[CacheChangeNotification]): Future[Boolean] = {
+Try {
+  require(db != null, "db undefined")
+  require(doc != null, "doc undefined")
+}.map { _ =>
+  val fa = super.del(db, doc)
+  implicit val ec = db.executionContext
+  fa.flatMap { _ =>
+super.deleteAttachments(db, doc)
 
 Review comment:
   Thinking strictly about an action, today you?d know what based on the exec 
type and attached details. Eventually we will store all blobs as attachments so 
it may be inconsequential. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr closed pull request #21: add curl and wget

2018-03-06 Thread GitBox
csantanapr closed pull request #21: add curl and wget
URL: https://github.com/apache/incubator-openwhisk-runtime-docker/pull/21
 
 
   

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/core/CHANGELOG.md b/core/CHANGELOG.md
index 7066aae..5583f17 100644
--- a/core/CHANGELOG.md
+++ b/core/CHANGELOG.md
@@ -19,6 +19,10 @@
 # Apache OpenWhisk Docker Runtime Container
 
 
+## 1.2.0
+Changes:
+  - Added utilties curl and wget
+
 ## 1.1.0
 Changes:
   - Allow input parameter larger than 128KB
diff --git a/core/actionProxy/Dockerfile b/core/actionProxy/Dockerfile
index 47dd4f0..4c1c687 100644
--- a/core/actionProxy/Dockerfile
+++ b/core/actionProxy/Dockerfile
@@ -2,7 +2,9 @@
 FROM python:3.6.1-alpine
 
 # Upgrade and install basic Python dependencies.
-RUN apk add --no-cache bash perl jq zip git \
+RUN apk upgrade --update \
+  && apk add --no-cache bash perl jq zip git curl wget openssl ca-certificates 
sed \
+  && update-ca-certificates \
   && apk add --no-cache --virtual .build-deps bzip2-dev gcc libc-dev \
   && pip install --upgrade pip setuptools six \
   && pip install --no-cache-dir gevent==1.2.1 flask==0.12 \


 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] chetanmeh commented on issue #3369: Use pureconfig for CouchDbRestStore

2018-03-06 Thread GitBox
chetanmeh commented on issue #3369: Use pureconfig for CouchDbRestStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3369#issuecomment-371045007
 
 
   Thanks @markusthoemmes . Let me know if it needs any further change


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] chetanmeh commented on issue #3356: Add method to delete attachment to ArtifactStore

2018-03-06 Thread GitBox
chetanmeh commented on issue #3356: Add method to delete attachment to 
ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/issues/3356#issuecomment-371044769
 
 
   Closed via #3366


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] chetanmeh closed issue #3356: Add method to delete attachment to ArtifactStore

2018-03-06 Thread GitBox
chetanmeh closed issue #3356: Add method to delete attachment to ArtifactStore
URL: https://github.com/apache/incubator-openwhisk/issues/3356
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore

2018-03-06 Thread GitBox
chetanmeh commented on a change in pull request #3366: Adds method 
deleteAttachments to ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172755939
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 }
   }
 
+  override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: 
DocInfo)(
+implicit transid: TransactionId,
+notifier: Option[CacheChangeNotification]): Future[Boolean] = {
+Try {
+  require(db != null, "db undefined")
+  require(doc != null, "doc undefined")
+}.map { _ =>
+  val fa = super.del(db, doc)
+  implicit val ec = db.executionContext
+  fa.flatMap { _ =>
+super.deleteAttachments(db, doc)
 
 Review comment:
   @rabbah Any pointers on how to determine if an attachment is present ... or 
you meant expose a method in `DocumentFactory` like `hasAttachement` and use 
that and have that overridden in `WhiskAction`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr opened a new pull request #21: add curl and wget

2018-03-06 Thread GitBox
csantanapr opened a new pull request #21: add curl and wget
URL: https://github.com/apache/incubator-openwhisk-runtime-docker/pull/21
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] houshengbo commented on issue #53: Change to use RAT maven plugin to support ASF short format header

2018-03-06 Thread GitBox
houshengbo commented on issue #53: Change to use RAT maven plugin to support 
ASF short format header
URL: 
https://github.com/apache/incubator-openwhisk-release/pull/53#issuecomment-371022697
 
 
   @daisy-ycguo You need to run first package_source-code.sh to have 
OPENWHISK_CLEANED_SOURCE_DIR created, but may change the order later.
   
   
   rsync -rtp --exclude .*\* --exclude bin\* --exclude build\* 
$OPENWHISK_SOURCE_DIR/. $OPENWHISK_CLEANED_SOURCE_DIR
   This is the command I used to create $OPENWHISK_CLEANED_SOURCE_DIR in order 
to exclude .*\*  bin\* , build\*.
   If you can do the exclude in maven, then we can change this part.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] houshengbo commented on issue #53: Change to use RAT maven plugin to support ASF short format header

2018-03-06 Thread GitBox
houshengbo commented on issue #53: Change to use RAT maven plugin to support 
ASF short format header
URL: 
https://github.com/apache/incubator-openwhisk-release/pull/53#issuecomment-371022697
 
 
   @daisy-ycguo You need to run first package_source-code.sh to have 
OPENWHISK_CLEANED_SOURCE_DIR created, but may change the order later.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] paulcastro closed pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
paulcastro closed pull request #23: Add Codable Support for Swift 4.x
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23
 
 
   

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 92a5d97..7a15b4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,4 +72,6 @@ ansible/roles/nginx/files/*cert.pem
 !tests/dat/build/swift4.0/SwiftyRequest.zip
 !tests/dat/build/swift4.1/HelloSwift4.zip
 !tests/dat/build/swift4.1/SwiftyRequest.zip
+!tests/dat/build/swift4.0/HelloSwift4Codable.zip
+!tests/dat/build/swift4.1/HelloSwift4Codable.zip
 
diff --git a/README.md b/README.md
index 82dd6f7..1062e48 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,76 @@ func main(args: [String:Any]) -> [String:Any] {
 ```
 
 ## Swift 4.x support
+
+Some examples of using Codable In and Out
+### Codable style function signature
+Create file `helloCodableAsync.swift`
+```swift
+// Domain model/entity
+struct Employee: Codable {
+  let id: Int?
+  let name: String?
+}
+// codable main function
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// For simplicity, just passing same Employee instance forward
+respondWith(input, nil)
+}
+```
+```
+wsk action update helloCodableAsync helloCodableAsync.swift swift:4.1
+```
+ok: updated action helloCodableAsync
+```
+wsk action invoke helloCodableAsync -r -p id 42 -p name Carlos
+```
+```json
+{
+"id": 42,
+"name": "Carlos"
+}
+```
+
+### Codable Error Handling
+Create file `helloCodableAsync.swift`
+```swift
+struct Employee: Codable {
+let id: Int?
+let name: String?
+}
+enum VendingMachineError: Error {
+case invalidSelection
+case insufficientFunds(coinsNeeded: Int)
+case outOfStock
+}
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// Return real error
+do{
+throw VendingMachineError.insufficientFunds(coinsNeeded: 5)
+} catch {
+respondWith(nil, error)
+} 
+}
+```
+```
+wsk action update helloCodableError helloCodableError.swift swift:4.1
+```
+ok: updated action helloCodableError
+```
+wsk action invoke helloCodableError -b -p id 42 -p name Carlos
+```
+```json
+{
+"name": "helloCodableError",
+"response": {
+  "result": {
+"error": "insufficientFunds(5)"
+  },
+"status": "application error",
+"success": false
+}
+```
+
 ### Packaging an action as a Swift executable using Swift 4
 
 When you create an OpenWhisk Swift action with a Swift source file, it has to 
be compiled into a binary before the action is run. Once done, subsequent calls 
to the action are much faster until the container holding your action is 
purged. This delay is known as the cold-start delay.
@@ -136,7 +206,7 @@ let package = Package(
 
 ### Helper compile.sh helper script
 When compiling and packaging your swift 4 action, there are a couple of 
differences.
-All your source code needs to be copy to 
`/swift4Action/spm-build/Sources/Action/` instead of `/swift3Action/spm-build/`
+All your source code needs to be copied to 
`/swift4Action/spm-build/Sources/Action/` instead of `/swift3Action/spm-build/`
 You Package.swift needs to have the first line with a comment indicating 
swift4 tooling and format
 ```
 // swift-tools-version:4.0
@@ -158,7 +228,7 @@ This will produce a zip `build/swift4/Hello.zip`
 
 ### SwiftyJSON using single source action file
 If you have a swift:3.1.1 action not compile, just as source using the 
`SwiftyJSON` package, you need to precompile your action and specify the 
version of SwiftyJSON you wan to use for swift:4.0 kind action.
-Take into account that tarting with Swift 4 there is better support to manage 
JSON data natively.
+Take into account that starting with Swift 4 there is better support to manage 
JSON data natively.
 
 Note: This is only applicable to the base image provided for the Swift 4 
runtime, other downstream such as IBM Cloud Functions extending this image 
might provide additional SDK and packages including `SwiftyJSON` and IBM Watson 
SDK, check the vendor documentation for more specific information about 
packages and versions.
 
@@ -179,6 +249,78 @@ We have a runtime for swift 4.1, is experimental as we are 
trying beta builds re
 Follow same insructions for Swift 4.0 above and replace the kind wih 
`swift:4.1` and image with `openwhisk/action-swift-v4.0`
 
 
+## Codable Suppor with Swift 4.x
+
+Some examples of using Codable In and Out
+
+### Codable style function signature
+Create file `helloCodableAsync.swift`
+```swift
+// Domain model/entity
+struct Employee: Codable {
+  let id: Int
+  let name: String
+}
+// codable main function
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// For simplicity, just passing same Employ

[GitHub] mrutkows closed pull request #772: upgrading go client

2018-03-06 Thread GitBox
mrutkows closed pull request #772: upgrading go client
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/772
 
 
   

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/Godeps/Godeps.json b/Godeps/Godeps.json
index d6613b32..a7ba4c55 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -105,11 +105,11 @@
},
{
"ImportPath": 
"github.com/apache/incubator-openwhisk-client-go/whisk",
-   "Rev": "a81a9be21faae877e858c6ab9122a40419577f95"
+   "Rev": "717bc3a1638460e069e411e9a8bf0ea5c97f1efa"
},
{
"ImportPath": 
"github.com/apache/incubator-openwhisk-client-go/wski18n",
-   "Rev": "a81a9be21faae877e858c6ab9122a40419577f95"
+   "Rev": "717bc3a1638460e069e411e9a8bf0ea5c97f1efa"
},
{
"ImportPath": "github.com/pelletier/go-buffruneio",
diff --git a/cmd/export.go b/cmd/export.go
index 1cf6a596..ede3ba02 100644
--- a/cmd/export.go
+++ b/cmd/export.go
@@ -61,7 +61,7 @@ func ExportAction(actionName string, packageName string, 
maniyaml *parsers.YAML)
maniyaml.Packages[packageName] = pkg
}
 
-   wskAction, _, err := client.Actions.Get(actionName)
+   wskAction, _, err := client.Actions.Get(actionName, true)
if err != nil {
return err
}
@@ -112,8 +112,10 @@ func ExportAction(actionName string, packageName string, 
maniyaml *parsers.YAML)
defer f.Close()
 
// store action function in the filesystem next to the 
manifest.yml
-   // TODO: consider to name files by namespace + action to make 
function file names uniqueue
-   f.Write([]byte(*wskAction.Exec.Code))
+   // TODO: consider to name files by namespace + action to make 
function file names unique
+   if wskAction.Exec.Code != nil {
+   f.Write([]byte(*wskAction.Exec.Code))
+   }
pkg.Actions[wskAction.Name] = parsedAction
}
 
diff --git a/deployers/servicedeployer.go b/deployers/servicedeployer.go
index 377c4250..f5429125 100644
--- a/deployers/servicedeployer.go
+++ b/deployers/servicedeployer.go
@@ -1331,7 +1331,7 @@ func (deployer *ServiceDeployer) deleteAction(pkgname 
string, action *whisk.Acti
 
displayPreprocessingInfo(parsers.YAML_KEY_ACTION, action.Name, false)
 
-   if _, _, ok := deployer.Client.Actions.Get(action.Name); ok == nil {
+   if _, _, ok := deployer.Client.Actions.Get(action.Name, false); ok == 
nil {
var err error
var response *http.Response
err = retry(DEFAULT_ATTEMPTS, DEFAULT_INTERVAL, func() error {


 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on a change in pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
csantanapr commented on a change in pull request #23: Add Codable Support for 
Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#discussion_r172733320
 
 

 ##
 File path: README.md
 ##
 @@ -39,6 +39,76 @@ func main(args: [String:Any]) -> [String:Any] {
 ```
 
 ## Swift 4.x support
+
+Some examples of using Codable In and Out
+### Codable style function signature
+Create file `helloCodableAsync.swift`
+```swift
+// Domain model/entity
+struct Employee: Codable {
+  let id: Int?
+  let name: String?
+}
+// codable main function
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// For simplicity, just passing same Employee instance forward
+respondWith(input, nil)
+}
+```
+```
+wsk action update helloCodableAsync helloCodableAsync.swift swift:4.1
+```
+ok: updated action helloCodableAsync
+```
+wsk action invoke helloCodableAsync -r -p id 42 -p name Carlos
+```
+```json
+{
+"id": 42,
+"name": "Carlos"
+}
+```
+
+### Codable Error Handling
+Create file `helloCodableAsync.swift`
+```swift
+struct Employee: Codable {
+let id: Int?
+let name: String?
+}
+enum VendingMachineError: Error {
+case invalidSelection
+case insufficientFunds(coinsNeeded: Int)
+case outOfStock
+}
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// Return real error
+do{
+throw VendingMachineError.insufficientFunds(coinsNeeded: 5)
+} catch {
+respondWith(nil, error)
+} 
+}
+```
+```
+wsk action update helloCodableError helloCodableError.swift swift:4.1
+```
+ok: updated action helloCodableError
+```
+wsk action invoke helloCodableError -b -p id 42 -p name Carlos
+```
+```json
+{
+"name": "helloCodableError",
+"response": {
+  "result": {
+"error": "insufficientFunds(5)"
+  },
+"status": "application error",
+"success": false
+}
+```
+
 ### Packaging an action as a Swift executable using Swift 4
 
 Review comment:
   updated the readme with typos fixes @paulcastro 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on issue #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
csantanapr commented on issue #3388: Update require-whisk-auth behavior to 
secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#issuecomment-371011153
 
 
   From @dubeejw 
   >Can we open an issue at least to update the doc with examples of using the 
web action auth?
   
   I agree, a simple example with wsk cli to set the annotation, and then a 
curl showing using the header and value of the annotation would be good to add.
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on issue #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
csantanapr commented on issue #3388: Update require-whisk-auth behavior to 
secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#issuecomment-371011153
 
 
   From @dubeejw 
   >Can we open an issue at least to update the doc with examples of using the 
web action auth?
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on a change in pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
csantanapr commented on a change in pull request #23: Add Codable Support for 
Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#discussion_r172730781
 
 

 ##
 File path: core/swift40Action/epilogue.swift
 ##
 @@ -21,24 +21,100 @@ import Foundation
 let inputStr: String = readLine() ?? "{}"
 let json = inputStr.data(using: .utf8, allowLossyConversion: true)!
 
+func _whisk_print_error(message: String, error: Error?){
+if let error = error {
+print("{\"error\":\"\(message) \(error.localizedDescription)\"}")
+} else {
+   print("{\"error\":\"\(message)\"}")
+}
+}
 
 // snippet of code "injected" (wrapper code for invoking traditional main)
 func _run_main(mainFunction: ([String: Any]) -> [String: Any]) -> Void {
-let parsed = try! JSONSerialization.jsonObject(with: json, options: []) 
as! [String: Any]
-let result = mainFunction(parsed)
-if JSONSerialization.isValidJSONObject(result) {
-do {
-let jsonData = try JSONSerialization.data(withJSONObject: result, 
options: [])
-if let jsonStr = String(data: jsonData, encoding: 
String.Encoding.utf8) {
-print("\(jsonStr)")
-} else {
-print("Error serializing data to JSON, data conversion returns 
nil string")
+do {
+let parsed = try JSONSerialization.jsonObject(with: json, options: []) 
as! [String: Any]
+let result = mainFunction(parsed)
+if JSONSerialization.isValidJSONObject(result) {
+do {
+let jsonData = try JSONSerialization.data(withJSONObject: 
result, options: [])
+if let jsonStr = String(data: jsonData, encoding: 
String.Encoding.utf8) {
+print("\(jsonStr)")
+} else {
+_whisk_print_error(message: "Error serializing data to 
JSON, data conversion returns nil string", error: nil)
+}
+} catch {
+_whisk_print_error(message: "JFailed to encode Dictionary type 
to JSON string:", error: error)
 
 Review comment:
   yeah Typo


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows closed pull request #52: Add license verification document

2018-03-06 Thread GitBox
mrutkows closed pull request #52: Add license verification document
URL: https://github.com/apache/incubator-openwhisk-release/pull/52
 
 
   

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/docs/license_compliance.md b/docs/license_compliance.md
new file mode 100644
index 000..44872cb
--- /dev/null
+++ b/docs/license_compliance.md
@@ -0,0 +1,65 @@
+
+
+# Verify License Compliance
+
+This document describes the work to verify OpenWhisk release artifacts are 
compliant with ASF licensing policy.
+
+## Policies and rules
+
+As described in [Apache Release 
Policy](http://www.apache.org/legal/release-policy.html#licensing), every 
artifact distributed MUST contain only appropriately licensed code per Apache 
Licensing Policy. It includes two check points:
+- Each package MUST provide a LICENSE file and a NOTICE file.
+- With a few exceptions, source files consisting of works submitted directly 
to the ASF by the copyright owner or owner's agent must contain the appropriate 
ASF license header. Here are the exceptions:
+  + Files without any degree of creativity don't require a license header.
+  + Sometimes shorter form of ASF license header can be used if the 
recommended Apache source header is not appropriate.
+
+In OpenWhisk project, we will exclude below type of files from license header 
verification because of little creativity:
+- Json files
+- Gradle setting files
+- Configuration files prefixed with dot
+- Template files used in OpenWhisk installation
+
+In OpenWhisk project, we decided to apply short form of header to minified 
OpenWhisk action source files in order to get better performance.
+
+## Tools and scripts
+
+[verify_source_code.sh](../tools/verify_source_code.sh) in the `tools` folder 
is to verify license compliance. [Apache Rat](https://creadur.apache.org/rat/) 
is used to verify license headers. Files excluded license header verification 
following the previous rules are configured in the file 
[pom.xml](../tools/travis/pom.xml).
+
+```
+cd $OPENWHISK_SOURCE_DIR
+cp $SCRIPTDIR/lib/pom.xml ./
+mvn clean apache-rat:check 
+```
+Below script snippet is used to check LICENSE file and NOTICE file in every 
repository.
+```
+for repo in $(echo $repos | sed "s/,/ /g")
+do
+repo_name=$(echo "$repo" | sed -e 's/^"//' -e 's/"$//')
+echo "Check the repository $repo_name"
+cd $OPENWHISK_CLEANED_SOURCE_DIR/$repo_name && ls {LICENSE*,NOTICE*}
+done
+```
+
+Although [Apache Tentacles](https://creadur.apache.org/tentacles/) is a tool 
to check LICENSE file and NOTICE file in artifacts uploading to a staging 
repository, it is not usable for us because it doesn't support the unpacking of 
tar.gz files.
+
+## How to
+
+After downloading the source codes to your local disk, run the following 
script to verify license compliance:
+```
+$ ./tools/travis/verify_source_code.sh 
+```


 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] paulcastro commented on a change in pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
paulcastro commented on a change in pull request #23: Add Codable Support for 
Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#discussion_r172728876
 
 

 ##
 File path: core/swift40Action/epilogue.swift
 ##
 @@ -21,24 +21,100 @@ import Foundation
 let inputStr: String = readLine() ?? "{}"
 let json = inputStr.data(using: .utf8, allowLossyConversion: true)!
 
+func _whisk_print_error(message: String, error: Error?){
+if let error = error {
+print("{\"error\":\"\(message) \(error.localizedDescription)\"}")
+} else {
+   print("{\"error\":\"\(message)\"}")
+}
+}
 
 // snippet of code "injected" (wrapper code for invoking traditional main)
 func _run_main(mainFunction: ([String: Any]) -> [String: Any]) -> Void {
-let parsed = try! JSONSerialization.jsonObject(with: json, options: []) 
as! [String: Any]
-let result = mainFunction(parsed)
-if JSONSerialization.isValidJSONObject(result) {
-do {
-let jsonData = try JSONSerialization.data(withJSONObject: result, 
options: [])
-if let jsonStr = String(data: jsonData, encoding: 
String.Encoding.utf8) {
-print("\(jsonStr)")
-} else {
-print("Error serializing data to JSON, data conversion returns 
nil string")
+do {
+let parsed = try JSONSerialization.jsonObject(with: json, options: []) 
as! [String: Any]
+let result = mainFunction(parsed)
+if JSONSerialization.isValidJSONObject(result) {
+do {
+let jsonData = try JSONSerialization.data(withJSONObject: 
result, options: [])
+if let jsonStr = String(data: jsonData, encoding: 
String.Encoding.utf8) {
+print("\(jsonStr)")
+} else {
+_whisk_print_error(message: "Error serializing data to 
JSON, data conversion returns nil string", error: nil)
+}
+} catch {
+_whisk_print_error(message: "JFailed to encode Dictionary type 
to JSON string:", error: error)
 
 Review comment:
   What's `JFailed` ?  Typo?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] paulcastro commented on a change in pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
paulcastro commented on a change in pull request #23: Add Codable Support for 
Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#discussion_r172728354
 
 

 ##
 File path: README.md
 ##
 @@ -39,6 +39,76 @@ func main(args: [String:Any]) -> [String:Any] {
 ```
 
 ## Swift 4.x support
+
+Some examples of using Codable In and Out
+### Codable style function signature
+Create file `helloCodableAsync.swift`
+```swift
+// Domain model/entity
+struct Employee: Codable {
+  let id: Int?
+  let name: String?
+}
+// codable main function
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// For simplicity, just passing same Employee instance forward
+respondWith(input, nil)
+}
+```
+```
+wsk action update helloCodableAsync helloCodableAsync.swift swift:4.1
+```
+ok: updated action helloCodableAsync
+```
+wsk action invoke helloCodableAsync -r -p id 42 -p name Carlos
+```
+```json
+{
+"id": 42,
+"name": "Carlos"
+}
+```
+
+### Codable Error Handling
+Create file `helloCodableAsync.swift`
+```swift
+struct Employee: Codable {
+let id: Int?
+let name: String?
+}
+enum VendingMachineError: Error {
+case invalidSelection
+case insufficientFunds(coinsNeeded: Int)
+case outOfStock
+}
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// Return real error
+do{
+throw VendingMachineError.insufficientFunds(coinsNeeded: 5)
+} catch {
+respondWith(nil, error)
+} 
+}
+```
+```
+wsk action update helloCodableError helloCodableError.swift swift:4.1
+```
+ok: updated action helloCodableError
+```
+wsk action invoke helloCodableError -b -p id 42 -p name Carlos
+```
+```json
+{
+"name": "helloCodableError",
+"response": {
+  "result": {
+"error": "insufficientFunds(5)"
+  },
+"status": "application error",
+"success": false
+}
+```
+
 ### Packaging an action as a Swift executable using Swift 4
 
 Review comment:
   H, can't edit each line individually.  Here are some typos:
   
   Line 209: `All your source code needs to be copied ... `
   Line 231: `Take into account that starting ...`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] paulcastro commented on a change in pull request #23: Add Codable Support for Swift 4.x

2018-03-06 Thread GitBox
paulcastro commented on a change in pull request #23: Add Codable Support for 
Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#discussion_r172728354
 
 

 ##
 File path: README.md
 ##
 @@ -39,6 +39,76 @@ func main(args: [String:Any]) -> [String:Any] {
 ```
 
 ## Swift 4.x support
+
+Some examples of using Codable In and Out
+### Codable style function signature
+Create file `helloCodableAsync.swift`
+```swift
+// Domain model/entity
+struct Employee: Codable {
+  let id: Int?
+  let name: String?
+}
+// codable main function
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// For simplicity, just passing same Employee instance forward
+respondWith(input, nil)
+}
+```
+```
+wsk action update helloCodableAsync helloCodableAsync.swift swift:4.1
+```
+ok: updated action helloCodableAsync
+```
+wsk action invoke helloCodableAsync -r -p id 42 -p name Carlos
+```
+```json
+{
+"id": 42,
+"name": "Carlos"
+}
+```
+
+### Codable Error Handling
+Create file `helloCodableAsync.swift`
+```swift
+struct Employee: Codable {
+let id: Int?
+let name: String?
+}
+enum VendingMachineError: Error {
+case invalidSelection
+case insufficientFunds(coinsNeeded: Int)
+case outOfStock
+}
+func main(input: Employee, respondWith: (Employee?, Error?) -> Void) -> Void {
+// Return real error
+do{
+throw VendingMachineError.insufficientFunds(coinsNeeded: 5)
+} catch {
+respondWith(nil, error)
+} 
+}
+```
+```
+wsk action update helloCodableError helloCodableError.swift swift:4.1
+```
+ok: updated action helloCodableError
+```
+wsk action invoke helloCodableError -b -p id 42 -p name Carlos
+```
+```json
+{
+"name": "helloCodableError",
+"response": {
+  "result": {
+"error": "insufficientFunds(5)"
+  },
+"status": "application error",
+"success": false
+}
+```
+
 ### Packaging an action as a Swift executable using Swift 4
 
 Review comment:
   Line 209: `All your source code needs to be copied ... `
   Line 231: `Take into account that starting ...`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on issue #3345: ansible 2.4 compatibility

2018-03-06 Thread GitBox
csantanapr commented on issue #3345: ansible 2.4 compatibility
URL: 
https://github.com/apache/incubator-openwhisk/issues/3345#issuecomment-371000840
 
 
   Yes moving to latest ansible sounds like a good idea, like always if you 
have some internal pipeline inside your company coordinate with them so they 
can absorb the change. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #25: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #25: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-runtime-nodejs/issues/25
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-nodejs/tools/travis/setup.sh
 openwhisk-runtime-nodejs/tools/travis/publish.sh
 openwhisk-runtime-nodejs/tools/travis/build.sh
 openwhisk-runtime-nodejs/tools/travis/deploy.sh
 openwhisk-runtime-nodejs/tools/travis/test.sh
 openwhisk-runtime-nodejs/core/nodejsActionBase/Dockerfile
 openwhisk-runtime-nodejs/core/nodejs6Action/CHANGELOG.md
 openwhisk-runtime-nodejs/core/nodejs6Action/Dockerfile
 openwhisk-runtime-nodejs/core/nodejs8Action/CHANGELOG.md
 openwhisk-runtime-nodejs/core/nodejs8Action/Dockerfile
 openwhisk-runtime-nodejs/tests/src/test/resources/application.conf
 openwhisk-runtime-nodejs/README.md
 openwhisk-runtime-nodejs/ansible/environments/local/group_vars/all
 openwhisk-runtime-nodejs/ansible/environments/local/hosts
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #31: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #31: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/31
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-swift/tools/build/compile.sh
 openwhisk-runtime-swift/tools/travis/setup.sh
 openwhisk-runtime-swift/tools/travis/publish.sh
 openwhisk-runtime-swift/tools/travis/build.sh
 openwhisk-runtime-swift/tools/travis/deploy.sh
 openwhisk-runtime-swift/tools/travis/test.sh
 openwhisk-runtime-swift/core/swift41Action/CHANGELOG.md
 openwhisk-runtime-swift/core/swift41Action/Dockerfile
 openwhisk-runtime-swift/core/swift40Action/epilogue.swift
 openwhisk-runtime-swift/core/swift40Action/CHANGELOG.md
 openwhisk-runtime-swift/core/swift40Action/Dockerfile
 openwhisk-runtime-swift/core/swift3.1.1Action/CHANGELOG.md
 openwhisk-runtime-swift/core/swift3.1.1Action/Dockerfile
 openwhisk-runtime-swift/tests/dat/build.sh
 openwhisk-runtime-swift/tests/dat/actions/HelloSwift4/Sources/main.swift
 openwhisk-runtime-swift/tests/dat/actions/HelloSwift3/Sources/main.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/createTrigger.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/invoke.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/hello.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/trigger.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/createRule.swift
 
openwhisk-runtime-swift/tests/dat/actions/sdk/swift3/invokeNonBlocking.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/createTrigger.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/invoke.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/hello.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/trigger.swift
 openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/createRule.swift
 
openwhisk-runtime-swift/tests/dat/actions/sdk/swift4/invokeNonBlocking.swift
 openwhisk-runtime-swift/tests/dat/actions/SwiftyRequest/Package.resolved
 openwhisk-runtime-swift/tests/dat/actions/SwiftyRequest/Sources/main.swift
 openwhisk-runtime-swift/tests/src/test/resources/application.conf
 openwhisk-runtime-swift/README.md
 openwhisk-runtime-swift/ansible/environments/local/group_vars/all
 openwhisk-runtime-swift/ansible/environments/local/hosts
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #25: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #25: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-runtime-java/issues/25
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-java/tools/travis/setup.sh
 openwhisk-runtime-java/tools/travis/publish.sh
 openwhisk-runtime-java/tools/travis/build.sh
 openwhisk-runtime-java/tools/travis/deploy.sh
 openwhisk-runtime-java/tools/travis/test.sh
 openwhisk-runtime-java/core/javaAction/Dockerfile
 openwhisk-runtime-java/core/javaAction/delete-build-run.sh
 openwhisk-runtime-java/CHANGELOG.md
 openwhisk-runtime-java/tests/src/test/resources/application.conf
 openwhisk-runtime-java/README.md
 openwhisk-runtime-java/ansible/environments/local/group_vars/all
 openwhisk-runtime-java/ansible/environments/local/hosts
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #20: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #20: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-runtime-docker/issues/20
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-docker/tools/travis/setup.sh
 openwhisk-runtime-docker/tools/travis/publish.sh
 openwhisk-runtime-docker/tools/travis/build_sdk.sh
 openwhisk-runtime-docker/tools/travis/build.sh
 openwhisk-runtime-docker/tools/travis/rename_sdk.sh
 openwhisk-runtime-docker/tools/travis/deploy.sh
 openwhisk-runtime-docker/tools/travis/test.sh
 openwhisk-runtime-docker/core/CHANGELOG.md
 openwhisk-runtime-docker/core/actionProxy/Dockerfile
 openwhisk-runtime-docker/core/actionProxy/stub.sh
 openwhisk-runtime-docker/core/actionProxy/README.md
 openwhisk-runtime-docker/core/actionProxy/delete-build-run.sh
 openwhisk-runtime-docker/tests/dat/blackbox/badaction/Dockerfile
 openwhisk-runtime-docker/tests/dat/blackbox/badaction/README.md
 openwhisk-runtime-docker/tests/dat/blackbox/badproxy/Dockerfile
 openwhisk-runtime-docker/tests/dat/blackbox/badproxy/README.md
 openwhisk-runtime-docker/tests/src/test/resources/application.conf
 openwhisk-runtime-docker/README.md
 openwhisk-runtime-docker/ansible/environments/local/group_vars/all
 openwhisk-runtime-docker/ansible/environments/local/hosts
 openwhisk-runtime-docker/sdk/docker/Dockerfile
 openwhisk-runtime-docker/sdk/docker/README.md
 openwhisk-runtime-docker/sdk/docker/example.c
 openwhisk-runtime-docker/sdk/docker/build_tgz.sh
 openwhisk-runtime-docker/sdk/docker/buildAndPush.sh
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #10: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #10: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-runtime-python/issues/10
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-python/tools/travis/setup.sh
 openwhisk-runtime-python/tools/travis/publish.sh
 openwhisk-runtime-python/tools/travis/build.sh
 openwhisk-runtime-python/tools/travis/deploy.sh
 openwhisk-runtime-python/tools/travis/test.sh
 openwhisk-runtime-python/core/python2Action/CHANGELOG.md
 openwhisk-runtime-python/core/python2Action/Dockerfile
 openwhisk-runtime-python/core/pythonAction/CHANGELOG.md
 openwhisk-runtime-python/core/pythonAction/Dockerfile
 openwhisk-runtime-python/tests/src/test/resources/application.conf
 openwhisk-runtime-python/README.md
 openwhisk-runtime-python/ansible/environments/local/group_vars/all
 openwhisk-runtime-python/ansible/environments/local/hosts
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #8: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #8: Some source files miss Apache license headers
URL: https://github.com/apache/incubator-openwhisk-runtime-php/issues/8
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-runtime-php/tools/travis/setup.sh
 openwhisk-runtime-php/tools/travis/publish.sh
 openwhisk-runtime-php/tools/travis/build.sh
 openwhisk-runtime-php/tools/travis/deploy.sh
 openwhisk-runtime-php/tools/travis/test.sh
 openwhisk-runtime-php/core/php7.1Action/Dockerfile
 openwhisk-runtime-php/tests/src/test/resources/application.conf
 openwhisk-runtime-php/README.md
 openwhisk-runtime-php/ansible/environments/local/group_vars/all
 openwhisk-runtime-php/ansible/environments/local/hosts
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo opened a new issue #68: Some source files miss Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo opened a new issue #68: Some source files miss Apache license 
headers
URL: https://github.com/apache/incubator-openwhisk-client-go/issues/68
 
 
   Following [Apache license header 
guideline](http://www.apache.org/legal/src-headers.html), **all human-readable 
Apache-developed files that are included within a distribution must include the 
header text with few exceptions**. You can find few exceptions here: [which 
files do not require a license 
header](http://www.apache.org/legal/src-headers.html#faq-exceptions).
   
   I used Apache Rat to check this repository after excluding a few files, and 
I got this report. We need to add Apache licensing header to those files.
   ```
   Unapproved licenses:
   
 openwhisk-client-go/tools/travis/setup.sh
 openwhisk-client-go/tools/travis/build.sh
 openwhisk-client-go/tools/travis/test_openwhisk.sh
 openwhisk-client-go/Makefile
   ```
   
   The excluded files are:
   ```
   **/*.json
   **/**.gradle
   **/gradlew
   **/gradle/**
   **/.**
   **/templates/**
   **/*.j2.*
   **/.github/**
   **/auth.whisk.system
   **/auth.guest
   **/i18n_resources.go
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai opened a new issue #773: How to address go get failures due to breaking changes in Go Client?

2018-03-06 Thread GitBox
pritidesai opened a new issue #773: How to address go get failures due to 
breaking changes in Go Client?
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/773
 
 
   There was a change in the function signature of Get action in 
apache/incubator-openwhisk-client-go@72bf712
   
   ```
   -func (s *ActionService) Get(actionName string) (*Action, *http.Response, 
error) {
   +func (s *ActionService) Get(actionName string, fetchCode bool) (*Action, 
*http.Response, error) {
   ```
   
   `fetchCode` was added to determine whether to return function code or not on 
a `GET` call. This is just one simple change which was breaking `go get`:
   
   ```
   go get GitHub.com/apache/incubator-openwhisk-wskdeploy
   # github.com/apache/incubator-openwhisk-wskdeploy/deployers
   
go/src/github/apache/incubator-openwhisk-wskdeploy/deployers/servicedeployer.go:1334:44:
 not enough arguments in call to deployer.Client.Actions.Get
   have (string)
   want (string, bool)
   ```
   
   This kind of change wouldn't break `wskdeploy` travis builds as we specify 
dependencies in `GoDeps` file. How to enforce those dependency versions in `go 
get`?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo commented on issue #273: A list of source files missing Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo commented on issue #273: A list of source files missing Apache 
license headers
URL: 
https://github.com/apache/incubator-openwhisk-apigateway/issues/273#issuecomment-370991462
 
 
   @mhamann Apache Rat could handle most part of those files , yet still need a 
human verification.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo commented on issue #273: A list of source files missing Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo commented on issue #273: A list of source files missing Apache 
license headers
URL: 
https://github.com/apache/incubator-openwhisk-apigateway/issues/273#issuecomment-370991462
 
 
   @mhamann Apache Rat could do that, yet still need a human verification.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo commented on issue #716: Some source files are missing Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo commented on issue #716: Some source files are missing Apache 
license headers
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/716#issuecomment-370990878
 
 
   Below files need to add short license header. We also need to change the 
header of test files from full license headers to short license header.
   ```
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/list-members.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/get-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/put-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/delete-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/post-books.js
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] daisy-ycguo commented on issue #716: Some source files are missing Apache license headers

2018-03-06 Thread GitBox
daisy-ycguo commented on issue #716: Some source files are missing Apache 
license headers
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/716#issuecomment-370990878
 
 
   More files:
   ```
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/list-members.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/get-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/put-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/delete-books.js
 openwhisk-wskdeploy/tests/src/integration/apigateway/src/post-books.js
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai opened a new pull request #772: upgrading go client

2018-03-06 Thread GitBox
pritidesai opened a new pull request #772: upgrading go client
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/772
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on issue #3402: Create '_users' database for singleton ephemeral couchdb v 2+

2018-03-06 Thread GitBox
rabbah commented on issue #3402: Create '_users' database for singleton 
ephemeral couchdb v 2+
URL: 
https://github.com/apache/incubator-openwhisk/pull/3402#issuecomment-370969346
 
 
   @bbrowning didn't you do this at some point?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] ptaube opened a new issue #3403: Accept tabs in go code

2018-03-06 Thread GitBox
ptaube opened a new issue #3403: Accept tabs in go code
URL: https://github.com/apache/incubator-openwhisk/issues/3403
 
 
   Right now scanCode.cfg contains following line
   `*.go=has_block_license, no_tabs, no_trailing_spaces, eol_at_eof`
   which causes any go code which contains tabs to be rejected. Actually it's 
standard in go to use tabs and gofmt - the standard formatting tool in go - 
reformats all go code to use tabs for indentation. 
   
   In order to get go code be accepted according go coding standards
   `*.go=has_block_license, no_tabs, no_trailing_spaces, eol_at_eof`
   has to be changed to
   `*.go=has_block_license, no_trailing_spaces, eol_at_eof`
   
   
   
   
   
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jonpspri commented on issue #3345: ansible 2.4 compatibility

2018-03-06 Thread GitBox
jonpspri commented on issue #3345: ansible 2.4 compatibility
URL: 
https://github.com/apache/incubator-openwhisk/issues/3345#issuecomment-370939183
 
 
   So we need a timeframe for when we are going to support ansible 2.4+ only.  
It seems like now is as good a time as any, which would then let us undo these 
and look for any other optimizations we could make.  That means poring through 
the setup scripts and documentation to be sure they're clean.
   
   @csantanapr Shall we go ahead and push to ansible 2.4.3 in the ubuntu-xenial 
setup scripts?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jonpspri opened a new pull request #3402: Create '_users' database for singleton ephemeral couchdb v 2+

2018-03-06 Thread GitBox
jonpspri opened a new pull request #3402: Create '_users' database for 
singleton ephemeral couchdb v 2+
URL: https://github.com/apache/incubator-openwhisk/pull/3402
 
 
   
   
   ## Description
   
   
   
   Add a step to the 'ansible/roles/couchdb/deploy.yml' playbook that will 
create a `_users` database when the couchdb is set up as a singleton instance 
and the version is 2.0+.  As of version 2.0, the `_users` database is no longer 
created automatically.  When it does not exist, an error messge is periodically 
emitted, which in turn creates noise in the log file.
   
   ## Related issue and scope
   
   - [ ] I opened an issue to propose and discuss this change (#)
   
   ## My changes affect the following components
   
   
   - [ ] API
   - [ ] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [X] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   
   - [X] Bug fix (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing 
behavior).
   
   ## Checklist:
   
   
   - [X] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [ ] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   - [ ] I added tests to cover my changes.
   - [ ] My changes require further changes to the documentation.
   - [ ] I updated the documentation where necessary.
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] csantanapr commented on issue #3138: Add bash kind action

2018-03-06 Thread GitBox
csantanapr commented on issue #3138: Add bash kind action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3138#issuecomment-366863338
 
 
   Recent changes to dockerSkeleton runtime now allows for better support for 
bash actions.
   Using `--native` with a simple script is the recommend way for bash actions.
   
   For example:
   
   bash.sh reads  a line from \
   ```
   $ cat bash.sh
   #!/bin/bash
   read ARGS
   A=`echo "$ARGS" | jq '."a"'`
   B=`echo "$ARGS" | jq '."b"'`
   C=`echo "$ARGS" | jq '."c"[0]'`
   RES=$(($B + $C))
   echo A is $A
   echo "{ \"result\": \"$RES\" }"
   ```
   ```
   wsk action update bash bash.sh --native
   ```
   ```
   ok: updated action bash
   ```
   
   ```
   wsk action invoke bash -p a A -p b 123 -p c '[1,2,3]' -r
   ```
   ```json
   {
   "result": 124
   }
   ```
   ```
   wsk activation logs --last --strip
   ```
   ```
   A is "A"
   ```
   
   docs will update to reflect this new usage.
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jonpspri commented on issue #3363: Ansible image name overrides and bump NGinx to 1.13.9

2018-03-06 Thread GitBox
jonpspri commented on issue #3363: Ansible image name overrides and bump NGinx 
to 1.13.9
URL: 
https://github.com/apache/incubator-openwhisk/pull/3363#issuecomment-370918926
 
 
   Just rebased in a hope that #3393 fixed the Kafka heisenbug.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai closed pull request #765: Update deploymentreader.go tests and fix bind logic.

2018-03-06 Thread GitBox
pritidesai closed pull request #765: Update deploymentreader.go tests and fix 
bind logic.
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/765
 
 
   

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/.travis.yml b/.travis.yml
index bb7e6ef1..8b98781a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,7 +30,7 @@ install:
 - go get -u github.com/stretchr/testify
 - go get -u github.com/tools/godep
 before_script:
-- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)
+- GO_FILES=$(find . -iname '*.go' -type f -not -path 
"./wski18n/i18n_resources.go")
 - export BAD_GO=$(gofmt -s -l $(echo $GO_FILES))
 - echo $BAD_GO
 - test -z "$BAD_GO"
diff --git a/cmd/report.go b/cmd/report.go
index 787e16a8..655a4b20 100644
--- a/cmd/report.go
+++ b/cmd/report.go
@@ -62,6 +62,8 @@ func init() {
RootCmd.AddCommand(reportCmd)
 
// TODO() REMOVE this flag... the flag -config exists already
+   // TODO() whiskclient alread retrieves wskprops and has a constant 
defined for it SOURCE_WSKPROPS
+   // Please remove or reuse code from whiskclient.go
reportCmd.Flags().StringVarP(&wskpropsPath, "wskproppath", "w",
path.Join(os.Getenv("HOME"), ".wskprops"),
wski18n.T(wski18n.ID_CMD_FLAG_CONFIG))
diff --git a/cmd/version.go b/cmd/version.go
index 7ad5bc58..c0f194a5 100644
--- a/cmd/version.go
+++ b/cmd/version.go
@@ -36,6 +36,7 @@ var versionCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
wskprint.PrintlnOpenWhiskOutput(
// Note: no need to translate the following string
+   // TODO(#767) - Flags.CliBuild and CliVersion are not 
set during build
fmt.Sprintf("wskdeploy build-version: %s--%s",
utils.Flags.CliBuild,
utils.Flags.CliVersion))
diff --git a/deployers/deploymentreader.go b/deployers/deploymentreader.go
index dd15c8bc..a31addd5 100644
--- a/deployers/deploymentreader.go
+++ b/deployers/deploymentreader.go
@@ -20,8 +20,6 @@ package deployers
 import (
"github.com/apache/incubator-openwhisk-client-go/whisk"
"github.com/apache/incubator-openwhisk-wskdeploy/parsers"
-   "github.com/apache/incubator-openwhisk-wskdeploy/utils"
-   "github.com/apache/incubator-openwhisk-wskdeploy/wskderrors"
"github.com/apache/incubator-openwhisk-wskdeploy/wskenv"
"github.com/apache/incubator-openwhisk-wskdeploy/wski18n"
"github.com/apache/incubator-openwhisk-wskdeploy/wskprint"
@@ -46,7 +44,6 @@ func (reader *DeploymentReader) HandleYaml() error {
 
deploymentParser := parsers.NewYAMLParser()
deployment, err := deploymentParser.ParseDeployment(dep.DeploymentPath)
-
reader.DeploymentDescriptor = deployment
 
return err
@@ -68,48 +65,67 @@ func (reader *DeploymentReader) BindAssets() error {
return nil
 }
 
-func (reader *DeploymentReader) bindPackageInputsAndAnnotations() error {
-
+func (reader *DeploymentReader) getPackageMap() map[string]parsers.Package {
packMap := make(map[string]parsers.Package)
 
-   if reader.DeploymentDescriptor.GetProject().Packages == nil {
-   if reader.DeploymentDescriptor.Packages != nil {
+   // Create local packages list from Deployment file for us to iterate 
over
+   // either from top-level or under project schema
+   if len(reader.DeploymentDescriptor.GetProject().Packages) == 0 {
+
+   if len(reader.DeploymentDescriptor.Packages) > 0 {
+   infoMsg := wski18n.T(
+   
wski18n.ID_DEBUG_PACKAGES_FOUND_UNDER_ROOT_X_path_X,
+   map[string]interface{}{
+   wski18n.KEY_PATH: 
reader.DeploymentDescriptor.Filepath})
+   wskprint.PrintlnOpenWhiskTrace(false, infoMsg)
for packName, depPacks := range 
reader.DeploymentDescriptor.Packages {
depPacks.Packagename = packName
packMap[packName] = depPacks
}
}
} else {
+
+   infoMsg := wski18n.T(
+   
wski18n.ID_DEBUG_PACKAGES_FOUND_UNDER_PROJECT_X_path_X_name_X,
+   map[string]interface{}{
+   wski18n.KEY_PATH: 
reader.DeploymentDescriptor.Filepath,
+   wski18n.KEY_NAME: 
reader.DeploymentDescriptor.GetProject().Name})
+   wskprint.PrintlnOpenWhiskTrace(false, infoMsg)
+
for packName, depPacks := range 
reader.DeploymentDescriptor.GetProject().Packages {
   

[GitHub] pritidesai commented on a change in pull request #765: Update deploymentreader.go tests and fix bind logic.

2018-03-06 Thread GitBox
pritidesai commented on a change in pull request #765: Update 
deploymentreader.go tests and fix bind logic.
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/765#discussion_r172615337
 
 

 ##
 File path: deployers/deploymentreader.go
 ##
 @@ -68,48 +66,62 @@ func (reader *DeploymentReader) BindAssets() error {
return nil
 }
 
-func (reader *DeploymentReader) bindPackageInputsAndAnnotations() error {
-
+func (reader *DeploymentReader) getPackageMap() map[string]parsers.Package {
 
 Review comment:
   thanks a bunch for refactoring this, creating a common subroutine instead of 
repeating this logic in all functions.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai commented on a change in pull request #765: Update deploymentreader.go tests and fix bind logic.

2018-03-06 Thread GitBox
pritidesai commented on a change in pull request #765: Update 
deploymentreader.go tests and fix bind logic.
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/765#discussion_r172614569
 
 

 ##
 File path: cmd/report.go
 ##
 @@ -62,6 +62,8 @@ func init() {
RootCmd.AddCommand(reportCmd)
 
// TODO() REMOVE this flag... the flag -config exists already
+   // TODO() whiskclient alread retrieves wskprops and has a constant 
defined for it SOURCE_WSKPROPS
+   // Please remove or reuse code from whiskclient.go
 
 Review comment:
   ? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai commented on a change in pull request #765: Update deploymentreader.go tests and fix bind logic.

2018-03-06 Thread GitBox
pritidesai commented on a change in pull request #765: Update 
deploymentreader.go tests and fix bind logic.
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/765#discussion_r172614096
 
 

 ##
 File path: .travis.yml
 ##
 @@ -30,7 +30,7 @@ install:
 - go get -u github.com/stretchr/testify
 - go get -u github.com/tools/godep
 before_script:
-- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)
+- GO_FILES=$(find . -iname '*.go' -type f -not -path 
"./wski18n/i18n_resources.go")
 
 Review comment:
   thanks for adding this to neglect go fmt on `i18n_resources.go`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows opened a new issue #771: TestInterpolateStringWithEnvVar has printlns(); need to be converted to Trace output

2018-03-06 Thread GitBox
mrutkows opened a new issue #771: TestInterpolateStringWithEnvVar has 
printlns(); need to be converted to Trace output
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/771
 
 
   TestInterpolateStringWithEnvVar always produces this output:
   
   ``
   NoDollar
   oh, dollars!
   5000
   ```
   
   these should be optional trace/debug
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser opened a new issue #3401: Consolidate action annotation constants

2018-03-06 Thread GitBox
mdeuser opened a new issue #3401: Consolidate action annotation constants
URL: https://github.com/apache/incubator-openwhisk/issues/3401
 
 
   Currently, the defined action annotation names are not centrally defined.  
Consolidate them as constants into a single location and change the existing 
code to use those constants.
   
   Example annotations
   - web-export
   - final
   - raw-http
   - web-custom-options
   - require-whisk-auth
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
mdeuser commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172628041
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -719,7 +741,8 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   private def confirmExportedAction(actionLookup: Future[WhiskActionMetaData], 
authenticated: Boolean)(
 implicit transid: TransactionId): Future[WhiskActionMetaData] = {
 actionLookup flatMap { action =>
-  val requiresAuthenticatedUser = 
action.annotations.getAs[Boolean]("require-whisk-auth").exists(identity)
+  val requiresAuthenticatedUser =
+
action.annotations.getAs[Boolean](WhiskAction.requireWhiskAuthAnnotation).exists(identity)
 
 Review comment:
   let's discuss after the refactoring into a separate method.. @markusthoemmes 
wanted to be sure we minimized the deserialization of the json values.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on a change in pull request #3391: Add namespace-blacklist to invoker.

2018-03-06 Thread GitBox
markusthoemmes commented on a change in pull request #3391: Add 
namespace-blacklist to invoker.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3391#discussion_r172624728
 
 

 ##
 File path: 
ansible/files/namespace_throttlings_design_document_for_subjects_db.json
 ##
 @@ -0,0 +1,10 @@
+{
+  "_id": "_design/namespaceThrottlings",
+  "views": {
+"blockedNamespaces": {
+  "map": "function (doc) {\n  if (doc._id.indexOf(\"/limits\") >= 0) {\n   
 if (doc.concurrentInvocations === 0 || doc.invocationsPerMinute === 0) {\n 
 var namespace = doc._id.replace(\"/limits\", \"\");\n  emit(namespace, 
1);\n}\n  } else if (doc.subject && doc.namespaces && doc.blocked) {\n
doc.namespaces.forEach(function(namespace) {\n  emit(namespace.name, 1);\n  
  });\n  }\n}",
 
 Review comment:
   I don't think so. Slashes are generally not allowed in namespaces so a 
namespace cannot possibly start with it.
   
   The better check here would've been an `endWith` (ofcourse we'd need to 
emulate it through an indexOf + offset check). But we decided against that for 
improved readability.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3391: Add namespace-blacklist to invoker.

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3391: Add namespace-blacklist to 
invoker.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3391#discussion_r172623147
 
 

 ##
 File path: 
ansible/files/namespace_throttlings_design_document_for_subjects_db.json
 ##
 @@ -0,0 +1,10 @@
+{
+  "_id": "_design/namespaceThrottlings",
+  "views": {
+"blockedNamespaces": {
+  "map": "function (doc) {\n  if (doc._id.indexOf(\"/limits\") >= 0) {\n   
 if (doc.concurrentInvocations === 0 || doc.invocationsPerMinute === 0) {\n 
 var namespace = doc._id.replace(\"/limits\", \"\");\n  emit(namespace, 
1);\n}\n  } else if (doc.subject && doc.namespaces && doc.blocked) {\n
doc.namespaces.forEach(function(namespace) {\n  emit(namespace.name, 1);\n  
  });\n  }\n}",
 
 Review comment:
   is there anyway for the index of `/limits` to be `0`? ie should this be a 
strictly `> 0` test?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on issue #3391: Add namespace-blacklist to invoker.

2018-03-06 Thread GitBox
rabbah commented on issue #3391: Add namespace-blacklist to invoker.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3391#issuecomment-370888539
 
 
   Thanks @chetanmeh, used the gradle task you added, here is the view function 
fwiw:
   
   ```javascript
   function (doc) {
 if (doc._id.indexOf("/limits") >= 0) {
   if (doc.concurrentInvocations === 0 || doc.invocationsPerMinute === 0) {
 var namespace = doc._id.replace("/limits", "");
 emit(namespace, 1);
   }
 } else if (doc.subject && doc.namespaces && doc.blocked) {
   doc.namespaces.forEach(function(namespace) {
 emit(namespace.name, 1);
   });
 }
   }
   
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah closed issue #3315: view functions extracted to source files should be excluded from scancode

2018-03-06 Thread GitBox
rabbah closed issue #3315: view functions extracted to source files should be 
excluded from scancode
URL: https://github.com/apache/incubator-openwhisk/issues/3315
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah closed pull request #3366: Adds method deleteAttachments to ArtifactStore

2018-03-06 Thread GitBox
rabbah closed pull request #3366: Adds method deleteAttachments to ArtifactStore
URL: https://github.com/apache/incubator-openwhisk/pull/3366
 
 
   

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/common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala 
b/common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala
index 33ea80589e..631f60ad1c 100644
--- a/common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala
+++ b/common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala
@@ -129,6 +129,11 @@ trait ArtifactStore[DocumentAbstraction] {
   protected[core] def readAttachment[T](doc: DocInfo, name: String, sink: 
Sink[ByteString, Future[T]])(
 implicit transid: TransactionId): Future[(ContentType, T)]
 
+  /**
+   * Deletes all attachments linked to given document
+   */
+  protected[core] def deleteAttachments[T](doc: DocInfo)(implicit transid: 
TransactionId): Future[Boolean]
+
   /** Shut it down. After this invocation, every other call is invalid. */
   def shutdown(): Unit
 }
diff --git 
a/common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala 
b/common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
index efc03cca85..d55db6505a 100644
--- a/common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
+++ b/common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
@@ -456,6 +456,11 @@ class CouchDbRestStore[DocumentAbstraction <: 
DocumentSerializer](dbProtocol: St
   ErrorLevel))
   }
 
+  override protected[core] def deleteAttachments[T](doc: DocInfo)(implicit 
transid: TransactionId): Future[Boolean] =
+// NOTE: this method is not intended for standalone use for CouchDB.
+// To delete attachments, it is expected that the entire document is 
deleted.
+Future.successful(true)
+
   override def shutdown(): Unit = {
 Await.ready(client.shutdown(), 1.minute)
   }
diff --git 
a/common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala 
b/common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala
index 59e04879fb..b6e346ba4b 100644
--- a/common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala
+++ b/common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala
@@ -227,4 +227,18 @@ trait DocumentFactory[W <: DocumentRevisionProvider] 
extends MultipleReadersSing
   case Failure(t) => Future.failed(t)
 }
   }
+
+  def deleteAttachments[Wsuper >: W](db: ArtifactStore[Wsuper], doc: DocInfo)(
+implicit transid: TransactionId): Future[Boolean] = {
+Try {
+  require(db != null, "db defined")
+  require(doc != null, "doc undefined")
+} map { _ =>
+  implicit val ec = db.executionContext
+  db.deleteAttachments(doc)
+} match {
+  case Success(f) => f
+  case Failure(t) => Future.failed(t)
+}
+  }
 }
diff --git a/common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala 
b/common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
index 92b7db3231..07b9efeb94 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
@@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 }
   }
 
+  override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: 
DocInfo)(
+implicit transid: TransactionId,
+notifier: Option[CacheChangeNotification]): Future[Boolean] = {
+Try {
+  require(db != null, "db undefined")
+  require(doc != null, "doc undefined")
+}.map { _ =>
+  val fa = super.del(db, doc)
+  implicit val ec = db.executionContext
+  fa.flatMap { _ =>
+super.deleteAttachments(db, doc)
+  }
+} match {
+  case Success(f) => f
+  case Failure(f) => Future.failed(f)
+}
+  }
+
   /**
* Resolves an action name if it is contained in a package.
* Look up the package to determine if it is a binding or the actual package.
diff --git a/tests/build.gradle b/tests/build.gradle
index 9d68ed2c6d..70eaa309c2 100644
--- a/tests/build.gradle
+++ b/tests/build.gradle
@@ -66,7 +66,8 @@ dependencies {
 compile 'org.scalamock:scalamock-scalatest-support_2.11:3.4.2'
 compile 'com.typesafe.akka:akka-testkit_2.11:2.4.16'
 compile 'com.typesafe.akka:akka-http-testkit_2.11:10.0.10'
-compile 'com.github.java-json-tools:json-schema-validator:2.2.8';
+compile 'com.github.java-json-tools:json-schema-validator:2.2.8'
+compile "org.mockito:mockito-core:2.15.0"
 
 compile project(':common:scala')
 compile project(':core:controller')
diff --git a/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala 
b/tests/src/test/scala/whisk/core/entity/t

[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3366: Adds method 
deleteAttachments to ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172620716
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 }
   }
 
+  override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: 
DocInfo)(
+implicit transid: TransactionId,
+notifier: Option[CacheChangeNotification]): Future[Boolean] = {
+Try {
+  require(db != null, "db undefined")
+  require(doc != null, "doc undefined")
+}.map { _ =>
+  val fa = super.del(db, doc)
+  implicit val ec = db.executionContext
+  fa.flatMap { _ =>
+super.deleteAttachments(db, doc)
 
 Review comment:
   as a future enhancement this could be done only when there is an attachment 
present and this code possibly merged into the document factory instead.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on issue #3366: Adds method deleteAttachments to ArtifactStore

2018-03-06 Thread GitBox
rabbah commented on issue #3366: Adds method deleteAttachments to ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3366#issuecomment-370886240
 
 
   PG1/2682 is ok.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai opened a new issue #770: Doc - Env. Variable Interpolation in JSON Inputs

2018-03-06 Thread GitBox
pritidesai opened a new issue #770: Doc - Env. Variable Interpolation in JSON 
Inputs
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/770
 
 
   With a recent PR #766, we are adding support to interpolate input values 
using env. variables such that:
   
   ```
   os.SetEnv("USERNAME", "MY_USERNAME")
   os.SetEnv("PASSWORD", "MY_PASSWORD")
   ```
   
   manifest.yaml:
   
   ```
   inputs:
  type: json
  GitHub_credentials: {
username: ${USERNAME},
password: ${PASSWORD}
  }
   ```
   
   Action is composed with `username` set to `MY_USERNAME ` and `password` set 
to `MY_PASSWORD`.
   
   With manifest.yaml:
   
   ```
   inputs:
  type: json
  GitHub_credentials: {
username: $${USERNAME},
password: $${PASSWORD}
  }
   ```
   
   Action is composed with `username` set to `${USERNAME} ` and `password` set 
to `${PASSWORD}` escaping interpolation with double dollar sign, following 
terraform syntax at 
https://www.terraform.io/docs/configuration/interpolation.html.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] pritidesai opened a new issue #769: Update Spec - Env. Variable Interpolation in JSON Inputs

2018-03-06 Thread GitBox
pritidesai opened a new issue #769: Update Spec - Env. Variable Interpolation 
in JSON Inputs
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/769
 
 
   With a recent PR #766, we are adding support to interpolate input values 
with env. variables such that:
   
   ```
   os.SetEnv("USERNAME", "MY_USERNAME")
   os.SetEnv("PASSWORD", "MY_PASSWORD")
   ```
   
   manifest.yaml:
   
   ```
   inputs:
  type: json
  GitHub_credentials: {
username: ${USERNAME},
password: ${PASSWORD}
  }
   ```
   
   Action is composed with `username` set to `MY_USERNAME ` and `password` set 
to `MY_PASSWORD`.
   
   With manifest.yaml:
   
   ```
   inputs:
  type: json
  GitHub_credentials: {
username: $${USERNAME},
password: $${PASSWORD}
  }
   ```
   
   Action is composed with `username` set to `${USERNAME} ` and `password` set 
to `${PASSWORD}` escaping interpolation with double dollar sign, following 
terraform syntax at 
https://www.terraform.io/docs/configuration/interpolation.html.
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes opened a new pull request #3400: Use ShardingContainerPoolBalancer as the default.

2018-03-06 Thread GitBox
markusthoemmes opened a new pull request #3400: Use 
ShardingContainerPoolBalancer as the default.
URL: https://github.com/apache/incubator-openwhisk/pull/3400
 
 
   
   
   ## Description
   As proposed on the dev-list, this switches the default loadbalancer to be 
the sharding implementation.
   
   ## Related issue and scope
   
   - ~~[ ] I opened an issue to propose and discuss this change (#)~~
   
   ## My changes affect the following components
   
   
   - [ ] API
   - [X] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [X] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   
   - [ ] Bug fix (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [X] Breaking change (a bug fix or enhancement which changes existing 
behavior).
   
   ## Checklist:
   
   
   - [X] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [X] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   - ~~[ ] I added tests to cover my changes.~~
   - ~~[ ] My changes require further changes to the documentation.~~
   - ~~[ ] I updated the documentation where necessary.~~
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] duynguyen commented on issue #2: Add DC/OS universe for OpenWhisk and orchestration scripts

2018-03-06 Thread GitBox
duynguyen commented on issue #2: Add DC/OS universe for OpenWhisk and 
orchestration scripts
URL: 
https://github.com/apache/incubator-openwhisk-deploy-mesos/pull/2#issuecomment-370863417
 
 
   @ddragosd wdyt?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
mdeuser commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172507692
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -313,6 +313,9 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 
   override val cacheEnabled = true
 
+  val requireWhiskAuthAnnotation = "require-whisk-auth"
 
 Review comment:
   since a web action is actually a "kind" of `WhiskAction`, and since the 
annotation is set within the context of an action create/update, imho it makes 
sense to define all action annotation constants as part of `WhiskAction`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] duynguyen opened a new pull request #2: Add DC/OS universe for OpenWhisk and orchestration scripts

2018-03-06 Thread GitBox
duynguyen opened a new pull request #2: Add DC/OS universe for OpenWhisk and 
orchestration scripts
URL: https://github.com/apache/incubator-openwhisk-deploy-mesos/pull/2
 
 
   The universe contains packages for:
   * API Gateway
   * CouchDB
   * OpenWhisk controller
   * OpenWhisk invoker


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] duynguyen commented on issue #1: Set up project skeleton

2018-03-06 Thread GitBox
duynguyen commented on issue #1: Set up project skeleton
URL: 
https://github.com/apache/incubator-openwhisk-deploy-mesos/pull/1#issuecomment-370861866
 
 
   @ddragosd is it enough for the project structure?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
dubeejw commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370854911
 
 
   https://github.com/apache/incubator-openwhisk/pull/3399


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
dubeejw commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370854911
 
 
   Trying https://github.com/apache/incubator-openwhisk/pull/3399.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw closed pull request #3399: WIP: CLI deployment failure due to permissions

2018-03-06 Thread GitBox
dubeejw closed pull request #3399: WIP: CLI deployment failure due to 
permissions
URL: https://github.com/apache/incubator-openwhisk/pull/3399
 
 
   

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/ansible/roles/cli/tasks/deploy.yml 
b/ansible/roles/cli/tasks/deploy.yml
index 8591263681..b2c51d1604 100644
--- a/ansible/roles/cli/tasks/deploy.yml
+++ b/ansible/roles/cli/tasks/deploy.yml
@@ -14,6 +14,7 @@
   file:
 path: "{{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}"
 state: directory
+mode: 0777
 
 #
 #  Why are we unarchiving into the build directory instead of directly into


 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
dubeejw commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370853787
 
 
   ```
   TASK [Gathering Facts] 
*
[WARNING]: Consider using unarchive module rather than running tar
   fatal: [172.17.0.1]: FAILED! => {"changed": true, "cmd": "tar zxf 
//home/travis/build/apache/incubator-openwhisk/ansible/../build/OpenWhisk_CLI.tgz
 -C 
/home/travis/build/apache/incubator-openwhisk/ansible/../build/OpenWhisk_CLI/", 
"delta": "0:00:00.419340", "end": "2018-03-06 16:41:41.286657", "failed": true, 
"rc": 2, "start": "2018-03-06 16:41:40.867317", "stderr": "tar: .: Cannot 
utime: Operation not permitted\ntar: .: Cannot change mode to rwxr-xr-x: 
Operation not permitted\ntar: Exiting with failure status due to previous 
errors", "stderr_lines": ["tar: .: Cannot utime: Operation not permitted", 
"tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted", "tar: 
Exiting with failure status due to previous errors"], "stdout": "", 
"stdout_lines": []}
   
   [FAILED]
   > tar zxf 
//home/travis/build/apache/incubator-openwhisk/ansible/../build/OpenWhisk_CLI.tgz
 -C 
/home/travis/build/apache/incubator-openwhisk/ansible/../build/OpenWhisk_CLI/
   tar: .: Cannot utime: Operation not permitted tar: .: Cannot change 
mode to
   rwxr-xr-x: Operation not permitted tar: Exiting with failure status due to
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dubeejw commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
dubeejw commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370853396
 
 
   Travis keeps failing here.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser opened a new pull request #3399: WIP: CLI deployment failure due to permissions

2018-03-06 Thread GitBox
mdeuser opened a new pull request #3399: WIP: CLI deployment failure due to 
permissions
URL: https://github.com/apache/incubator-openwhisk/pull/3399
 
 
   
   
   ## Description
   Update cli role .yml
   Local testing via vagrant VM
   Travis testing
   
   ## My changes affect the following components
   
   
   - [ ] API
   - [ ] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [x] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   
   - [x] Bug fix (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing 
behavior).
   
   ## Checklist:
   
   
   - [x] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [ ] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   - [ ] I added tests to cover my changes.
   - [ ] My changes require further changes to the documentation.
   - [ ] I updated the documentation where necessary.
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kameshsampath commented on issue #24: AdoptOpenJDK Eclipse OpenJ9 as alternative Java runtime

2018-03-06 Thread GitBox
kameshsampath commented on issue #24: AdoptOpenJDK Eclipse OpenJ9 as 
alternative Java runtime
URL: 
https://github.com/apache/incubator-openwhisk-runtime-java/pull/24#issuecomment-370836429
 
 
   @Param-S @csantanapr check this 
https://github.com/kameshsampath/adoptopenjdk , I have made the docker images 
temptable which right now builds JDK8/JDK9 for Centos/Debian using AdoptOpenJDK 
builds for both hotspot/openj9. This should reduce our maintenance much easier. 
WDYT?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kameshsampath commented on issue #18: Rebase OW JavaRuntime to use OpenJDK 8

2018-03-06 Thread GitBox
kameshsampath commented on issue #18: Rebase OW JavaRuntime to use OpenJDK 8
URL: 
https://github.com/apache/incubator-openwhisk-runtime-java/issues/18#issuecomment-370833566
 
 
   @csantanapr https://github.com/kameshsampath/adoptopenjdk check that project 
that has the AdoptOpenJDK based jdk8/jdk9 images for both centos/debian.  
Wondering if we can move it under OW github repo 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] cbickel commented on issue #3391: Add namespace-blacklist to invoker.

2018-03-06 Thread GitBox
cbickel commented on issue #3391: Add namespace-blacklist to invoker.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3391#issuecomment-370832230
 
 
   PG5#140 is OK.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on issue #3369: Use pureconfig for CouchDbRestStore

2018-03-06 Thread GitBox
markusthoemmes commented on issue #3369: Use pureconfig for CouchDbRestStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3369#issuecomment-370818611
 
 
   @chetanmeh I'll fix the conflicts.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172546821
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -313,6 +313,9 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 
   override val cacheEnabled = true
 
+  val requireWhiskAuthAnnotation = "require-whisk-auth"
 
 Review comment:
   I also suggested below that we should instead consolidate all the 
annotations into a singleton - they're scattered right now. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3369: Use pureconfig for CouchDbRestStore

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3369: Use pureconfig for 
CouchDbRestStore
URL: 
https://github.com/apache/incubator-openwhisk/pull/3369#discussion_r172544358
 
 

 ##
 File path: 
common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
 ##
 @@ -36,21 +47,18 @@ object CouchDbStoreProvider extends ArtifactStoreProvider {
 actorSystem: ActorSystem,
 logging: Logging,
 materializer: ActorMaterializer): ArtifactStore[D] = {
-require(config != null && config.isValid, "config is undefined or not 
valid")
+val dbConfig = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
 require(
-  config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB",
-  "Unsupported db.provider: " + config.dbProvider)
-assume(
-  Set(config.dbProtocol, config.dbHost, config.dbPort, config.dbUsername, 
config.dbPassword, name(config))
-.forall(_.nonEmpty),
-  "At least one expected property is missing")
+  dbConfig.provider == "Cloudant" || dbConfig.provider == "CouchDB",
+  s"Unsupported db.provider: ${dbConfig.provider}")
 
 Review comment:
   This is vestigial at this point and can be removed in separate PR.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] RSulzmann commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
RSulzmann commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370804629
 
 
   Observations:
   Temporary directories ?quivalent to the local {{openwhisk_build_dir}} were 
created on the remote server but not deleted after the deployment. 
   Why using {{openwhisk_build_dir}} as temp directory ? 
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] davglass commented on issue #2220: Ansible error while deploying to distributed environment

2018-03-06 Thread GitBox
davglass commented on issue #2220: Ansible error while deploying to distributed 
environment
URL: 
https://github.com/apache/incubator-openwhisk/issues/2220#issuecomment-370803021
 
 
   I'm having a similar error, I wrestled with it all day yesterday and still 
can't figure out the issue. I have a raw OpenStack Ocata deployment with a 
single boot strapper node that I am executing the ansible commands from. I'm 
currently running from the `master` branch. I have a single deployment that 
worked perfect. My next test was to use OpenStack to deploy a scalable 
distributed system. 
   
   The error I get when I run `ansible-playbook -i environments/distributed 
provision_env_dist.yml` is:
   
   ```
   TASK [set vars] 
**
   Tuesday 06 March 2018  14:37:45 + (0:00:00.045)   0:00:01.693 
* 
   fatal: [ansible]: FAILED! => {"failed": true, "msg": "the field 'args' has 
an invalid value, which appears to include a variable that is undefined. The 
error was:
'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 
'name'\n\nThe error appears to have been in 
'/home/ubuntu/openwhisk/ansible/boot_instances_dist.yml': line 4, column 3, but 
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n# TODO, in \"with_instance\" loops, the 
\"instance\" variable that is passed in gets unset, look up the proper way to 
do nested loops\n- name: set vars\n  ^ here\n"}
   ```
   
   Full error output here: 
https://gist.github.com/davglass/77b5079a65abde6416095d5db5699212
   
   Any help would be very appreciated, thanks!


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on a change in pull request #3394: fix deploy.yml

2018-03-06 Thread GitBox
markusthoemmes commented on a change in pull request #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#discussion_r172536083
 
 

 ##
 File path: ansible/roles/cli/tasks/deploy.yml
 ##
 @@ -48,10 +50,7 @@
 -C {{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/
 
 - name: "Copy expanded archive to final configuration directory"
-  copy:
-#  WARNING:  The trailing slash is significant, signalling to copy contents
-src: "{{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/"
-dest: "{{ openwhisk_cli.nginxdir.name }}"
+  shell: cp -r {{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/ {{ 
openwhisk_cli.nginxdir.name }}
 
 Review comment:
   This will not work. If this playbook is run on a remote machine. `copy` does 
work transparently from local to remote, a shell command won't.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on a change in pull request #3394: fix deploy.yml

2018-03-06 Thread GitBox
markusthoemmes commented on a change in pull request #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#discussion_r172536083
 
 

 ##
 File path: ansible/roles/cli/tasks/deploy.yml
 ##
 @@ -48,10 +50,7 @@
 -C {{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/
 
 - name: "Copy expanded archive to final configuration directory"
-  copy:
-#  WARNING:  The trailing slash is significant, signalling to copy contents
-src: "{{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/"
-dest: "{{ openwhisk_cli.nginxdir.name }}"
+  shell: cp -r {{ openwhisk_build_dir }}/{{ openwhisk_cli.archive_name }}/ {{ 
openwhisk_cli.nginxdir.name }}
 
 Review comment:
   This will not work. If this playbook is run on a remote machine. `copy` does 
work transparently from local to remote, a shell command won't.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
mdeuser commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172513170
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   provide(fullyQualifiedActionName(actionName)) { fullActionName =>
 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
   case Success((actionOwnerIdentity, action)) =>
-if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+// If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+//   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+// If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+val requireWhiskHeaderAuthenticationFailed = 
action.annotations
+  .get(WhiskAction.requireWhiskAuthAnnotation)
+  .flatMap {
+case JsString(authStr) => Some(authStr)
+case JsNumber(authNum) => Some(authNum.toInt.toString)
 
 Review comment:
   i just played a bit with the BigDecimal data type, and i think that `toInt` 
should be removed to support any json number, not just integers.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mdeuser commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
mdeuser commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172507692
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala
 ##
 @@ -313,6 +313,9 @@ object WhiskAction extends DocumentFactory[WhiskAction] 
with WhiskEntityQueries[
 
   override val cacheEnabled = true
 
+  val requireWhiskAuthAnnotation = "require-whisk-auth"
 
 Review comment:
   since a web action is actually a "kind" of `WhiskAction, and since the 
annotation is set within the context of an action create/update, imho it makes 
sense to define all action annotation constants as part of `WhiskAction`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah opened a new issue #3398: action container tests observed to fail often since change to use port mapping

2018-03-06 Thread GitBox
rabbah opened a new issue #3398: action container tests observed to fail often 
since change to use port mapping 
URL: https://github.com/apache/incubator-openwhisk/issues/3398
 
 
   The change I made in #3335 replaced docker inspect with port forwarding. I 
also added a brute sleep to deal with connection issue. This was not stable in 
Jenkins builds. The errors appear to fall in the following category and affect 
more than one test when it occurs.
   
   ```
   java.lang.IllegalStateException: Connection reset
at whisk.core.containerpool.HttpUtils$.post(HttpUtils.scala:154)
   ```
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah opened a new pull request #3397: Partially revert change to route all action proxy tests through port mapping

2018-03-06 Thread GitBox
rabbah opened a new pull request #3397: Partially revert change to route all 
action proxy tests through port mapping
URL: https://github.com/apache/incubator-openwhisk/pull/3397
 
 
   The change I made in #3335 perhaps not surprisingly has been observed to 
fail a few times with Connection Reset errors. This change partially reverts 
the commit, restricting the use of port mapping only when running tests on 
MacOSX.
   
   
   
   ## Description
   
   
   I restored the previous behavior for now of using docker inspect, except 
when running on MacOSX.
   
   ## Related issue and scope
   
   - [ ] I opened an issue to propose and discuss this change (#)
   
   ## My changes affect the following components
   
   
   - [ ] API
   - [ ] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [x] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   
   - [x] Bug fix (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing 
behavior).
   
   ## Checklist:
   
   
   - [x] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [x] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   - ~[ ] I added tests to cover my changes.~
   - ~[ ] My changes require further changes to the documentation.~
   - ~[ ] I updated the documentation where necessary.~
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172499506
 
 

 ##
 File path: docs/annotations.md
 ##
 @@ -48,7 +48,7 @@ and must be present and explicitly set to `true` to have an 
affect. The annotati
 * `final`: Makes all of the action parameters that are already defined 
immutable. A parameter of an action carrying the annotation may not be 
overridden by invoke-time parameters once the parameter has a value defined 
through its enclosing package or the action definition.
 * `raw-http`: When set, the HTTP request query and body parameters are passed 
to the action as reserved properties.
 * `web-custom-options`: When set, this annotation enables a web action to 
respond to OPTIONS requests with customized headers, otherwise a [default CORS 
response](webactions.md#options-requests) applies.
-* `require-whisk-auth`: This annotation protects the web action so that it is 
only accessible to an authenticated subject. It is important to note that the 
_owner_ of the web action will still incur the cost of running them in the 
system (i.e., the _owner_ of the action also owns the activations record).
+* `require-whisk-auth`: This annotation protects the web action so that it is 
only invoked by requests that provide appropriate authentication credentials. 
When set to a boolean value, it controls whether or not the request's Basic 
Authentication subject will be authenticated - a value of `true` will 
authenticate the subject, a value of `false` will invoke the action without any 
authentication. When set to an integer or a string, this value must match the 
request's `X-Require-Whisk-Auth` header value. In both cases, it is important 
to note that the _owner_ of the web action will still incur the cost of running 
them in the system (i.e., the _owner_ of the action also owns the activations 
record).
 
 Review comment:
   can you further elaborate that the basic auth credentials would be valid 
WHISK API keys.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172500051
 
 

 ##
 File path: 
tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
 ##
 @@ -379,21 +386,51 @@ trait WebActionsApiBaseTests extends 
ControllerTestCommon with BeforeAndAfterEac
 
   Seq(s"$systemId/proxy/export_auth").foreach { path =>
 allowedMethods.foreach { m =>
-  if (creds.isDefined)
-invocationsAllowed += 1
   requireAuthentication = true
+  Seq(true, false).foreach { useReqWhiskAuthBool =>
+requireAuthenticationAsBoolean = useReqWhiskAuthBool
+  }
 
-  m(s"$testRoutePath/${path}.json") ~> Route.seal(routes(creds)) ~> 
check {
-creds match {
-  case None => status should be(Unauthorized)
-  case Some(user) =>
+  if (requireAuthenticationAsBoolean) {
+if (creds.isDefined) {
+  val user = creds.get
+  invocationsAllowed += 1
+  m(s"$testRoutePath/${path}.json") ~> Route
+.seal(routes(creds)) ~> check {
 status should be(OK)
 val response = responseAs[JsObject]
 response shouldBe JsObject(
   "pkg" -> s"$systemId/proxy".toJson,
   "action" -> "export_auth".toJson,
   "content" -> metaPayload(m.method.name.toLowerCase, 
JsObject(), creds, pkgName = "proxy"))
 
response.fields("content").asJsObject.fields(webApiDirectives.namespace) 
shouldBe user.namespace.toJson
+  }
+} else {
+  m(s"$testRoutePath/${path}.json") ~> Route.seal(routes(creds)) 
~> check {
+status should be(Unauthorized)
+  }
+}
+  } else if (creds.isDefined) {
+val user = creds.get
+invocationsAllowed += 1
+m(s"$testRoutePath/${path}.json") ~> 
addHeader("X-Require-Whisk-Auth", requireAuthenticationKey) ~> Route
+  .seal(routes(creds)) ~> check {
+  status should be(OK)
+  val response = responseAs[JsObject]
+  response shouldBe JsObject(
+"pkg" -> s"$systemId/proxy".toJson,
+"action" -> "export_auth".toJson,
+"content" -> metaPayload(
+  m.method.name.toLowerCase,
+  JsObject(),
+  creds,
+  pkgName = "proxy",
+  headers = List(RawHeader("X-Require-Whisk-Auth", 
requireAuthenticationKey
+  
response.fields("content").asJsObject.fields(webApiDirectives.namespace) 
shouldBe user.namespace.toJson
+}
+  } else {
+m(s"$testRoutePath/${path}.json") ~> Route.seal(routes(creds)) ~> 
check {
 
 Review comment:
   can you add the expected header but with the wrong value as well.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172499869
 
 

 ##
 File path: 
tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
 ##
 @@ -197,7 +200,9 @@ trait WebActionsApiBaseTests extends ControllerTestCommon 
with BeforeAndAfterEac
   annotations ++
 Parameters("web-export", JsBoolean(true)) ++ {
 if (requireAuthentication) {
-  Parameters("require-whisk-auth", JsBoolean(true))
+  Parameters(
+"require-whisk-auth",
 
 Review comment:
   we should probably start pulling all the annotations to an Annotations 
singleton.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172498719
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   provide(fullyQualifiedActionName(actionName)) { fullActionName =>
 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
   case Success((actionOwnerIdentity, action)) =>
-if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+// If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+//   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+// If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+val requireWhiskHeaderAuthenticationFailed = 
action.annotations
+  .get(WhiskAction.requireWhiskAuthAnnotation)
+  .flatMap {
+case JsString(authStr) => Some(authStr)
+case JsNumber(authNum) => Some(authNum.toInt.toString)
 
 Review comment:
   
   
   do you need .toInt?
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172499335
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -719,7 +741,8 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   private def confirmExportedAction(actionLookup: Future[WhiskActionMetaData], 
authenticated: Boolean)(
 implicit transid: TransactionId): Future[WhiskActionMetaData] = {
 actionLookup flatMap { action =>
-  val requiresAuthenticatedUser = 
action.annotations.getAs[Boolean]("require-whisk-auth").exists(identity)
+  val requiresAuthenticatedUser =
+
action.annotations.getAs[Boolean](WhiskAction.requireWhiskAuthAnnotation).exists(identity)
 
 Review comment:
   I was thinking... not sure if it works... to make the auth check a truthy, 
so that then you can consolidate the authentication failure. The 
`authenticated` bit could be computed by the earlier check of the header (or 
the whisk key as done now).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172498942
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   provide(fullyQualifiedActionName(actionName)) { fullActionName =>
 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
   case Success((actionOwnerIdentity, action)) =>
-if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+// If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+//   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+// If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+val requireWhiskHeaderAuthenticationFailed = 
action.annotations
 
 Review comment:
   can you refactor the handing of the auth string to a new method?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172498687
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   provide(fullyQualifiedActionName(actionName)) { fullActionName =>
 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
   case Success((actionOwnerIdentity, action)) =>
-if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+// If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+//   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+// If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+val requireWhiskHeaderAuthenticationFailed = 
action.annotations
+  .get(WhiskAction.requireWhiskAuthAnnotation)
+  .flatMap {
+case JsString(authStr) => Some(authStr)
+case JsNumber(authNum) => Some(authNum.toInt.toString)
 
 Review comment:
   do you need .toInt?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3388: Update require-whisk-auth behavior to secure web action

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172498687
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
   provide(fullyQualifiedActionName(actionName)) { fullActionName =>
 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
   case Success((actionOwnerIdentity, action)) =>
-if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+// If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+//   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+// If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+val requireWhiskHeaderAuthenticationFailed = 
action.annotations
+  .get(WhiskAction.requireWhiskAuthAnnotation)
+  .flatMap {
+case JsString(authStr) => Some(authStr)
+case JsNumber(authNum) => Some(authNum.toInt.toString)
 
 Review comment:
   do you need .toInt?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dgrove-oss commented on issue #3378: LogStoreProvider using invokerAgent for KubernetesContainerPool

2018-03-06 Thread GitBox
dgrove-oss commented on issue #3378: LogStoreProvider using invokerAgent for 
KubernetesContainerPool
URL: 
https://github.com/apache/incubator-openwhisk/pull/3378#issuecomment-370764054
 
 
   PG4 / 1440 ? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes opened a new pull request #3396: Self-generate random strings without going through a UUID.

2018-03-06 Thread GitBox
markusthoemmes opened a new pull request #3396: Self-generate random strings 
without going through a UUID.
URL: https://github.com/apache/incubator-openwhisk/pull/3396
 
 
   ## Description
   
   ActivationIDs are generated via UUID.randomUUID() today. Looking through the 
code of that you'll notice that it only generates a random hexadecimal String, 
delimited with dashes. We then proceed to cut out the dashes to end up at our 
ActivationId format.
   
   We can straight up jump to generate the String ourselves. This even has the 
added benefit of adding more entropy to that String, because the UUID contains 
some bytes to determine its version (which are fixed bytes).
   
   
   ## Related issue and scope
   
   - [ ] I opened an issue to propose and discuss this change (#3395)
   
   ## My changes affect the following components
   
   
   - [ ] API
   - [X] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   
   - [X] "Bug fix" (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing 
behavior).
   
   ## Checklist:
   
   
   - [X] I signed an [Apache 
CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [X] I reviewed the [style 
guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness)
 and followed the recommendations (Travis CI will check :).
   - [X] ~~I added tests to cover my changes.~~ (Not necessary as caught by 
existing tests)
   - [X] ~~My changes require further changes to the documentation.~~
   - [X] I updated the documentation where necessary.
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes opened a new issue #3395: Generate ActivationId string directly without going through UUID.

2018-03-06 Thread GitBox
markusthoemmes opened a new issue #3395: Generate ActivationId string directly 
without going through UUID.
URL: https://github.com/apache/incubator-openwhisk/issues/3395
 
 
   ActivationIDs are generated via UUID.randomUUID() today. Looking through the 
code of that you'll notice that it only generates a random hexadecimal String, 
delimited with dashes. We then proceed to cut out the dashes to end up at our 
ActivationId format.
   
   We can straight up jump to generate the String ourselves. This even has the 
added benefit of adding more entropy to that String, because the UUID contains 
some bytes to determine its version (which are fixed bytes).
   
   There are even libraries out there which make UUID serdes as fast as 
possible because it's seemingly slow and generates lots of garbage 
(https://github.com/jchambers/fast-uuid).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3211: implement ContainerFactory.cpuShare to fix #3110

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3211: implement 
ContainerFactory.cpuShare to fix #3110
URL: 
https://github.com/apache/incubator-openwhisk/pull/3211#discussion_r172493830
 
 

 ##
 File path: core/invoker/src/main/resources/application.conf
 ##
 @@ -39,7 +49,6 @@ whisk {
   container-factory.container-args {
 network: bridge
 dns-servers: []
-extra-args: {}
-
+extra-args: {}   # to pass additional args to 'docker run'; format is 
`{key1: [v1, v2], key2: [v1, v2]`
 
 Review comment:
   closing `}` missing in comment; does the value have to be an array?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3211: implement ContainerFactory.cpuShare to fix #3110

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3211: implement 
ContainerFactory.cpuShare to fix #3110
URL: 
https://github.com/apache/incubator-openwhisk/pull/3211#discussion_r172494186
 
 

 ##
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainerFactory.scala
 ##
 @@ -67,13 +69,13 @@ class DockerContainerFactory(config: WhiskConfig,
   image = image,
   userProvidedImage = userProvidedImage,
   memory = memory,
-  cpuShares = config.invokerCoreShare.toInt,
+  cpuShares = cpuShares,
   environment = Map("__OW_API_HOST" -> config.wskApiHost),
-  network = containerArgs.network,
-  dnsServers = containerArgs.dnsServers,
+  network = containerArgsConfig.network,
+  dnsServers = containerArgsConfig.dnsServers,
   name = Some(name),
-  useRunc = config.invokerUseRunc,
-  parameters ++ containerArgs.extraArgs)
+  useRunc = dockerContainerFactoryConfig.useRunc,
+  parameters ++ containerArgsConfig.extraArgs.map { case (k, v) => ("--" + 
k, v) })
 
 Review comment:
   `v` here is an an array of strings e.g. `[v1, v2]`per the comment above; is 
that what's intended here?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3211: implement ContainerFactory.cpuShare to fix #3110

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3211: implement 
ContainerFactory.cpuShare to fix #3110
URL: 
https://github.com/apache/incubator-openwhisk/pull/3211#discussion_r172495016
 
 

 ##
 File path: 
tests/src/test/scala/whisk/core/containerpool/test/ContainerArgsConfigTest.scala
 ##
 @@ -52,7 +52,7 @@ class ContainerArgsConfigTest extends FlatSpec with Matchers 
{
 config.dnsServers shouldBe Seq[String]("google.com", "1.2.3.4")
 //check map parsing of extra-args config
 config.extraArgs.get("label") shouldBe Some(Set("l1", "l2", "l3"))
-config.extraArgs.get("environment") shouldBe Some(Set("e1", "e2"))
+config.extraArgs.get("env") shouldBe Some(Set("e1", "e2"))
 
 Review comment:
   i suggest a test for extra args following the comment above, or fix the 
comment.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah commented on a change in pull request #3211: implement ContainerFactory.cpuShare to fix #3110

2018-03-06 Thread GitBox
rabbah commented on a change in pull request #3211: implement 
ContainerFactory.cpuShare to fix #3110
URL: 
https://github.com/apache/incubator-openwhisk/pull/3211#discussion_r172494890
 
 

 ##
 File path: 
tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
 ##
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.containerpool.docker.test
+
+import common.StreamLogging
+import common.TimingHelpers
+import common.WskActorSystem
+import org.scalamock.scalatest.MockFactory
+import org.scalatest.BeforeAndAfterEach
+import org.scalatest.FlatSpec
+import org.scalatest.Matchers
+import scala.concurrent.Await
+import scala.concurrent.Future
+import scala.concurrent.duration._
+import whisk.common.TransactionId
+import whisk.core.WhiskConfig
+import whisk.core.WhiskConfig._
+import whisk.core.containerpool.ContainerAddress
+import whisk.core.containerpool.ContainerArgsConfig
+import whisk.core.containerpool.ContainerId
+import whisk.core.containerpool.docker.DockerApiWithFileAccess
+import whisk.core.containerpool.docker.DockerContainerFactory
+import whisk.core.containerpool.docker.RuncApi
+import whisk.core.entity.InstanceId
+import whisk.core.entity.size._
+import whisk.core.entity.test.ExecHelpers
+class DockerContainerFactoryTests
+extends FlatSpec
+with Matchers
+with MockFactory
+with StreamLogging
+with BeforeAndAfterEach
+with WskActorSystem
+with TimingHelpers
+with ExecHelpers {
+
+  implicit val wskConfig = new WhiskConfig(Map(dockerImagePrefix -> null, 
dockerImageTag -> null))
+
+  behavior of "DockerContainerFactory"
+
+  it should "calculate cpu-share based on invoker config" in {
+
+implicit val tid = TransactionId(0)
+val dockerApiStub = mock[DockerApiWithFileAccess]
+//setup run expectation
+(dockerApiStub
+  .run(_: String, _: Seq[String])(_: TransactionId))
+  .expects(
+"whisk/nodejs6action:latest",
+Seq(
+  "--cpu-shares",
+  "32", //should be calculated as 1024/(numcore * sharefactor) via 
ContainerFactory.cpuShare
+  "--memory",
+  "10m",
+  "--memory-swap",
+  "10m",
+  "--network",
+  "net1",
+  "-e",
+  "__OW_API_HOST=://:",
+  "--dns",
+  "dns1",
+  "--dns",
+  "dns2",
+  "--name",
+  "testContainer",
+  "--env",
+  "e1",
+  "--env",
+  "e2"),
+*)
+  .returning(Future.successful { ContainerId("fakecontainerid") })
+//setup inspect expectation
+(dockerApiStub
+  .inspectIPAddress(_: ContainerId, _: String)(_: TransactionId))
+  .expects(ContainerId("fakecontainerid"), "net1", *)
+  .returning(Future.successful { ContainerAddress("1.2.3.4", 1234) })
+//setup rm expectation
+(dockerApiStub
+  .rm(_: ContainerId)(_: TransactionId))
+  .expects(ContainerId("fakecontainerid"), *)
+  .returning(Future.successful(Unit))
 
 Review comment:
   hmm if the test is just to validate the cpu share, this seems like over 
engineering of the test (could you have tested just the config class itself in 
contrast for example?).
   
   i'm ok keeping the test as is but the test name/comment struck me relative 
to the actual code.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rabbah closed pull request #3371: Make AuthKey parsing leaner.

2018-03-06 Thread GitBox
rabbah closed pull request #3371: Make AuthKey parsing leaner.
URL: https://github.com/apache/incubator-openwhisk/pull/3371
 
 
   

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/common/scala/src/main/scala/whisk/core/entity/AuthKey.scala 
b/common/scala/src/main/scala/whisk/core/entity/AuthKey.scala
index 55aa96beb8..bd1a24c9f3 100644
--- a/common/scala/src/main/scala/whisk/core/entity/AuthKey.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/AuthKey.scala
@@ -17,12 +17,8 @@
 
 package whisk.core.entity
 
-import scala.util.Try
-
-import spray.json.JsString
-import spray.json.JsValue
-import spray.json.RootJsonFormat
-import spray.json.deserializationError
+import spray.json._
+import spray.json.DefaultJsonProtocol._
 
 /**
  * Authentication key, consisting of a UUID and Secret.
@@ -31,14 +27,14 @@ import spray.json.deserializationError
  * The constructor is private so that argument requirements are checked and 
normalized
  * before creating a new instance.
  *
- * @param (uuid, key) the uuid and key, assured to be non-null because both 
types are values
+ * @param k (uuid, key) the uuid and key, assured to be non-null because both 
types are values
  */
 protected[core] class AuthKey private (private val k: (UUID, Secret)) extends 
AnyVal {
-  def uuid = k._1
-  def key = k._2
+  def uuid: UUID = k._1
+  def key: Secret = k._2
   def revoke = new AuthKey(uuid, Secret())
-  def compact = s"$uuid:$key"
-  override def toString = uuid.toString
+  def compact: String = s"$uuid:$key"
+  override def toString: String = uuid.toString
 }
 
 protected[core] object AuthKey {
@@ -64,37 +60,22 @@ protected[core] object AuthKey {
* the first two hence "k:v*" produces ("k","v").
*
* @param str the string containing uuid and key separated by colon
-   * @return AuthKey if argument is properly formated
+   * @return AuthKey if argument is properly formatted
* @throws IllegalArgumentException if argument is not well formed
*/
   @throws[IllegalArgumentException]
   protected[core] def apply(str: String): AuthKey = {
-val (k, v) = split(str)
-new AuthKey(UUID(k), Secret(v))
-  }
+val (uuid, secret) = str.split(':').toList match {
+  case k :: v :: _ => (k, v)
+  case k :: Nil=> (k, "")
+  case Nil => ("", "")
+}
 
-  /**
-   * Makes a tuple from a string where the values are separated by a colon.
-   * If the string contains more than one colon, all values are ignored except 
for
-   * the first two hence "k:v*" produces the tuple ("k","v") and "::*" 
produces ("","").
-   *
-   * @param string to create pair from
-   * @return (key, value) where both are null, value is null, or neither is 
null
-   */
-  private def split(str: String): (String, String) = {
-val parts = if (str != null && str.nonEmpty) str.split(":") else 
Array[String]()
-val k = if (parts.size >= 1) parts(0).trim else null
-val v = if (parts.size == 2) parts(1).trim else null
-(k, v)
+new AuthKey(UUID(uuid.trim), Secret(secret.trim))
   }
 
-  protected[core] implicit val serdes = new RootJsonFormat[AuthKey] {
+  protected[core] implicit val serdes: RootJsonFormat[AuthKey] = new 
RootJsonFormat[AuthKey] {
 def write(k: AuthKey) = JsString(k.compact)
-
-def read(value: JsValue) =
-  Try {
-val JsString(s) = value
-AuthKey(s)
-  } getOrElse deserializationError("authorization key malformed")
+def read(value: JsValue) = AuthKey(value.convertTo[String])
   }
 }
diff --git a/common/scala/src/main/scala/whisk/core/entity/Secret.scala 
b/common/scala/src/main/scala/whisk/core/entity/Secret.scala
index db902ae7fc..aac4e7f7e8 100644
--- a/common/scala/src/main/scala/whisk/core/entity/Secret.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/Secret.scala
@@ -17,11 +17,8 @@
 
 package whisk.core.entity
 
-import scala.util.Try
-import spray.json.JsValue
-import spray.json.RootJsonFormat
-import spray.json.JsString
-import spray.json.deserializationError
+import spray.json._
+import spray.json.DefaultJsonProtocol._
 
 /**
  * Secret, a cryptographic string such as a key used for authentication.
@@ -33,12 +30,12 @@ import spray.json.deserializationError
  * @param key the secret key, required not null or empty
  */
 protected[core] class Secret private (val key: String) extends AnyVal {
-  protected[core] def asString = toString
-  protected[entity] def toJson = JsString(toString)
-  override def toString = key
+  protected[core] def asString: String = toString
+  protected[entity] def toJson: JsString = JsString(toString)
+  override def toString: String = key
 }
 
-protected[core] object Secret extends ArgNormalizer[Secret] {
+protected[core] object Secret {
 
   /** Minimum secret length */
   private

[GitHub] rabbah closed pull request #3362: Make ActivationId implementation leaner.

2018-03-06 Thread GitBox
rabbah closed pull request #3362: Make ActivationId implementation leaner.
URL: https://github.com/apache/incubator-openwhisk/pull/3362
 
 
   

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/common/scala/src/main/scala/whisk/core/entity/ActivationId.scala 
b/common/scala/src/main/scala/whisk/core/entity/ActivationId.scala
index 0a1cb25914..85c59beb7b 100644
--- a/common/scala/src/main/scala/whisk/core/entity/ActivationId.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/ActivationId.scala
@@ -17,18 +17,13 @@
 
 package whisk.core.entity
 
-import java.math.BigInteger
-
-import scala.language.postfixOps
-import scala.util.Failure
-import scala.util.Success
-import scala.util.Try
-
 import spray.json.DefaultJsonProtocol.StringJsonFormat
 import spray.json._
+import whisk.http.Messages
 
 import whisk.core.entity.size._
-import whisk.http.Messages
+
+import scala.util.{Failure, Success, Try}
 
 /**
  * An activation id, is a unique id assigned to activations (invoke action or 
fire trigger).
@@ -38,97 +33,64 @@ import whisk.http.Messages
  * The constructor is private so that argument requirements are checked and 
normalized
  * before creating a new instance.
  *
- * @param id the activation id, required not null
+ * @param asString the activation id
  */
-protected[whisk] class ActivationId private (private val id: java.util.UUID) 
extends AnyVal {
-  def asString = toString
-  override def toString = id.toString.replaceAll("-", "")
-  def toJsObject = JsObject("activationId" -> toString.toJson)
+protected[whisk] class ActivationId private (val asString: String) extends 
AnyVal {
+  override def toString: String = asString
+  def toJsObject: JsObject = JsObject("activationId" -> asString.toJson)
 }
 
-protected[core] object ActivationId extends ArgNormalizer[ActivationId] {
+protected[core] object ActivationId {
 
   protected[core] trait ActivationIdGenerator {
-def make(): ActivationId = new ActivationId(UUIDs.randomUUID())
+def make(): ActivationId = ActivationId.generate()
   }
 
-  /**
-   * Unapply method for convenience of case matching.
-   */
-  protected[core] def unapply(name: String): Option[ActivationId] = {
-Try { ActivationId(name) } toOption
-  }
+  /** Checks if the current character is hexadecimal */
+  private def isHexadecimal(c: Char) = c.isDigit || c == 'a' || c == 'b' || c 
== 'c' || c == 'd' || c == 'e' || c == 'f'
 
   /**
-   * Creates an activation id from a java.util.UUID.
+   * Parses an activation id from a string.
*
-   * @param uuid the activation id as UUID
+   * @param id the activation id as string
* @return ActivationId instance
-   * @throws IllegalArgumentException is argument is not defined
*/
-  @throws[IllegalArgumentException]
-  private def apply(uuid: java.util.UUID): ActivationId = {
-require(uuid != null, "argument undefined")
-new ActivationId(uuid)
+  def parse(id: String): Try[ActivationId] = {
+val length = id.length
+if (length != 32) {
+  Failure(
+new 
IllegalArgumentException(Messages.activationIdLengthError(SizeError("Activation 
id", length.B, 32.B
+} else if (!id.forall(isHexadecimal)) {
+  Failure(new IllegalArgumentException(Messages.activationIdIllegal))
+} else {
+  Success(new ActivationId(id))
+}
   }
 
   /**
* Generates a random activation id using java.util.UUID factory.
*
+   * Uses fast path to generate the ActivationId without additional 
requirement checks.
+   *
* @return new ActivationId
*/
-  protected[core] def apply(): ActivationId = new 
ActivationId(UUIDs.randomUUID())
+  protected[core] def generate(): ActivationId = new 
ActivationId(UUIDs.randomUUID().toString.filterNot(_ == '-'))
 
-  /**
-   * Overrides factory method so that string is not interpreted as number
-   * e.g., 2e11.
-   */
-  override protected[entity] def factory(s: String): ActivationId = {
-serdes.read(JsString(s))
-  }
-
-  override protected[core] implicit val serdes = new 
RootJsonFormat[ActivationId] {
+  protected[core] implicit val serdes: RootJsonFormat[ActivationId] = new 
RootJsonFormat[ActivationId] {
 def write(d: ActivationId) = JsString(d.toString)
 
-def read(value: JsValue) =
-  Try {
-value match {
-  case JsString(s) => stringToActivationId(s)
-  case JsNumber(n) => bigIntToActivationId(n.toBigInt)
-  case _   => 
deserializationError(Messages.activationIdIllegal)
-}
-  } match {
-case Success(a) => a
-case Failure(DeserializationException(t, _, _)) => 
deserializationError(t)
-case Failure(t) => 
deserializationError(Messages.activationIdIllegal)
+def read(v

[GitHub] RSulzmann commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
RSulzmann commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370751879
 
 
   edit (@rabbah): I moved the comment to the description.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] RSulzmann commented on issue #3394: fix deploy.yml

2018-03-06 Thread GitBox
RSulzmann commented on issue #3394: fix deploy.yml
URL: 
https://github.com/apache/incubator-openwhisk/pull/3394#issuecomment-370751879
 
 
   Problem:
   
   the directory created on the remote system has no write access when 
created.
   the downloaded and extracted files needs to be copied from remote extraction 
directory to the remote nginx config directory:  the ansible copy task 
cannot copy recursively directories from remote to remote
   
   Fix: 
   
   specify mode when creating the file
   
   use shell command mv to move files


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:
us...@infra.apache.org


With regards,
Apache Git Services


  1   2   >