Skip to content

Commit 941ca44

Browse files
committed
Do not delete previous annotation
Currently, if passing another annotations, original previous annotation will be removed and the passed new annotations will be added. It may give users some confused that why my previous annotation gone. So it is better to not delete user's previous annotation when adding new annotation, but at the same time, need to provide a feature that support to delete annotation by user via ClI, e.g. wsk action update hello --del-annotation key1 --del-annotation key2 CLI side needs to support as well
1 parent 35f1a3e commit 941ca44

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ case class WhiskActionPut(exec: Option[Exec] = None,
5656
limits: Option[ActionLimitsOption] = None,
5757
version: Option[SemVer] = None,
5858
publish: Option[Boolean] = None,
59-
annotations: Option[Parameters] = None) {
59+
annotations: Option[Parameters] = None,
60+
delAnnotations: Option[Array[String]] = None) {
6061

6162
protected[core] def replace(exec: Exec) = {
6263
WhiskActionPut(Some(exec), parameters, limits, version, publish, annotations)
@@ -643,5 +644,5 @@ object ActionLimitsOption extends DefaultJsonProtocol {
643644
}
644645

645646
object WhiskActionPut extends DefaultJsonProtocol {
646-
implicit val serdes = jsonFormat6(WhiskActionPut.apply)
647+
implicit val serdes = jsonFormat7(WhiskActionPut.apply)
647648
}

core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala

+9-1
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,14 @@ trait WhiskActionsApi extends WhiskCollectionAPI with PostActionActivation with
537537

538538
val exec = content.exec getOrElse action.exec
539539

540+
var newAnnotations = action.annotations
541+
content.delAnnotations.map { annotationArray =>
542+
annotationArray.foreach { annotation =>
543+
newAnnotations -= annotation
544+
}
545+
}
546+
newAnnotations = newAnnotations ++ content.annotations
547+
540548
WhiskAction(
541549
action.namespace,
542550
action.name,
@@ -545,7 +553,7 @@ trait WhiskActionsApi extends WhiskCollectionAPI with PostActionActivation with
545553
limits,
546554
content.version getOrElse action.version.upPatch,
547555
content.publish getOrElse action.publish,
548-
WhiskActionsApi.amendAnnotations(content.annotations getOrElse action.annotations, exec, create = false))
556+
WhiskActionsApi.amendAnnotations(newAnnotations, exec, create = false))
549557
.revision[WhiskAction](action.docinfo.rev)
550558
}
551559

core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ object Controller {
262262

263263
val msgProvider = SpiLoader.get[MessagingProvider]
264264

265+
/*
265266
Seq(
266267
("completed" + instance.asString, "completed", Some(ActivationEntityLimit.MAX_ACTIVATION_LIMIT)),
267268
("health", "health", None),
@@ -271,7 +272,7 @@ object Controller {
271272
if (msgProvider.ensureTopic(config, topic, topicConfigurationKey, maxMessageBytes).isFailure) {
272273
abort(s"failure during msgProvider.ensureTopic for topic $topic")
273274
}
274-
}
275+
}*/
275276

276277
ExecManifest.initialize(config) match {
277278
case Success(_) =>

0 commit comments

Comments
 (0)