rabbah commented on a change in pull request #3215: adding namePrefix config to 
ContainerArgsConfig
URL: 
https://github.com/apache/incubator-openwhisk/pull/3215#discussion_r165655708
 
 

 ##########
 File path: 
common/scala/src/main/scala/whisk/core/containerpool/ContainerFactory.scala
 ##########
 @@ -50,6 +50,15 @@ trait ContainerFactory {
   def cleanup(): Unit
 }
 
+object ContainerFactory {
+
+  /** include the instance name, if specified and strip invalid chars before 
attempting to use them in the container name */
+  def containerNamePrefix(instanceId: InstanceId): String =
+    s"wsk${instanceId.name.getOrElse("")}${instanceId.toInt}"
+      .replaceAll("[^a-zA-Z0-9_\\.\\-]", "") // based on 
https://github.com/moby/moby/issues/3138 and 
https://github.com/moby/moby/blob/master/daemon/names/names.go
 
 Review comment:
   per my note above, instanceId.name may be an empty string `"    "` - this is 
replaced here so is harmless but i don't think was intended.

----------------------------------------------------------------
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

Reply via email to