[openwhisk] branch master updated: Remove explicit right biasing of Eithers. (#4848)

2020-03-29 Thread markusthoemmes
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
 new 1dc31b2  Remove explicit right biasing of Eithers. (#4848)
1dc31b2 is described below

commit 1dc31b271983d3bc703b98052d25967bd9bfb8db
Author: Markus Thömmes 
AuthorDate: Sun Mar 29 11:42:45 2020 +0200

Remove explicit right biasing of Eithers. (#4848)

* Remove usages of .right.get in production code.

- There's no reason parse the ContentType we fully control anyway, so let's 
just compose it and not think about non-existent errors at all.
- More explicit error handling where we actually need to parse.

* Remove explicit right biasing.

* Fix compilation error.

* Small improvement.

* Fix compile errors.
---
 .../src/main/scala/org/apache/openwhisk/common/Prometheus.scala  | 5 +++--
 .../org/apache/openwhisk/core/containerpool/Container.scala  | 2 +-
 .../org/apache/openwhisk/core/entity/ActivationResult.scala  | 4 +---
 .../scala/org/apache/openwhisk/core/entity/Attachments.scala | 9 -
 .../openwhisk/core/monitoring/metrics/PrometheusEventsApi.scala  | 5 +++--
 .../openwhisk/core/database/test/ExtendedCouchDbRestClient.scala | 5 ++---
 6 files changed, 14 insertions(+), 16 deletions(-)

diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/common/Prometheus.scala 
b/common/scala/src/main/scala/org/apache/openwhisk/common/Prometheus.scala
index 614f836..87dc46f 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/common/Prometheus.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/common/Prometheus.scala
@@ -18,7 +18,7 @@
 package org.apache.openwhisk.common
 import java.nio.charset.StandardCharsets.UTF_8
 
-import akka.http.scaladsl.model.{ContentType, HttpEntity}
+import akka.http.scaladsl.model.{ContentType, HttpCharsets, HttpEntity, 
MediaType}
 import akka.http.scaladsl.server.Directives._
 import akka.http.scaladsl.server.Route
 import kamon.Kamon
@@ -26,7 +26,8 @@ import kamon.prometheus.PrometheusReporter
 
 class KamonPrometheus extends AutoCloseable {
   private val reporter = new PrometheusReporter
-  private val v4 = ContentType.parse("text/plain; version=0.0.4; 
charset=utf-8").right.get
+  private val v4: ContentType = ContentType.apply(
+MediaType.textWithFixedCharset("plain", 
HttpCharsets.`UTF-8`).withParams(Map("version" -> "0.0.4")))
   Kamon.registerModule("prometheus", reporter)
 
   def route: Route = path("metrics") {
diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/Container.scala
 
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/Container.scala
index 20627fb..5080dae 100644
--- 
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/Container.scala
+++ 
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/Container.scala
@@ -261,7 +261,7 @@ case class Interval(start: Instant, end: Instant) {
 }
 
 case class RunResult(interval: Interval, response: 
Either[ContainerConnectionError, ContainerResponse]) {
-  def ok = response.right.exists(_.ok)
+  def ok = response.exists(_.ok)
   def toBriefString = response.fold(_.toString, _.toString)
 }
 
diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
 
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
index d3727c5..6a737d6 100644
--- 
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
+++ 
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
@@ -160,9 +160,7 @@ protected[core] object ActivationResponse extends 
DefaultJsonProtocol {
*/
   protected[core] def processInitResponseContent(response: 
Either[ContainerConnectionError, ContainerResponse],
  logger: Logging): 
ActivationResponse = {
-require(
-  response.isLeft || !response.right.exists(_.ok),
-  s"should not interpret init response when status code is OK")
+require(response.isLeft || !response.exists(_.ok), s"should not interpret 
init response when status code is OK")
 response match {
   case Right(ContainerResponse(code, str, truncated)) =>
 val sizeOpt = Option(str).map(_.length)
diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Attachments.scala
 
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Attachments.scala
index e8a18b5..c6b30c8 100644
--- 
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Attachments.scala
+++ 
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Attachments.scala
@@ -66,13 +66,12 @@ object Attachments {
 implicit val serdes = {
   implicit val contentTypeSerdes = new RootJsonFormat[ContentType] {
 

[openwhisk-wskdebug] branch refactor updated (f79f7b6 -> 493ce80)

2020-03-29 Thread alexkli
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a change to branch refactor
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git.


from f79f7b6  guard this.* access in Debugger.shutdown()/stop()/kill()
 add 493ce80  ensure latest yargs 15.3.0 is used as #17 depends on it

No new revisions were added by this update.

Summary of changes:
 package-lock.json | 14 +++---
 package.json  |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)



[openwhisk-wskdebug] branch refactor created (now fec686e)

2020-03-29 Thread alexkli
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a change to branch refactor
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git.


  at fec686e  refactor huge debugger.js into separate files & classes

This branch includes the following new commits:

 new fec686e  refactor huge debugger.js into separate files & classes

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.