[GitHub] cbickel commented on issue #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
cbickel commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-343069496
 
 
   My suggestion for adding the Design doc would be, doing it manually. The 
reasons are:
   - We need the doc only for a few days
   - We have no task yet, that adds a design doc to a production environment 
(wipedb and initdb) delete the database as well. And if we add a job, this job 
would only be for this Design doc. Because all other Design docs should not be 
touched, otherwise they will be recomputed and a system with a large database 
has an outage (at least for the list commands)
   - I think we don't need the doc in the pipeline (travis, ...) as the 
database is wiped there before a new build starts
   
   Instead I'd suggest to write a step-by-step manual, how to update the 
database without any disruptions and take the creation and the deletion 
afterwards of the design doc as one step in this guide.


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
cbickel commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149881179
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
 
 Review comment:
   Oh yes you are right. I missed that.


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 #2: Swift 4 support with Codable

2017-11-08 Thread GitBox
csantanapr commented on issue #2: Swift 4 support with Codable
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-343014474
 
 
   @jthomas I got a version of Codable working give it a try I pushed an image 
to play with using my branch.
   
   ## Play with Swift 4 and Codable
   Create hello.swift with Codable interface:
   ```swift
   // Domain model/entity
   struct Employee: Codable {
 let id: Int
 let name: String
   }
   // codable main function
   func main(input: Employee, respondWith: (Employee?, RequestError?) -> Void) 
-> Void {
   // For simplicity, just passing same Employee instance forward
   respondWith(input, nil)
   }
   ```
   
   Create docker action for swift4
   ```
   bx wsk action update swift4 hello.swift --docker csantanapr/action-swift-v4
   ```
   Invoke the Action
   ```
   bx wsk action invoke swift4 -b
   ```
   
   The traditional support for dictionary still works:
   ```swift
   func main(args: [String:Any]) -> [String:Any] {
   if let name = args["name"] as? String {
   return [ "greeting" : "Hello \(name)!" ]
   } else {
   return [ "greeting" : "Hello swif4!" ]
   }
   }
   ```
   https://github.com/csantanapr/incubator-openwhisk-runtime-swift/tree/swift_4
   


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 #1: WIP: Swift 4 support

2017-11-08 Thread GitBox
csantanapr commented on issue #1: WIP: Swift 4 support
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/1#issuecomment-343013994
 
 
   Regardless if we include the dependency or not we should refactor and remove 
it if possible in 
https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift3Action/spm-build/_WhiskJSONUtils.swift
 and 
https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift3Action/spm-build/_WhiskJSONUtils.swift
   
   This way for folks doing zip with pre-compile they are not forced to include 
the dependencies, because of the epilogue
   
   


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 #1: WIP: Swift 4 support

2017-11-08 Thread GitBox
csantanapr commented on issue #1: WIP: Swift 4 support
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/1#issuecomment-343013070
 
 
   @jthomas Yeah it will be good to refactor Whisk class to use new stuff from 
Swift 4
   
   Want to help with that? I created a repo 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/6
   
   In terms of dependencies, if we remove them current users using swift 3.1.1 
using source file, would need to refactor their code becasue SwifttyJSON and 
KituraNet would be removed.
   
   Maybe is not that bad and we just need to doc or blog on how to migrate 
their 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] csantanapr commented on issue #1: WIP: Swift 4 support

2017-11-08 Thread GitBox
csantanapr commented on issue #1: WIP: Swift 4 support
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/1#issuecomment-343013070
 
 
   @jthomas Yeah it will be good to refactor Whisk class to use new stuff from 
Swift 4
   
   Want to help with that? I created issue #6 
   
   In terms of dependencies, if we remove them current users using swift 3.1.1 
using source file, would need to refactor their code becasue SwifttyJSON and 
KituraNet would be removed.
   
   Maybe is not that bad and we just need to doc or blog on how to migrate 
their 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] dgrove-oss closed issue #2872: invoker command line support for dynamicId assignment

2017-11-08 Thread GitBox
dgrove-oss closed issue #2872: invoker command line support for dynamicId 
assignment
URL: https://github.com/apache/incubator-openwhisk/issues/2872
 
 
   


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 #2872: invoker command line support for dynamicId assignment

2017-11-08 Thread GitBox
dgrove-oss commented on issue #2872: invoker command line support for dynamicId 
assignment
URL: 
https://github.com/apache/incubator-openwhisk/issues/2872#issuecomment-343012805
 
 
   PR merged


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 issue #6: Refactor Whisk class for swift4

2017-11-08 Thread GitBox
csantanapr opened a new issue #6: Refactor Whisk class for swift4
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/6
 
 
   Refactor 
[_Whisk.swift](https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift3Action/spm-build/_Whisk.swift)
 to use URLSession and Codable for JSON management.
   
   Create copy and add into `/core/swift4Action/spm-build/_Whisk.swift`


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 #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
rabbah commented on issue #2947: disable runc usage in docker-machine 
environments by default
URL: 
https://github.com/apache/incubator-openwhisk/pull/2947#issuecomment-343002137
 
 
   Great I didn?t realize we had that so can we leave it as is and then 
document using the flag for docker machine and newer docker? The point for is 
that we document only compatibility with an older docker, we have it off in 
docker machine, and for local development and demos it?ll be inconvenient to 
flip the default. 


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 #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
rabbah commented on issue #2947: disable runc usage in docker-machine 
environments by default
URL: 
https://github.com/apache/incubator-openwhisk/pull/2947#issuecomment-343000757
 
 
   Another consideration is that docker machine as documented is tied to an 
older version of docker. The new deployment for mac should be using docker for 
mac. So maybe we can just leave this alone for docker machine. 


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 #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
csantanapr commented on issue #2947: disable runc usage in docker-machine 
environments by default
URL: 
https://github.com/apache/incubator-openwhisk/pull/2947#issuecomment-343000840
 
 
   @rabbah you can use `-e invoker_use_runc=true` for your use case.
   Most folks will use newer docker
   
   What problem do you hit by having it false in docker-machine? 
   if runc is false, everything works fine using docker to unpause instead of 
runc


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149754148
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+db.save(doc)
+updated = True
+
+return updated
+
+def main(args):
+db = couchdb.client.Server(args.dbUrl)[args.dbName]
+docs = db.view('_all_docs')
+docCount = len(docs)
+docIndex = 1
+
+print('Number of docs: {}'.format(docCount))
+
+for row in docs:
+id = row.id
+doc = db.get(id)
+
+print('Checking if document {0}/{1} is an action: 
"{2}"'.format(docIndex, docCount, id))
+
+if 'exec' in doc and 'code' in doc['exec']:
+print('Document is an action: "{0}"'.format(id))
+
+if doc['exec']['kind'] != 'java':
+updated = updateNonJavaAction(db, doc, id)
+else:
+updated = updateJavaAction(db, doc, id)
+
+if updated:
+print('Updated action: "{0}"'.format(id))
+time.sleep(.700)
 
 Review comment:
   I suppose there doesn't need to be a pause here. Was just concerned about 
overloading the machine this scripts gets ran on.


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:
   ```
   {
 "_id": "_design/actionMigrate",
 "_rev": "29-63aa1f018f6a0ba873f3bf813c22cdfe",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc._attachments.codefile !== undefined && 
typeof doc.code != 'string')   };   if (isAction(doc) && !isMigrated(doc)) try 
{ emit([doc.name]);   } catch (e) {} }"
   }
 }
   }
   ```
   
   http://{couchdb}/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:
   ```
   {
 "_id": "_design/actionMigrate",
 "_rev": "29-63aa1f018f6a0ba873f3bf813c22cdfe",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc._attachments.codefile !== undefined  && 
typeof doc.code != 'string')   };   if (isAction(doc) && !isMigrated(doc)) try 
{ emit([doc.name]);   } catch (e) {} }"
   }
 }
   }
   ```
   
   http://{couchdb}/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #26: Kafka should not need Ansible for configuration

2017-11-08 Thread GitBox
dgrove-oss commented on issue #26: Kafka should not need Ansible for 
configuration
URL: 
https://github.com/apache/incubator-openwhisk-deploy-kube/issues/26#issuecomment-342991565
 
 
   I submitted PR https://github.com/apache/incubator-openwhisk/pull/2948 to 
progress this.  If it is accepted, then we should be able to resolve issue with 
small additional effort.  


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] tysonnorris closed pull request #2939: invoker cmd line support for dyanamicId assignment

2017-11-08 Thread GitBox
tysonnorris closed pull request #2939: invoker cmd line support for dyanamicId 
assignment
URL: https://github.com/apache/incubator-openwhisk/pull/2939
 
 
   

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/invoker/src/main/scala/whisk/core/invoker/Invoker.scala 
b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
index 788fbe8731..8c57206204 100644
--- a/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
+++ b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
@@ -21,6 +21,7 @@ import scala.concurrent.Await
 import scala.concurrent.duration._
 import scala.concurrent.Future
 import scala.util.Failure
+import scala.util.Try
 
 import kamon.Kamon
 
@@ -47,6 +48,8 @@ import whisk.spi.SpiLoader
 import whisk.utils.ExecutionContextFactory
 import whisk.common.TransactionId
 
+case class CmdLineArgs(name: Option[String] = None, id: Option[Int] = None)
+
 object Invoker {
 
   /**
@@ -104,8 +107,24 @@ object Invoker {
   abort("Bad configuration, cannot start.")
 }
 
-val proposedInvokerId: Option[Int] = args.headOption.map(_.toInt)
-val assignedInvokerId = proposedInvokerId
+// process command line arguments
+// We accept the command line grammar of:
+// Usage: invoker [options] []
+//--namea unique name to use for this invoker
+//--id  proposed invokerId
+def parse(ls: List[String], c: CmdLineArgs): CmdLineArgs = {
+  ls match {
+case "--name" :: name :: tail=> parse(tail, 
c.copy(name = Some(name)))
+case "--id" :: id :: tail if Try(id.toInt).isSuccess => parse(tail, 
c.copy(id = Some(id.toInt)))
+case id :: Nil if Try(id.toInt).isSuccess=> c.copy(id = 
Some(id.toInt))
+case Nil => c
+case _   => abort(s"Error 
processing command line arguments $ls")
+  }
+}
+val cmdLineArgs = parse(args.toList, CmdLineArgs())
+logger.info(this, "Command line arguments parsed to yield " + cmdLineArgs)
+
+val assignedInvokerId = cmdLineArgs.id
   .map { id =>
 logger.info(this, s"invokerReg: using proposedInvokerId ${id}")
 id
@@ -114,7 +133,7 @@ object Invoker {
 if (config.zookeeperHost.startsWith(":") || 
config.zookeeperHost.endsWith(":")) {
   abort(s"Must provide valid zookeeper host and port to use dynamicId 
assignment (${config.zookeeperHost})")
 }
-val invokerName = config.invokerName
+val invokerName = cmdLineArgs.name.getOrElse(config.invokerName)
 if (invokerName.trim.isEmpty) {
   abort("Invoker name can't be empty to use dynamicId assignment.")
 }


 


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 a change in pull request #2939: invoker cmd line support for dyanamicId assignment

2017-11-08 Thread GitBox
dgrove-oss commented on a change in pull request #2939: invoker cmd line 
support for dyanamicId assignment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2939#discussion_r149819350
 
 

 ##
 File path: core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
 ##
 @@ -104,8 +107,24 @@ object Invoker {
   abort("Bad configuration, cannot start.")
 }
 
-val proposedInvokerId: Option[Int] = args.headOption.map(_.toInt)
-val assignedInvokerId = proposedInvokerId
+// process command line arguments
+// We accept the command line grammar of:
+// Usage: invoker [options] []
+//--namea unique name to use for this invoker
 
 Review comment:
   We're going to use invokerName as a piece of a zookeeper path.  So there are 
some modest restrictions 
https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html.  But I 
believe dots in the middle are fine (eg ip addresses or hostnames).  I didn't 
try it though.
   


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] tysonnorris commented on a change in pull request #2939: invoker cmd line support for dyanamicId assignment

2017-11-08 Thread GitBox
tysonnorris commented on a change in pull request #2939: invoker cmd line 
support for dyanamicId assignment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2939#discussion_r149815355
 
 

 ##
 File path: core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
 ##
 @@ -104,8 +107,24 @@ object Invoker {
   abort("Bad configuration, cannot start.")
 }
 
-val proposedInvokerId: Option[Int] = args.headOption.map(_.toInt)
-val assignedInvokerId = proposedInvokerId
+// process command line arguments
+// We accept the command line grammar of:
+// Usage: invoker [options] []
+//--namea unique name to use for this invoker
 
 Review comment:
   are there any restrictions on what characters can be passed here for --name? 
(I assume not, like dots and dashes should work?)


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 #2872: invoker command line support for dynamicId assignment

2017-11-08 Thread GitBox
dgrove-oss commented on issue #2872: invoker command line support for dynamicId 
assignment
URL: 
https://github.com/apache/incubator-openwhisk/issues/2872#issuecomment-342980316
 
 
   Implemented in PR #2939 


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 #2545: Kafka topics are created via Docker Images

2017-11-08 Thread GitBox
dgrove-oss commented on issue #2545: Kafka topics are created via Docker Images
URL: 
https://github.com/apache/incubator-openwhisk/pull/2545#issuecomment-342977565
 
 
   @rabbah see #2948 for the kafka 0.11 approach. 


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 opened a new pull request #2948: Programmatic lazy creation of completedN and invokerN topics

2017-11-08 Thread GitBox
dgrove-oss opened a new pull request #2948: Programmatic lazy creation of 
completedN and invokerN topics
URL: https://github.com/apache/incubator-openwhisk/pull/2948
 
 
   Each invoker and controller now ensures that their message topics are
   created as part of their individual startup procedure. As a result, we
   no longer need to eagerly create the topics during kafka startup
   to ensure the topics have the desired config parameters.
   
   This change is motivated by simplifying the deployment of OpenWhisk on
   Kubernetes, but also generally enables more dynamic sizing of the
   controller/invoker pools in any deployment.
   
   The change has four main parts:
 1. addition of the ensureTopic method to the MessagingProvider SPI
 2. bump of kafka version to 0.11.0.1 (required to get AdminClient API).
 3. implementation of ensureTopic for kafka using AdminClient
 4. Changes to controller and invoker code and deployment files to
use the ensureTopic SPI method during startup.
   
   Note that although the various config parameters _may_ be overriden in
   the controller/invoker environment, defining the variables is not
   required. Defaults are defined that match the current ansible default
   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] dubeejw commented on issue #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:
   ```
   {
 "_id": "_design/actionMigrate",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc._attachments.codefile !== undefined)   
};   if (isAction(doc) && !isMigrated(doc)) try { emit([doc.name]);   } 
catch (e) {} }"
   }
 }
   }
   ```
   
   http://{couchdb}/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342975940
 
 
   @cbickel, how are you thinking we should add the design doc to the database? 
Could use Ansible.


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 #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
dubeejw closed pull request #2893: WIP Support retrieving status and 
configuration of feed triggers in CLI
URL: https://github.com/apache/incubator-openwhisk/pull/2893
 
 
   

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/feeds.md b/docs/feeds.md
index 2a2fdf91e9..9e034bfaeb 100644
--- a/docs/feeds.md
+++ b/docs/feeds.md
@@ -38,7 +38,7 @@ but technically distinct concepts.
 #  Implementing Feed Actions
 
 The *feed action* is a normal OpenWhisk *action*, but it should accept the 
following parameters:
-* **lifecycleEvent**: one of 'CREATE', 'DELETE', 'PAUSE', or 'UNPAUSE'.
+* **lifecycleEvent**: one of 'CREATE', 'READ', 'DELETE', 'PAUSE', or 'UNPAUSE'.
 * **triggerName**: the fully-qualified name of the trigger which contains 
events produced from this feed.
 * **authKey**: the Basic auth credentials of the OpenWhisk user who owns the 
trigger just mentioned.
 
@@ -58,7 +58,7 @@ The feed action named *changes* takes these parameters, and 
is expected to take
 
 For the Cloudant *changes* feed, the action happens to talk directly to a 
*cloudant trigger* service we've implemented with a connection-based 
architecture.   We'll discuss the other architectures below.
 
-A similar feed action protocol occurs for `wsk trigger delete`.
+A similar feed action protocol occurs for `wsk trigger delete` and `wsk 
trigger get`.
 
 # Implementing Feeds with Hooks
 
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index 85e9fc88d8..265b22fec7 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -27,10 +27,8 @@ import scala.language.postfixOps
 import scala.concurrent.duration.Duration
 import scala.concurrent.duration.DurationInt
 import scala.util.Random
-
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
-
 import common.TestHelpers
 import common.TestUtils
 import common.TestUtils._
@@ -1125,6 +1123,24 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "invoke a feed action with the correct lifecyle event when 
creating, retrieving and deleting a feed trigger" in withAssetCleaner(
+wskprops) { (wp, assetHelper) =>
+val actionName = "echo"
+val triggerName = "feedTest"
+
+assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
+  action.create(actionName, 
Some(TestUtils.getTestActionFilename("echo.js")))
+}
+
+try {
+  wsk.trigger.create(triggerName, feed = Some(actionName)).stdout should 
include(lifecycleEvent": "CREATE)
+
+  wsk.trigger.get(triggerName).stdout should include(lifecycleEvent": 
"READ)
+} finally {
+  wsk.trigger.delete(triggerName).stdout should 
include(lifecycleEvent": "DELETE)
+}
+  }
+
   it should "denote bound trigger parameters for trigger summaries" in 
withAssetCleaner(wskprops) { (wp, assetHelper) =>
 val trgBoundParams = "trgBoundParams"
 val trgParamAnnot = "trgParamAnnot"
diff --git a/tools/cli/go-whisk-cli/commands/trigger.go 
b/tools/cli/go-whisk-cli/commands/trigger.go
index 7a464cef29..39e38335e6 100644
--- a/tools/cli/go-whisk-cli/commands/trigger.go
+++ b/tools/cli/go-whisk-cli/commands/trigger.go
@@ -32,6 +32,7 @@ const FEED_LIFECYCLE_EVENT  = "lifecycleEvent"
 const FEED_TRIGGER_NAME = "triggerName"
 const FEED_AUTH_KEY = "authKey"
 const FEED_CREATE   = "CREATE"
+const FEED_READ = "READ"
 const FEED_DELETE   = "DELETE"
 
 // triggerCmd represents the trigger command
@@ -294,6 +295,7 @@ var triggerGetCmd = {
 RunE: func(cmd *cobra.Command, args []string) error {
 var err error
 var field string
+var fullFeedName string
 var qualifiedName = new(QualifiedName)
 
 if whiskErr := CheckArgs(args, 1, 2, "Trigger get", wski18n.T("A 
trigger name is required.")); whiskErr != nil {
@@ -326,18 +328,35 @@ var triggerGetCmd = {
 return werr
 }
 
-if (flags.trigger.summary) {
-printSummary(retTrigger)
+// Get full feed name from trigger get request as it is needed to get 
the feed
+if retTrigger != nil && retTrigger.Annotations != nil {
+fullFeedName = getValueString(retTrigger.Annotations, "feed")
+}
+
+if len(fullFeedName) > 0 {
+fullTriggerName := fmt.Sprintf("/%s/%s", 
qualifiedName.GetNamespace(), qualifiedName.GetEntityName())
+flags.common.param = append(flags.common.param, 
getFormattedJSON(FEED_LIFECYCLE_EVENT, FEED_READ))
+flags.common.param = append(flags.common.param, 

[GitHub] dubeejw commented on issue #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:
   ```
   {
 "_id": "_design/actionMigrate",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc._attachments.codefile !== undefined)   
};   if (isAction(doc) && !isMigrated(doc)) try { emit([doc.namespace, 
doc.name]);   } catch (e) {} }"
   }
 }
   }
   ```
   
   http://{couchdb}/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:
   ```
   {
 "_id": "_design/actionMigrate",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc_.attachments.codefile !== undefined)   
};   if (isAction(doc) && !isMigrated(doc)) try { emit([doc.namespace, 
doc.name]);   } catch (e) {} }"
   }
 }
   }
   ```
   
   http://{couchdb}/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342974655
 
 
   Thinking something like this to have the database return the un-updated 
actions:```
   {
 "_id": "_design/actionMigrate",
 "language": "javascript",
 "views": {
   "actions": {
 "map": "function (doc) {   var isAction = function (doc) { return 
(doc.exec !== undefined)   };   var isMigrated = function (doc) { return 
(doc._attachments !== undefined && doc_.attachments.codefile !== undefined)   
};   if (isAction(doc) && !isMigrated(doc)) try { emit([doc.namespace, 
doc.name]);   } catch (e) {} }"
   }
 }
   }
   ```
   
   
http://192.168.99.100:5984/dockermachine_whisks/_design/actionMigrate/_view/actions


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 #2877: Better error controller message for authorization failure

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2877: Better error controller 
message for authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#discussion_r149808706
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
 ##
 @@ -175,13 +181,34 @@ protected[core] abstract class 
EntitlementProvider(config: WhiskConfig, loadBala
   .flatMap(_ => checkUserThrottle(user, right, resources))
   .flatMap(_ => checkConcurrentUserThrottle(user, right, resources))
   .flatMap(_ => checkPrivilege(user, right, resources))
+  .flatMap(resourcePrivSet => {
+Future
+  .sequence {
+resourcePrivSet.map { resourcePriv =>
+  if (!resourcePriv._2) {
+inaccessibleResources += resourcePriv._1
+Future.successful(false)
+  } else {
+Future.successful(true)
+  }
+}
+  }
+  .map { _.forall(identity) }
+  })
   } else Future.successful(true)
 } else if (right != REJECT) {
+  resources.map(r => inaccessibleResources += r)
   logging.info(
 this,
 s"supplied authkey for user '$subject' does not have privilege 
'$right' for '${resources.mkString(",")}'")
 
 Review comment:
   i'd separate with `, ` (a space after comma) for better 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 issue #2877: Better error controller message for authorization failure

2017-11-08 Thread GitBox
rabbah commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-342973923
 
 
   I think the way sequence and rule entitlement works, we need to do more here 
for the case where an action does not exit. This could be a secondary PR. You 
can verify this by creating a test which creates a sequence with two actions 
`a` and `b` where only one of these exists. 
   


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 a change in pull request #2730: Reduce memory consumption for invocations of cached actions

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2730: Reduce memory consumption 
for invocations of cached actions
URL: 
https://github.com/apache/incubator-openwhisk/pull/2730#discussion_r149808369
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/Exec.scala
 ##
 @@ -45,7 +45,7 @@ import whisk.core.entity.size.SizeString
  *   main  : name of the entry point function, when using a non-default value 
(for Java, the name of the main class)" }
  */
 sealed abstract class Exec extends ByteSizeable {
-  override def toString = Exec.serdes.write(this).compactPrint
+  override def toString: String = Exec.serdes.write(this).compactPrint
 
 Review comment:
   Would have to investigate to see when this method is used.


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 #2877: Better error controller message for authorization failure

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2877: Better error controller 
message for authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#discussion_r149805454
 
 

 ##
 File path: 
core/controller/src/main/scala/whisk/core/controller/AuthorizedRouteDispatcher.scala
 ##
 @@ -71,7 +74,21 @@ trait BasicAuthorizedRouteProvider extends Directives {
 
 onComplete(entitlementProvider.check(user, right, resource)) {
   case Success(_) => dispatchOp(user, right, resource)
-  case Failure(t) => handleEntitlementFailure(t)
+  case Failure(t) =>
+t match {
+  case (r: RejectRequest) =>
+r.code match {
+  case Forbidden =>
+handleEntitlementFailure(
+  RejectRequest(
+Forbidden,
+
Some(ErrorResponse(Messages.notAuthorizedtoAccessResource(resource.fqname), 
transid
+  case NotFound =>
+handleEntitlementFailure(
+  RejectRequest(NotFound, 
Some(ErrorResponse(Messages.resourceDoesntExist(resource.fqname), transid
+  case _ => handleEntitlementFailure(t)
+}
+}
 
 Review comment:
   @markusthoemmes the entitlement should yield different rejection codes 
(forbidden or not found) depending on the subject and their rights. There 
should be tests for this.


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 #2576: Configure components via pureconfig.

2017-11-08 Thread GitBox
csantanapr commented on a change in pull request #2576: Configure components 
via pureconfig.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2576#discussion_r149804152
 
 

 ##
 File path: common/scala/build.gradle
 ##
 @@ -13,6 +13,8 @@ dependencies {
 
 compile 'io.spray:spray-json_2.11:1.3.3'
 
+compile 'com.github.pureconfig:pureconfig_2.11:0.7.2'
 
 Review comment:
   It should be OK MPL 2.0 is category 2
   https://www.apache.org/legal/resolved.html#category-b
   we don't include the source, we just need the binary


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 #2576: Configure components via pureconfig.

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2576: Configure components via 
pureconfig.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2576#discussion_r149803952
 
 

 ##
 File path: common/scala/build.gradle
 ##
 @@ -13,6 +13,8 @@ dependencies {
 
 compile 'io.spray:spray-json_2.11:1.3.3'
 
+compile 'com.github.pureconfig:pureconfig_2.11:0.7.2'
 
 Review comment:
   
https://mvnrepository.com/artifact/com.github.pureconfig/pureconfig_2.11/0.7.2


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 #2730: Reduce memory consumption for invocations of cached actions

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2730: Reduce memory consumption 
for invocations of cached actions
URL: 
https://github.com/apache/incubator-openwhisk/pull/2730#discussion_r146131628
 
 

 ##
 File path: common/scala/src/main/scala/whisk/core/entity/Exec.scala
 ##
 @@ -45,7 +45,7 @@ import whisk.core.entity.size.SizeString
  *   main  : name of the entry point function, when using a non-default value 
(for Java, the name of the main class)" }
  */
 sealed abstract class Exec extends ByteSizeable {
-  override def toString = Exec.serdes.write(this).compactPrint
+  override def toString: String = Exec.serdes.write(this).compactPrint
 
 Review comment:
   where do we use toString and should we replace with asString?


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 issue #2877: Better error controller message for authorization failure

2017-11-08 Thread GitBox
mdeuser commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-342967154
 
 
   @rabbah @dubeejw - code has been updated per comments.  let me know if 
there's any other needed changes
   
   pg4/990


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 #2576: Configure components via pureconfig.

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2576: Configure components via 
pureconfig.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2576#discussion_r149801875
 
 

 ##
 File path: common/scala/transformEnvironment.sh
 ##
 @@ -0,0 +1,32 @@
+#!/bin/bash
+
+prefix="CONFIG_"
+configVariables=$(compgen -v | grep $prefix)
+
+props=()
+
+for var in $configVariables
 
 Review comment:
   @markusthoemmes bump ^^


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] mptap commented on issue #643: Fixes Rename Marshal to marshal #320

2017-11-08 Thread GitBox
mptap commented on issue #643: Fixes Rename Marshal to marshal #320
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643#issuecomment-342965477
 
 
   Thanks @mrutkows and @pritidesai for the warm welcome :) Look forward to 
contributing more! 


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 #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
rabbah commented on issue #2947: disable runc usage in docker-machine 
environments by default
URL: 
https://github.com/apache/incubator-openwhisk/pull/2947#issuecomment-342890755
 
 
   Hmm can we make this optional? Some of us don't upgrade and develop/run 
locally almost exclusively. Something like an ansible cmd line option `-e 
runc=false`.
   


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149753800
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
 
 Review comment:
   It is, but the revision changes when the attachment is added. I thought it 
was safer to add the attachment first before deleting the inline code property 
incase one of the requests fails.


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 commented on issue #643: Fixes Rename Marshal to marshal #320

2017-11-08 Thread GitBox
mrutkows commented on issue #643: Fixes Rename Marshal to marshal #320
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643#issuecomment-342964009
 
 
   @mptap Agreed!  Welcome to the team! It was a pleasant surprise to see these 
PRs this morning ;)
   


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 issue #320: Rename Marshal to marshal

2017-11-08 Thread GitBox
mrutkows closed issue #320: Rename Marshal to marshal
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/320
 
 
   


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 #643: Fixes Rename Marshal to marshal #320

2017-11-08 Thread GitBox
mrutkows closed pull request #643: Fixes Rename Marshal to marshal #320
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643
 
 
   

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/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 7028831..6999785 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -49,7 +49,7 @@ func ReadOrCreateManifest() (*YAML, error) {
 
 // Serialize manifest to local file
 func Write(manifest *YAML, filename string) error {
-   output, err := NewYAMLParser().Marshal(manifest)
+   output, err := NewYAMLParser().marshal(manifest)
if err != nil {
return utils.NewYAMLFormatError(err.Error())
}
@@ -72,7 +72,7 @@ func (dm *YAMLParser) Unmarshal(input []byte, manifest *YAML) 
error {
return nil
 }
 
-func (dm *YAMLParser) Marshal(manifest *YAML) (output []byte, err error) {
+func (dm *YAMLParser) marshal(manifest *YAML) (output []byte, err error) {
data, err := yaml.Marshal(manifest)
if err != nil {
fmt.Printf("err happened during marshal :%v", err)


 


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] tysonnorris commented on issue #2943: revert LoadBalancerData to be synchronous

2017-11-08 Thread GitBox
tysonnorris commented on issue #2943: revert LoadBalancerData to be synchronous
URL: 
https://github.com/apache/incubator-openwhisk/pull/2943#issuecomment-342944652
 
 
   Consider that LoadBalancerService will be changed to generate a Publish 
message to be handled by a LoadBalancerActor. 
   
   I understand that the replicator enables reading local writes, but the issue 
is that assigning ActivationEntry to an invoker (via 
LoadBalancerData.putActivation) is done async from testing the current assigned 
activations (via LoadBalacnerData.activationCountPerInvoker), so while Publish 
messages can be made to arrive sequentially, the invoker selection process 
results in futures that complete at various times (without the ability to 
consider the futures that were generated previously). 
   
   There would need to be a way to cause publish messages to be processed only 
when previous futures have reached a state of completion. 
   
   I may not be stating this clearly, but is there some better way to wait for 
chooseInvoker() Future (+ schedule()) to complete before processing the next 
Publish message? 


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 issue #642: Fixes Delete unused marshal and unmarshal methods... #323

2017-11-08 Thread GitBox
pritidesai commented on issue #642: Fixes Delete unused marshal and unmarshal 
methods...  #323
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/642#issuecomment-342941495
 
 
   Please do not merge this, both the methods are being used by Parameters 
type. 


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] alexsong93 opened a new pull request #260: Implement request.path for path parameter mapping

2017-11-08 Thread GitBox
alexsong93 opened a new pull request #260: Implement request.path for path 
parameter mapping
URL: https://github.com/apache/incubator-openwhisk-apigateway/pull/260
 
 
   @mhamann 


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 #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
rabbah commented on a change in pull request #2893: WIP Support retrieving 
status and configuration of feed triggers in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2893#discussion_r149775093
 
 

 ##
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##
 @@ -1125,6 +1124,73 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "invoke a feed action with the correct lifecyle event when 
creating a feed trigger" in withAssetCleaner(
 
 Review comment:
   the asset cleaner is a convenience - use it where it make sense.
   your code looks good to me.


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 a change in pull request #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2893: WIP Support retrieving 
status and configuration of feed triggers in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2893#discussion_r149773363
 
 

 ##
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##
 @@ -1125,6 +1124,73 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "invoke a feed action with the correct lifecyle event when 
creating a feed trigger" in withAssetCleaner(
 
 Review comment:
   @rabbah, what are your thoughts on not using the asset cleaner to roll these 
three tests into one using something like the below.
   ```
 it should "invoke a feed action with the correct lifecyle event when 
creating, reading, and deleting a feed trigger" in withAssetCleaner(
   wskprops) { (wp, assetHelper) =>
   val actionName = "echo"
   val triggerName = "feedTest"
   
   assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
 action.create(actionName, 
Some(TestUtils.getTestActionFilename("echo.js")))
   }
   
   try {
 wsk.trigger.create(triggerName, feed = Some(actionName)).
 stdout should include(lifecycleEvent": "CREATE)
   
 wsk.trigger.get(triggerName).
 stdout should include(lifecycleEvent": "READ)
   } finally {
 wsk.trigger.delete(triggerName).
 stdout should include(lifecycleEvent": "DELETE)
   }
 }
   ```


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 a change in pull request #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2893: WIP Support retrieving 
status and configuration of feed triggers in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2893#discussion_r149773363
 
 

 ##
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##
 @@ -1125,6 +1124,73 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "invoke a feed action with the correct lifecyle event when 
creating a feed trigger" in withAssetCleaner(
 
 Review comment:
   @rabbah, what are your thoughts on not using the `assetCleaner` to roll 
these three tests into one using something like the below.
   ```
 it should "invoke a feed action with the correct lifecyle event when 
creating, reading, and deleting a feed trigger" in withAssetCleaner(
   wskprops) { (wp, assetHelper) =>
   val actionName = "echo"
   val triggerName = "feedTest"
   
   assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
 action.create(actionName, 
Some(TestUtils.getTestActionFilename("echo.js")))
   }
   
   try {
 wsk.trigger.create(triggerName, feed = Some(actionName)).
 stdout should include(lifecycleEvent": "CREATE)
   
 wsk.trigger.get(triggerName).
 stdout should include(lifecycleEvent": "READ)
   } finally {
 wsk.trigger.delete(triggerName).
 stdout should include(lifecycleEvent": "DELETE)
   }
 }
   ```


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 a change in pull request #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2893: WIP Support retrieving 
status and configuration of feed triggers in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2893#discussion_r149773363
 
 

 ##
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##
 @@ -1125,6 +1124,73 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "invoke a feed action with the correct lifecyle event when 
creating a feed trigger" in withAssetCleaner(
 
 Review comment:
   @rabbah, what are your thoughts on not using the `assetCleaner` to rolling 
these three tests into one using something like the below.
   ```
 it should "invoke a feed action with the correct lifecyle event when 
creating, reading, and deleting a feed trigger" in withAssetCleaner(
   wskprops) { (wp, assetHelper) =>
   val actionName = "echo"
   val triggerName = "feedTest"
   
   assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
 action.create(actionName, 
Some(TestUtils.getTestActionFilename("echo.js")))
   }
   
   try {
 wsk.trigger.create(triggerName, feed = Some(actionName)).
 stdout should include(lifecycleEvent": "CREATE)
   
 wsk.trigger.get(triggerName).
 stdout should include(lifecycleEvent": "READ)
   } finally {
 wsk.trigger.delete(triggerName).
 stdout should include(lifecycleEvent": "DELETE)
   }
 }
   ```


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 issue #643: Fixes Rename Marshal to marshal #320

2017-11-08 Thread GitBox
pritidesai commented on issue #643: Fixes Rename Marshal to marshal #320
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643#issuecomment-342921914
 
 
   LGTM, thanks @mptap for fixing this, also wram welcome to Whisk Deploy team 
:) 


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 issue #1785: make package name "default" reserved

2017-11-08 Thread GitBox
mdeuser commented on issue #1785: make package name "default" reserved
URL: 
https://github.com/apache/incubator-openwhisk/issues/1785#issuecomment-342921275
 
 
   @rabbah - fail any new packages created with the name `default`. regarding 
existing packages having the name `default` - leave them be for 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] dubeejw commented on issue #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342915582
 
 
   Thanks for the review, @cbickel.


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149754148
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+db.save(doc)
+updated = True
+
+return updated
+
+def main(args):
+db = couchdb.client.Server(args.dbUrl)[args.dbName]
+docs = db.view('_all_docs')
+docCount = len(docs)
+docIndex = 1
+
+print('Number of docs: {}'.format(docCount))
+
+for row in docs:
+id = row.id
+doc = db.get(id)
+
+print('Checking if document {0}/{1} is an action: 
"{2}"'.format(docIndex, docCount, id))
+
+if 'exec' in doc and 'code' in doc['exec']:
+print('Document is an action: "{0}"'.format(id))
+
+if doc['exec']['kind'] != 'java':
+updated = updateNonJavaAction(db, doc, id)
+else:
+updated = updateJavaAction(db, doc, id)
+
+if updated:
+print('Updated action: "{0}"'.format(id))
+time.sleep(.700)
 
 Review comment:
   I suppose there doesn't need to be a timeout here. Was just concerned about 
overloading the machine this scripts gets ran on.


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
dubeejw commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149753800
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
 
 Review comment:
   It is, but the revision changes we the attachment is added. I thought it was 
safer to add the attachment first before deleting the inline code property 
incase one of the requests fails.


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] abaruni commented on issue #80: WIP Support retrieving status and configuration of feed triggers

2017-11-08 Thread GitBox
abaruni commented on issue #80: WIP Support retrieving status and configuration 
of feed triggers
URL: 
https://github.com/apache/incubator-openwhisk-client-js/pull/80#issuecomment-342904259
 
 
   @csantanapr 


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] abaruni commented on issue #2893: WIP Support retrieving status and configuration of feed triggers in CLI

2017-11-08 Thread GitBox
abaruni commented on issue #2893: WIP Support retrieving status and 
configuration of feed triggers in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2893#issuecomment-342904390
 
 
   @jessealva can you take a look at this?


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 #641: Fixes Delete dead code - deployer_parser.go #324

2017-11-08 Thread GitBox
mrutkows closed pull request #641: Fixes Delete dead code - deployer_parser.go 
#324
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/641
 
 
   

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/parsers/deploy_parser.go b/parsers/deploy_parser.go
index 2df7670..a618c67 100644
--- a/parsers/deploy_parser.go
+++ b/parsers/deploy_parser.go
@@ -18,7 +18,6 @@
 package parsers
 
 import (
-   "fmt"
"github.com/apache/incubator-openwhisk-wskdeploy/utils"
"gopkg.in/yaml.v2"
 "strings"
@@ -32,15 +31,6 @@ func (dm *YAMLParser) UnmarshalDeployment(input []byte, 
deploy *YAML) error {
return nil
 }
 
-func (dm *YAMLParser) MarshalDeployment(deployment *YAML) (output []byte, err 
error) {
-   data, err := yaml.Marshal(deployment)
-   if err != nil {
-   fmt.Printf("err happened during marshal :%v", err)
-   return nil, err
-   }
-   return data, nil
-}
-
 func (dm *YAMLParser) ParseDeployment(deploymentPath string) (*YAML, error) {
dplyyaml := YAML{}
content, err := 
new(utils.ContentReader).LocalReader.ReadLocal(deploymentPath)


 


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 issue #324: Delete dead code - deployer_parser.go

2017-11-08 Thread GitBox
mrutkows closed issue #324: Delete dead code - deployer_parser.go
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/324
 
 
   


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] mptap commented on issue #323: Delete unused marshal and unmarshal methods from manifest_parser.go

2017-11-08 Thread GitBox
mptap commented on issue #323: Delete unused marshal and unmarshal methods from 
manifest_parser.go
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/323#issuecomment-342676978
 
 
   @pritidesai: @mrutkows: Please could you review? 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/642


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 #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
rabbah commented on issue #2947: disable runc usage in docker-machine 
environments by default
URL: 
https://github.com/apache/incubator-openwhisk/pull/2947#issuecomment-342890755
 
 
   Hmm can we make this optional? Some of us don't upgrade and develop/run 
locally almost exclusively.
   
   


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 #640: Fixes #326 Rename UnmarshalDeployment to unmarshalDeployment

2017-11-08 Thread GitBox
mrutkows closed pull request #640: Fixes #326 Rename UnmarshalDeployment to 
unmarshalDeployment
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/640
 
 
   

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/parsers/deploy_parser.go b/parsers/deploy_parser.go
index 2df7670..9e57528 100644
--- a/parsers/deploy_parser.go
+++ b/parsers/deploy_parser.go
@@ -24,7 +24,7 @@ import (
 "strings"
 )
 
-func (dm *YAMLParser) UnmarshalDeployment(input []byte, deploy *YAML) error {
+func (dm *YAMLParser) unmarshalDeployment(input []byte, deploy *YAML) error {
err := yaml.UnmarshalStrict(input, deploy)
if err != nil {
return err
@@ -47,7 +47,7 @@ func (dm *YAMLParser) ParseDeployment(deploymentPath string) 
(*YAML, error) {
 if err != nil {
 return , utils.NewYAMLFileReadError(err.Error())
 }
-   err = dm.UnmarshalDeployment(content, )
+   err = dm.unmarshalDeployment(content, )
 if err != nil {
 lines, msgs := dm.convertErrorToLinesMsgs(err.Error())
 return , utils.NewYAMLParserErr(deploymentPath, lines, msgs)


 


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 issue #326: Rename UnmarshalDeployment to unmarshalDeployment

2017-11-08 Thread GitBox
mrutkows closed issue #326: Rename UnmarshalDeployment to unmarshalDeployment
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/326
 
 
   


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] mptap commented on issue #324: Delete dead code - deployer_parser.go

2017-11-08 Thread GitBox
mptap commented on issue #324: Delete dead code - deployer_parser.go
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/324#issuecomment-342676161
 
 
   @pritidesai: @mrutkows:  Please could you review? 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/641


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] mptap commented on issue #326: Rename UnmarshalDeployment to unmarshalDeployment

2017-11-08 Thread GitBox
mptap commented on issue #326: Rename UnmarshalDeployment to unmarshalDeployment
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/326#issuecomment-342674361
 
 
   @pritidesai: @mrutkows: Please could you review? 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/640


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] mptap commented on issue #320: Rename Marshal to marshal

2017-11-08 Thread GitBox
mptap commented on issue #320: Rename Marshal to marshal
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/320#issuecomment-342889042
 
 
   @pritidesai: @mrutkows: Please could you review? 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643


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] mptap opened a new pull request #643: Fixes Rename Marshal to marshal #320

2017-11-08 Thread GitBox
mptap opened a new pull request #643: Fixes Rename Marshal to marshal #320
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/643
 
 
   Fixes https://github.com/apache/incubator-openwhisk-wskdeploy/issues/320


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] jeremiaswerner opened a new pull request #2947: disable runc usage in docker-machine environments by default

2017-11-08 Thread GitBox
jeremiaswerner opened a new pull request #2947: disable runc usage in 
docker-machine environments by default
URL: https://github.com/apache/incubator-openwhisk/pull/2947
 
 
   I was running into an issue with newer docker-machine version `17.06` where 
the invoker throws the following issue. 
   
   ```
   [2017-11-08T16:47:55.884Z] [ERROR] [#sid_102] [RuncClient] code: 1, stdout: 
, stderr: json: cannot unmarshal object into Go value of type []string 
[marker:invoker_runc.pause_error:103484:238]
   ```
   
   I therefore propose to disable `runc` by default in docker-machine 
environments.


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 closed pull request #2802: Akka Usage Cleanup for Actor State safety

2017-11-08 Thread GitBox
markusthoemmes closed pull request #2802: Akka Usage Cleanup for Actor State 
safety
URL: https://github.com/apache/incubator-openwhisk/pull/2802
 
 
   

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/connector/MessageConsumer.scala 
b/common/scala/src/main/scala/whisk/core/connector/MessageConsumer.scala
index 31fcea09ba..51977677ab 100644
--- a/common/scala/src/main/scala/whisk/core/connector/MessageConsumer.scala
+++ b/common/scala/src/main/scala/whisk/core/connector/MessageConsumer.scala
@@ -18,14 +18,12 @@
 package whisk.core.connector
 
 import scala.annotation.tailrec
-import scala.collection.mutable
+import scala.collection.immutable
 import scala.concurrent.Future
 import scala.concurrent.blocking
 import scala.concurrent.duration._
 import scala.util.Failure
-
 import org.apache.kafka.clients.consumer.CommitFailedException
-
 import akka.actor.FSM
 import akka.pattern.pipe
 import whisk.common.Logging
@@ -111,7 +109,13 @@ class MessageFeed(description: String,
 consumer.maxPeek <= maxPipelineDepth,
 "consumer may not yield more messages per peek than permitted by max 
depth")
 
-  private val outstandingMessages = mutable.Queue[(String, Int, Long, 
Array[Byte])]()
+  // Immutable Queue
+  // although on the surface it seems to make sense to use an immutable 
variable with a mutable Queue,
+  // Akka Actor state defies the usual "prefer immutable" guideline in Scala, 
esp. w/ Collections.
+  // If, for some reason, this Queue was mutable and is accidentally leaked in 
say an Akka message,
+  // another Actor or recipient would be able to mutate the internal state of 
this Actor.
+  // Best practice dictates a mutable variable pointing at an immutable 
collection for this reason
+  private var outstandingMessages = immutable.Queue.empty[(String, Int, Long, 
Array[Byte])]
   private var handlerCapacity = maximumHandlerCapacity
 
   private implicit val tid = TransactionId.dispatcher
@@ -137,7 +141,7 @@ class MessageFeed(description: String,
   stay
 
 case Event(FillCompleted(messages), _) =>
-  outstandingMessages.enqueue(messages: _*)
+  outstandingMessages = outstandingMessages ++ messages
   sendOutstandingMessages()
 
   if (shouldFillQueue()) {
@@ -202,7 +206,11 @@ class MessageFeed(description: String,
   private def sendOutstandingMessages(): Unit = {
 val occupancy = outstandingMessages.size
 if (occupancy > 0 && handlerCapacity > 0) {
-  val (topic, partition, offset, bytes) = outstandingMessages.dequeue()
+  // Easiest way with an immutable queue to cleanly dequeue
+  // Head is the first elemeent of the queue, desugared w/ an assignment 
pattern
+  // Tail is everything but the first element, thus mutating the 
collection variable
+  val (topic, partition, offset, bytes) = outstandingMessages.head
+  outstandingMessages = outstandingMessages.tail
 
   if (logHandoff) logging.info(this, s"processing 
$topic[$partition][$offset] ($occupancy/$handlerCapacity)")
   handler(bytes)
diff --git 
a/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala
 
b/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala
index f159192546..2a9fa1f613 100644
--- 
a/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala
+++ 
b/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala
@@ -17,7 +17,6 @@
 
 package whisk.core.controller.actions
 
-import scala.collection.mutable.Buffer
 import scala.concurrent.ExecutionContext
 import scala.concurrent.Future
 import scala.concurrent.Promise
@@ -258,7 +257,7 @@ protected[actions] object ActivationFinisher {
 // when the future completes, self-destruct
 promise.future.andThen { case _ => shutdown() }
 
-val preemptiveMsgs: Buffer[Cancellable] = Buffer.empty
+var preemptiveMsgs = Vector.empty[Cancellable]
 
 def receive = {
   case ActivationFinisher.Finish(activation) =>
@@ -267,13 +266,13 @@ protected[actions] object ActivationFinisher {
   case msg @ Scheduler.WorkOnceNow =>
 // try up to three times when pre-emptying the schedule
 fastPollPeriods.foreach { s =>
-  preemptiveMsgs += context.system.scheduler.scheduleOnce(s, poller, 
msg)
+  preemptiveMsgs = preemptiveMsgs :+ 
context.system.scheduler.scheduleOnce(s, poller, msg)
 }
 }
 
 def shutdown(): Unit = {
   preemptiveMsgs.foreach(_.cancel())
-  preemptiveMsgs.clear()
+  preemptiveMsgs = Vector.empty
   context.stop(poller)
   context.stop(self)
 }
@@ -281,7 +280,7 @@ protected[actions] object ActivationFinisher {
 override def postStop() = {
   

[GitHub] jsanda commented on issue #2910: [2862] Get protocol from client config base url

2017-11-08 Thread GitBox
jsanda commented on issue #2910: [2862] Get protocol from client config base url
URL: 
https://github.com/apache/incubator-openwhisk/pull/2910#issuecomment-342862537
 
 
   @rabbah how can I determine the controller hostname from within tests?
   
   I have a web action that can be accessed at 
```https://172.17.0.1/api/v1/web/guest/default/hello.json```. My controller0 is 
172.17.0.5. I am able to access the web action by directly accessing the 
controller at ```http://172.17.0.5:8080/api/v1/web/guest/default/hello.json```, 
but I am not sure to figure out the controller hostname.
   
   You can disregard the above question. I see that the host port mapping is 
defined in whisk.properties which is all I need. 


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] jsanda commented on issue #2910: [2862] Get protocol from client config base url

2017-11-08 Thread GitBox
jsanda commented on issue #2910: [2862] Get protocol from client config base url
URL: 
https://github.com/apache/incubator-openwhisk/pull/2910#issuecomment-342862537
 
 
   @rabbah how can I determine the controller hostname from within tests?
   
   I have a web action that can be accessed at 
```https://172.17.0.1/api/v1/web/guest/default/hello.json```. My controller0 is 
172.17.0.5. I am able to access the web action by directly accessing the 
controller at ```http://172.17.0.5:8080/api/v1/web/guest/default/hello.json```, 
but I am not sure to figure out the controller hostname.


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 #2910: [2862] Get protocol from client config base url

2017-11-08 Thread GitBox
rabbah commented on issue #2910: [2862] Get protocol from client config base url
URL: 
https://github.com/apache/incubator-openwhisk/pull/2910#issuecomment-342864034
 
 
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/common/WhiskProperties.java
 line 229


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] jsanda commented on issue #2910: [2862] Get protocol from client config base url

2017-11-08 Thread GitBox
jsanda commented on issue #2910: [2862] Get protocol from client config base url
URL: 
https://github.com/apache/incubator-openwhisk/pull/2910#issuecomment-342862537
 
 
   @rabbah how can I determine the controller hostname from within tests?


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 closed pull request #2877: Better error controller message for authorization failure

2017-11-08 Thread GitBox
mdeuser closed pull request #2877: Better error controller message for 
authorization failure
URL: https://github.com/apache/incubator-openwhisk/pull/2877
 
 
   

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/http/ErrorResponse.scala 
b/common/scala/src/main/scala/whisk/http/ErrorResponse.scala
index 09c3bfe74f..6cd47cc427 100644
--- a/common/scala/src/main/scala/whisk/http/ErrorResponse.scala
+++ b/common/scala/src/main/scala/whisk/http/ErrorResponse.scala
@@ -57,6 +57,7 @@ object Messages {
 
   /** Standard message for resource not found. */
   val resourceDoesNotExist = "The requested resource does not exist."
+  def resourceDoesntExist(value: String) = s"The requested resource '$value' 
does not exist."
 
   /** Standard message for too many activation requests within a rolling time 
window. */
   def tooManyRequests(count: Int, allowed: Int) =
@@ -71,6 +72,8 @@ object Messages {
 
   /** Standard message when supplied authkey is not authorized for an 
operation. */
   val notAuthorizedtoOperateOnResource = "The supplied authentication is not 
authorized to access this resource."
+  def notAuthorizedtoAccessResource(value: String) =
+s"The supplied authentication is not authorized to access '$value'."
 
   /** Standard error message for malformed fully qualified entity names. */
   val malformedFullyQualifiedEntityName =
diff --git 
a/core/controller/src/main/scala/whisk/core/controller/AuthorizedRouteDispatcher.scala
 
b/core/controller/src/main/scala/whisk/core/controller/AuthorizedRouteDispatcher.scala
index 54219ac7e8..9288707732 100644
--- 
a/core/controller/src/main/scala/whisk/core/controller/AuthorizedRouteDispatcher.scala
+++ 
b/core/controller/src/main/scala/whisk/core/controller/AuthorizedRouteDispatcher.scala
@@ -26,6 +26,8 @@ import scala.concurrent.Future
 
 import akka.http.scaladsl.server.Directives
 import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.StatusCodes.Forbidden
+import akka.http.scaladsl.model.StatusCodes.NotFound
 import akka.http.scaladsl.server.RequestContext
 import akka.http.scaladsl.server.RouteResult
 import akka.http.scaladsl.model.StatusCodes.InternalServerError
@@ -37,6 +39,7 @@ import whisk.core.entitlement._
 import whisk.core.entitlement.Resource
 import whisk.core.entity._
 import whisk.core.entity.size._
+import whisk.http.ErrorResponse
 import whisk.http.ErrorResponse.terminate
 import whisk.http.Messages
 
@@ -71,7 +74,21 @@ trait BasicAuthorizedRouteProvider extends Directives {
 
 onComplete(entitlementProvider.check(user, right, resource)) {
   case Success(_) => dispatchOp(user, right, resource)
-  case Failure(t) => handleEntitlementFailure(t)
+  case Failure(t) =>
+t match {
+  case (r: RejectRequest) =>
+r.code match {
+  case Forbidden =>
+handleEntitlementFailure(
+  RejectRequest(
+Forbidden,
+
Some(ErrorResponse(Messages.notAuthorizedtoAccessResource(resource.fqname), 
transid
+  case NotFound =>
+handleEntitlementFailure(
+  RejectRequest(NotFound, 
Some(ErrorResponse(Messages.resourceDoesntExist(resource.fqname), transid
+  case _ => handleEntitlementFailure(t)
+}
+}
 }
   }
 
diff --git 
a/core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala 
b/core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
index a2fc2136f6..21f2a54d20 100644
--- a/core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
+++ b/core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
@@ -18,6 +18,8 @@
 package whisk.core.entitlement
 
 import scala.collection.concurrent.TrieMap
+import scala.collection.immutable.Set
+import scala.collection.mutable.ListBuffer
 import scala.concurrent.Future
 import scala.util.Failure
 import scala.util.Success
@@ -35,6 +37,8 @@ import whisk.core.WhiskConfig
 import whisk.core.controller.RejectRequest
 import whisk.core.entity._
 import whisk.core.loadBalancer.LoadBalancer
+import whisk.http.ErrorResponse
+import whisk.http.Messages
 import whisk.http.Messages._
 
 package object types {
@@ -56,6 +60,7 @@ protected[core] case class Resource(namespace: EntityPath,
 env: Option[Parameters] = None) {
   def parent = collection.path + EntityPath.PATHSEP + namespace
   def id = parent + (entity map { EntityPath.PATHSEP + _ } getOrElse (""))
+  def fqname = namespace.asString + (entity map { EntityPath.PATHSEP + _ } 
getOrElse (""))
   override def toString = id
 }
 
@@ -167,6 +172,7 @@ protected[core] abstract class 

[GitHub] mrutkows closed issue #331: Delete dead code - manifestreader.go

2017-11-08 Thread GitBox
mrutkows closed issue #331: Delete dead code - manifestreader.go
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/331
 
 
   


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 #639: Fixes #331 Delete dead code - manifestreader.go

2017-11-08 Thread GitBox
mrutkows closed pull request #639: Fixes #331 Delete dead code - 
manifestreader.go
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/639
 
 
   

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/deployers/manifestreader.go b/deployers/manifestreader.go
index 6fc6369..2003d33 100644
--- a/deployers/manifestreader.go
+++ b/deployers/manifestreader.go
@@ -19,7 +19,6 @@ package deployers
 
 import (
"errors"
-   "fmt"
"strings"
 
"github.com/apache/incubator-openwhisk-client-go/whisk"
@@ -372,17 +371,3 @@ func (reader *ManifestReader) SetApis(ar 
[]*whisk.ApiCreateRequest) error {
}
return nil
 }
-
-// from whisk go client
-func (deployer *ManifestReader) getQualifiedName(name string, namespace 
string) string {
-   if strings.HasPrefix(name, "/") {
-   return name
-   } else if strings.HasPrefix(namespace, "/") {
-   return fmt.Sprintf("%s/%s", namespace, name)
-   } else {
-   if len(namespace) == 0 {
-   namespace = clientConfig.Namespace
-   }
-   return fmt.Sprintf("/%s/%s", namespace, name)
-   }
-}


 


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 issue #290: Change util_test.go's "ReadUrl" test URL to a neutral address (e.g., 'apache.org')

2017-11-08 Thread GitBox
mrutkows closed issue #290: Change util_test.go's "ReadUrl" test URL to a 
neutral address (e.g., 'apache.org') 
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/290
 
 
   


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 #638: Fixes #290 Change util_test.go's ReadUrl test URL to a neutral address

2017-11-08 Thread GitBox
mrutkows closed pull request #638: Fixes #290 Change util_test.go's ReadUrl 
test URL to a neutral address
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/638
 
 
   

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/utils/misc_test.go b/utils/misc_test.go
index 94203ad..f7a1ade 100644
--- a/utils/misc_test.go
+++ b/utils/misc_test.go
@@ -38,7 +38,7 @@ func TestLocalReader_ReadLocal(t *testing.T) {
 }
 
 func TestURLReader_ReadUrl(t *testing.T) {
-   var exampleUrl = "http://www.baidu.com;
+   var exampleUrl = "https://www.apache.org/;
b, _ := contentReader.ReadUrl(exampleUrl)
if b == nil {
t.Error("get web content failed")


 


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 issue #289: Typo in constructor 'NewManfiestReader' in file manifestreader.go

2017-11-08 Thread GitBox
mrutkows closed issue #289: Typo in constructor 'NewManfiestReader' in file 
manifestreader.go
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/289
 
 
   


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] ianpartridge commented on issue #3: Initial Support for swift 4

2017-11-08 Thread GitBox
ianpartridge commented on issue #3: Initial Support for swift 4
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/3#issuecomment-342844333
 
 
   Or even keep the args/return model with:
   
   ```swift
   func main(input: Employee) -> Result {
   return .success(input)
   }
   ```
   
   and `main()` would be defined as
   
   ```swift
   func main(input: T) -> Result {
   ...
   }
   ```


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 #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
cbickel commented on issue #2938: Convert inline code to attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#issuecomment-342841994
 
 
   I like this little script to update the database schema.
   But one thing that comes into my mind is: If you have large databases, it 
could take a very long time to update the actions, because you are getting all 
the documents by its own.
   What do you think about creating a design doc, that returns only the 
actions, thats still need to be modified?
   Of cause, this design doc can be deleted afterwards.
   
   Another aspect to make this script faster (if you want it to), would be 
batching.


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
cbickel commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149690221
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
 
 Review comment:
   Isn't this the doc, that is passed into this function?


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] ianpartridge commented on issue #3: Initial Support for swift 4

2017-11-08 Thread GitBox
ianpartridge commented on issue #3: Initial Support for swift 4
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/3#issuecomment-342839494
 
 
   Could we use a `Result` type here?
   
   ```swift
   enum Result {
   case success(T)
   case failure(E)
   }
   
   enum OpenWhiskError: Swift.Error {
   case barf
   // etc
   }
   
   struct Employee: Codable {
   let id: Int
   let name: String
   }
   
   func main(input: Employee, respondWith: (Result) 
-> Void) -> Void {
   respondWith(.success(input))
   }
   ```


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 a change in pull request #2938: Convert inline code to attachment in database

2017-11-08 Thread GitBox
cbickel commented on a change in pull request #2938: Convert inline code to 
attachment in database
URL: 
https://github.com/apache/incubator-openwhisk/pull/2938#discussion_r149688845
 
 

 ##
 File path: tools/db/moveCodeToAttachment.py
 ##
 @@ -0,0 +1,100 @@
+#!/usr/bin/env python
+'''Python script update actions.
+
+/*
+ * 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.
+ */
+'''
+
+import argparse
+import couchdb.client
+import time
+import base64
+
+def updateJavaAction(db, doc, id):
+updated = False
+attachment = db.get_attachment(doc, 'jarfile')
+
+if attachment != None:
+print('Updating Java action: "{0}"'.format(id))
+encodedAttachment = base64.b64encode(attachment.getvalue())
+db.put_attachment(doc, encodedAttachment, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+if 'jar' in doc['exec']:
+del doc['exec']['jar']
+db.save(doc)
+db.delete_attachment(doc, 'jarfile')
+updated = True
+
+return updated
+
+def updateNonJavaAction(db, doc, id):
+updated = False
+code = doc['exec']['code']
+
+if not isinstance(code, dict):
+print('Updating action: "{0}"'.format(id))
+db.put_attachment(doc, code, 'codefile', 'text/plain')
+doc = db.get(id)
+doc['exec']['code'] = {
+'attachmentName': 'codefile',
+'attachmentType': 'text/plain'
+}
+db.save(doc)
+updated = True
+
+return updated
+
+def main(args):
+db = couchdb.client.Server(args.dbUrl)[args.dbName]
+docs = db.view('_all_docs')
+docCount = len(docs)
+docIndex = 1
+
+print('Number of docs: {}'.format(docCount))
+
+for row in docs:
+id = row.id
+doc = db.get(id)
+
+print('Checking if document {0}/{1} is an action: 
"{2}"'.format(docIndex, docCount, id))
+
+if 'exec' in doc and 'code' in doc['exec']:
+print('Document is an action: "{0}"'.format(id))
+
+if doc['exec']['kind'] != 'java':
+updated = updateNonJavaAction(db, doc, id)
+else:
+updated = updateJavaAction(db, doc, id)
+
+if updated:
+print('Updated action: "{0}"'.format(id))
+time.sleep(.700)
 
 Review comment:
   Why do we need this sleep 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] csantanapr commented on issue #2: Swift 4 support with Codable

2017-11-08 Thread GitBox
csantanapr commented on issue #2: Swift 4 support with Codable
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-342509355
 
 
   User can define Codable interface or traditional dictionary
   In terms of User experience they I want to make it dead simple
   dict in dict out
   ```swift
   func main(args: [String:Any]) -> [String:Any] {
  return args
   }
   ```
   codable
   ```swift
   struct Employee: Codable {
 let id: Int
 let name: String
   }
   func main(input: Employee, respondWith: (Employee?, RequestError?) -> Void) 
-> Void {
   respondWith(input, nil)
   }
   ```
   
   deployment looks the same for both
   ```
   wsk action create helloAction hello.swift --kind swift:4
   wsk action invoke helloAction -p id 42 -p name Carlos -r
   {
 "id":42,
 "name":Carlos
   }
   ```
   
   epilogue.swift will handle how to call the function based on signature. 
   
   
   
   


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 #2: Swift 4 support with Codable and Async

2017-11-08 Thread GitBox
csantanapr commented on issue #2: Swift 4 support with Codable and Async
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-342834654
 
 
   @jthomas I broke the swift proxy in a different issue #5 
   
   This way we can get this out first without holding it back from start to 
play with swift 4 Codable sooner 


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 #2: Swift 4 support with Codable and Async

2017-11-08 Thread GitBox
csantanapr commented on issue #2: Swift 4 support with Codable and Async
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-342834356
 
 
   This should not require a braking API to the current dictionary in and out.
   User should be able to move forward their current OW Action from swift 3 to 
swift 4 with just updating the kind `--kind swift:4`



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 issue #5: Swift 4 web proxy in swift

2017-11-08 Thread GitBox
csantanapr opened a new issue #5: Swift 4 web proxy in swift
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/5
 
 
   Today we use python web server to execute the swift binary.
   python will pass input JSON via stdin and expect executable to respond with 
the last line of stdout as the output JSON.
   
   The problems is that the swift code needs to initialize everything on every 
invoke. if creates instances of a Class, or reads a file into an instance. this 
work needs to be done from scratch on every invoke.
   
   Other runtimes like nodejs and python in OpenWhisk don't have this problem, 
since the web proxy server is in the same language and holds into memory.
   
   It would be good to have a web proxy server to be implemented in swift, this 
way anything created on /init or /run can remain in memory as long the 
container lives.
   
   One alternative is look into Kitura 2.0 to build a very small and fast web 
proxy that listens on port 8080 that handles the standard OW interface with 
/init and /run
   
   


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] vvraskin opened a new pull request #2946: Emit an additional counter metric for http service

2017-11-08 Thread GitBox
vvraskin opened a new pull request #2946: Emit an additional counter metric for 
http service
URL: https://github.com/apache/incubator-openwhisk/pull/2946
 
 
   One line that should have gone to this PR 
https://github.com/apache/incubator-openwhisk/pull/2930/


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 #4: Publish OpenWhisk Swift handler library as package

2017-11-08 Thread GitBox
csantanapr commented on issue #4: Publish OpenWhisk Swift handler library as 
package 
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/4#issuecomment-342831721
 
 
   If make it part of the main swift4 runtime, then it should be cover by the 
test suite.


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 #4: Publish OpenWhisk Swift handler library as package

2017-11-08 Thread GitBox
csantanapr commented on issue #4: Publish OpenWhisk Swift handler library as 
package 
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/4#issuecomment-342831482
 
 
   This looks good to me to me, we just need to adjust it for new Package.swift 
for swift 4.
   
   I would do this for swift 4 and forward and leave 3.1.1 alone.


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 #3: Initial Support for swift 4

2017-11-08 Thread GitBox
csantanapr commented on issue #3: Initial Support for swift 4
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/3#issuecomment-342827413
 
 
   In terms of User experience they I want to make it dead simple
   dict in dict out
   ```swift
   func main(args: [String:Any]) -> [String:Any] {
  return args
   }
   ```
   codable
   ```swift
   struct Employee: Codable {
 let id: Int
 let name: String
   }
   func main(input: Employee, respondWith: (Employee?, RequestError?) -> Void) 
-> Void {
   respondWith(input, nil)
   }
   ```
   
   deployment looks the same for both
   ```
   wsk action create helloAction hello.swift --kind swift:4
   wsk action invoke helloAction -p id 42 -p name Carlos -r
   {
 "id":42,
 "name":Carlos
   }
   ```
   
   epilogue.swift will handle how to call the function based on signature. 
   
   


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 #3: Initial Support for swift 4

2017-11-08 Thread GitBox
csantanapr commented on issue #3: Initial Support for swift 4
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/3#issuecomment-342827413
 
 
   In terms of User experience they I want to make it dead simple
   dict in dict out
   ```swift
   func main_traditional(args: [String:Any]) -> [String:Any] {
  return args
   }
   ```
   codable
   ```swift
   struct Employee: Codable {
 let id: Int
 let name: String
   }
   func main_codable(input: Employee, respondWith: (Employee?, RequestError?) 
-> Void) -> Void {
   respondWith(input, nil)
   }
   ```
   
   deployment looks the same for both
   ```
   wsk action create helloAction hello.swift --kind swift:4
   wsk action invoke helloAction -p id 42 -p name Carlos -r
   {
 "id":42,
 "name":Carlos
   }
   ```
   
   epilogue.swift will handle how to call the function based on signature. 
   
   


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 #2810: Add couchdb clustering

2017-11-08 Thread GitBox
cbickel commented on issue #2810: Add couchdb clustering
URL: 
https://github.com/apache/incubator-openwhisk/pull/2810#issuecomment-342826521
 
 
   This is a great Pull request.
   The only thing, that should be there (if it is technically possible) is, 
that we should have the ability to deploy two instances on the same machine. 
With this feature, testing would be much easier. We have it for the controllers 
and invokers as well.
   
   And I have an additional question. Is the intention of this PR only, to 
share data across multiple instances? Wouldn't it be great, if the requests 
against the database would be distributed across the instances? Or do you have 
in mind to do this 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] csantanapr commented on issue #3: Initial Support for swift 4

2017-11-08 Thread GitBox
csantanapr commented on issue #3: Initial Support for swift 4
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/3#issuecomment-342825599
 
 
   It would not a be a braking change, in and out dictionary will still work.
   
   Yes I think we can brake it into smaller chunks and do it in a way we can do 
it in stages.
   1. swift 4 with current signature (dictionary in, dictionary out) using 
python proxy
   2. swift 4 with codable signature (codable in, handler(codable out, codable 
error) proxy
   3. swift 4 with swift web proxy
   
   I think we can get both 1&2 together. but they can be separate. I just got 
started and got 1 working, I can get that merge into master if that make sense.
   then start work on 2 on top of that
   


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 a change in pull request #2810: Add couchdb clustering

2017-11-08 Thread GitBox
cbickel commented on a change in pull request #2810: Add couchdb clustering
URL: 
https://github.com/apache/incubator-openwhisk/pull/2810#discussion_r149659907
 
 

 ##
 File path: ansible/roles/couchdb/tasks/deploy.yml
 ##
 @@ -49,9 +63,48 @@
   retries: 12
   delay: 5
 
+- name: enable the cluster setup mode
+  uri:
+url: "{{ db_protocol }}://{{ ansible_host }}:{{ db_port }}/_cluster_setup"
+method: POST
+body: >
+{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "{{ 
db_username }}", "password":"{{ db_password }}", "port": {{ db_port }}, 
"node_count": "{{ num_instances }}", "remote_node": "{{ ansible_host }}", 
"remote_current_user": "{{ db_username }}", "remote_current_password": "{{ 
db_password }}"}
 
 Review comment:
   What about using
   ```
   {{ groups['db'] | length }}
   ```
   Instead of defining `num_instances` on the top?


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 closed pull request #2945: Be able to exclude databases by basename in replication

2017-11-08 Thread GitBox
markusthoemmes closed pull request #2945: Be able to exclude databases by 
basename in replication
URL: https://github.com/apache/incubator-openwhisk/pull/2945
 
 
   

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/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala 
b/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
index e1f6a599e7..727d8720e2 100644
--- a/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
+++ b/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
@@ -75,11 +75,15 @@ class ReplicatorTests
 dbPrefix: String,
 expires: FiniteDuration,
 continuous: Boolean = false,
-exclude: List[String] = List()) = {
-println(s"Running replicator: $sourceDbUrl, $targetDbUrl, $dbPrefix, 
$expires, $continuous, $exclude")
+exclude: List[String] = List(),
+excludeBaseName: List[String] = List()) = {
+println(
+  s"Running replicator: $sourceDbUrl, $targetDbUrl, $dbPrefix, $expires, 
$continuous, $exclude, $excludeBaseName")
 
 val continuousFlag = if (continuous) Some("--continuous") else None
 val excludeFlag = Seq(exclude.mkString(",")).filter(_.nonEmpty).flatMap(ex 
=> Seq("--exclude", ex))
+val excludeBaseNameFlag =
+  Seq(excludeBaseName.mkString(",")).filter(_.nonEmpty).flatMap(ex => 
Seq("--excludeBaseName", ex))
 val cmd = Seq(
   python,
   replicator,
@@ -91,7 +95,7 @@ class ReplicatorTests
   "--dbPrefix",
   dbPrefix,
   "--expires",
-  expires.toSeconds.toString) ++ continuousFlag ++ excludeFlag
+  expires.toSeconds.toString) ++ continuousFlag ++ excludeFlag ++ 
excludeBaseNameFlag
 val rr = TestUtils.runCmd(0, new File("."), cmd: _*)
 
 val Seq(created, deletedDoc, deleted) =
@@ -236,6 +240,31 @@ class ReplicatorTests
 removeDatabase(testDbPrefix + excludedName)
   }
 
+  it should "not replicate a database that basename is excluded" in {
+// Create a database to backup
+val dbNameToBackup = testDbPrefix + 
"database_for_single_replication_with_exclude_basename"
+createDatabase(dbNameToBackup, Some(designDocPath))
+
+val excludedName = "some_excluded_name"
+createDatabase(testDbPrefix + excludedName + "-postfix123", 
Some(designDocPath))
+
+// Trigger replication and verify the created databases have the correct 
format
+val (createdBackupDbs, _, _) =
+  runReplicator(dbUrl, dbUrl, testDbPrefix, 10.minutes, excludeBaseName = 
List(excludedName))
+createdBackupDbs should have size 1
+val backupDbName = createdBackupDbs.head
+backupDbName should fullyMatch regex s"backup_\\d+_$dbNameToBackup"
+
+// Wait for the replication to finish
+waitForReplication(backupDbName)
+
+// Remove all created databases
+createdBackupDbs.foreach(removeDatabase(_))
+createdBackupDbs.foreach(removeReplicationDoc(_))
+removeDatabase(dbNameToBackup)
+removeDatabase(testDbPrefix + excludedName + "-postfix123")
+  }
+
   it should "replicate a database (snapshot) even if the filter is not 
available" in {
 // Create a db to backup
 val dbName = testDbPrefix + "database_for_snapshout_without_filter"
diff --git a/tools/db/replicateDbs.py b/tools/db/replicateDbs.py
index 9bceb3995b..ae4a4e1ccc 100755
--- a/tools/db/replicateDbs.py
+++ b/tools/db/replicateDbs.py
@@ -24,6 +24,7 @@
 import time
 import re
 import couchdb.client
+import functools
 
 def retry(fn, retries):
 try:
@@ -42,6 +43,7 @@ def replicateDatabases(args):
 targetDb = couchdb.client.Server(args.targetDbUrl)
 
 excludedDatabases = args.exclude.split(",")
+excludedBaseNames = filter(lambda x: x != "", 
args.excludeBaseName.split(","))
 
 # Create _replicator DB if it does not exist yet.
 if "_replicator" not in sourceDb:
@@ -53,7 +55,12 @@ def replicateDatabases(args):
 backupPrefix = "backup_%d_" % now
 
 def isExcluded(dbName):
-return dbName.replace(args.dbPrefix, "", 1) in excludedDatabases
+dbNameWithoutPrefix = dbName.replace(args.dbPrefix, "", 1)
+# is the databaseName is in the list of excluded database
+isNameExcluded = dbNameWithoutPrefix in excludedDatabases
+# if one of the basenames matches, the database is excluded
+isBaseNameExcluded = functools.reduce(lambda x, y: x or y, map(lambda 
en: dbNameWithoutPrefix.startswith(en), excludedBaseNames), False)
+return isNameExcluded or isBaseNameExcluded
 
 # Create backup of all databases with given prefix
 print("- Create backups -")
@@ -125,6 +132,7 @@ def replayDatabases(args):
 replicateParser.add_argument("--expires", required=True, 

[GitHub] jthomas commented on issue #1: WIP: Swift 4 support

2017-11-08 Thread GitBox
jthomas commented on issue #1: WIP: Swift 4 support
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/1#issuecomment-342777173
 
 
   Looking at the existing packages, it might be worth reviewing these given 
the changes to Swift 4. 
   
   - SwiftyJSON doesn't seem necessary with Codable support?
   - Is Kitura-net necessary with URLSession?
   
   When the Cloudant Swift lib [supports 
Linux](https://github.com/cloudant/swift-cloudant/issues/121) (might be worth 
including that).


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] jthomas commented on issue #2: Swift 4 support with Codable and Async

2017-11-08 Thread GitBox
jthomas commented on issue #2: Swift 4 support with Codable and Async
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-342781194
 
 
   Looks like a good API interface. 


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] jthomas opened a new issue #4: Publish OpenWhisk Swift handler library as package

2017-11-08 Thread GitBox
jthomas opened a new issue #4: Publish OpenWhisk Swift handler library as 
package 
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/4
 
 
   The current Swift files for [implementing the OpenWhisk 
handler](https://github.com/apache/incubator-openwhisk-runtime-swift/tree/master/core/swift3Action/spm-build)
 are included as raw source files. This leads to a complex and manual process 
for building Swift binaries locally, which doesn't feel very "Swifty". 
   
   ```
   docker run -it -v "$HOME:/owexec" openwhisk/swift3action bash
   apt-get install -y zip
   cp /owexec/hello.swift /swift3Action/spm-build/main.swift 
   cat /swift3Action/epilogue.swift >> /swift3Action/spm-build/main.swift
   echo '_run_main(mainFunction:main)' >> /swift3Action/spm-build/main.swift
   /swift3Action/spm-build/swiftbuildandlink.sh
   cd /swift3Action/spm-build
   zip /owexec/hello.zip .build/release/Action
   exit
   ```
   
   Publishing this code as an [official Swift 
package](https://packagecatalog.com/) would massively improve the developer 
experience.  I've already experimented with doing this and have an unofficial 
package available here: 
   https://packagecatalog.com/package/jthomas/OpenWhiskAction
   
   ### usage
   
   Developers include the package in their manifest
   
   ```swift
   let package = Package(
   name: "Action",
   dependencies: [
   .Package(url: "https://github.com/jthomas/OpenWhiskAction.git;, 
majorVersion: 0)
   ]
   )
   ```
   
   ... and then simply reference the library in their code.
   
   ```swift
   import OpenWhiskAction
   
   func hello(args: [String:Any]) -> [String:Any] {
   if let name = args["name"] as? String {
 return [ "greeting" : "Hello \(name)!" ]
   } else {
 return [ "greeting" : "Hello stranger!" ]
   }
   }
   
   OpenWhiskAction(main: hello)
   ```
   
   Compiling a binary for the platform them becomes a single command.
   
   ```
   docker run --rm -it -v $(pwd):/swift-package openwhisk/swift3action bash -e 
-c "cd /swift-package && swift build -v -c release"
   ```
   
   This is a huge improvements over the current process.
   
   ### process
   
   Creating this package no code changes, it's just bundling the existing 
handler files in the Swift package format.
   https://github.com/jthomas/OpenWhiskAction
   
   This package can also be used when dynamically compiling Swift actions 
rather than having the scripts also manually copy files about. 


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   >