Permalink
Browse files

More log messages

  • Loading branch information...
lefou committed Oct 26, 2018
1 parent a482886 commit 5e85af83b2f4a1c0e08f8cbfb450b0df97ed1306
@@ -200,7 +200,7 @@ trait CollectorService {
// Also register all required overlay configs
val ocs = getOverlayConfigs()
rolloutProfile.overlays.map { o =>
val oc = ocs.find(oc => oc.name == o.name && oc.version == o.version).get
val oc = ocs.find(oc => oc.overlayRef == o).get
addUpdateAction(
containerId = containerId,
updateAction = AddOverlayConfig(
@@ -4,24 +4,30 @@ import blended.updater.config._
import blended.util.logging.Logger
class RemoteUpdater(
runtimeConfigPersistor: RuntimeConfigPersistor,
containerStatePersistor: ContainerStatePersistor,
overlayConfigPersistor: OverlayConfigPersistor) {
runtimeConfigPersistor: RuntimeConfigPersistor,
containerStatePersistor: ContainerStatePersistor,
overlayConfigPersistor: OverlayConfigPersistor
) {
private[this] val log = Logger[RemoteUpdater]
type ContainerId = String
def addAction(containerId: ContainerId, action: UpdateAction): Unit = {
log.debug(s"About to add action [${action}] for container [${containerId}]")
val state = containerStatePersistor.findContainerState(containerId).getOrElse(ContainerState(containerId = containerId))
val actions = state.outstandingActions
log.debug(s"Found [${actions.size}] outstanding actions for container [${containerId}]")
val newActions =
if (!actions.exists {
_ == action
}) {
if (!actions.exists(_ == action)) {
actions ++ List(action)
} else actions
containerStatePersistor.updateContainerState(state.copy(outstandingActions = newActions))
} else {
log.debug("A same action was already scheduled")
actions
}
val newState = state.copy(outstandingActions = newActions)
log.debug(s"New container state [${newState}] with [${newState.outstandingActions.size}] outstanding actions")
containerStatePersistor.updateContainerState(newState)
}
def updateContainerState(containerInfo: ContainerInfo): ContainerState = {
@@ -39,18 +45,14 @@ class RemoteUpdater(
p.version == v &&
p.overlays.exists(po =>
po.state == OverlayState.Active &&
po.overlays.toSet == o.toSet
)
)
po.overlays.toSet == o.toSet))
case StageProfile(n, v, oc) =>
!containerProfiles.exists(p =>
p.name == n &&
p.version == v &&
p.overlays.exists(po =>
Set(OverlayState.Valid, OverlayState.Invalid, OverlayState.Active).exists(_ == po.state) &&
po.overlays.toSet == oc.toSet
)
)
po.overlays.toSet == oc.toSet))
case _ => true
}
@@ -81,19 +83,3 @@ class RemoteUpdater(
}

0 comments on commit 5e85af8

Please sign in to comment.