(brooklyn-server) branch master updated: fix for intermittent initializer test failure, now that it might run async with creation
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new c10b07b151 fix for intermittent initializer test failure, now that it might run async with creation new b9ade38c0e Merge branch 'master' of https://gitbox.apache.org/repos/asf/brooklyn-server c10b07b151 is described below commit c10b07b15102a31ce3e02c5eab2682be8db4a1f4 Author: Alex Heneveld AuthorDate: Mon Jul 29 12:43:54 2024 +0100 fix for intermittent initializer test failure, now that it might run async with creation async initializer might not complete until after startup completes. notes on possible future enhancements. --- .../java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java | 5 + 1 file changed, 5 insertions(+) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java index 7b3ea599a2..b4c87bca07 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java @@ -217,6 +217,11 @@ public class WorkflowYamlTest extends AbstractYamlTest { waitForApplicationTasks(app); Entity entity = Iterables.getOnlyElement(app.getChildren()); + +// may need to wait for workflow initializer. TBC whether this should be part of a REST application start, or another REST method. +// (maybe the default rest application create started should wait for these prior to invoking start? maybe they should be tagged as initialization?) +waitForApplicationTasks(entity); + EntityAsserts.assertAttribute(entity, Sensors.newSensor(Object.class, "foo"), v -> { Asserts.assertInstanceOf(v, SpecialMap.class); Asserts.assertEquals( ((SpecialMap)v).x, "bar" );
(brooklyn-docs) branch master updated: fix a few broken links
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git The following commit(s) were added to refs/heads/master by this push: new d2973a65 fix a few broken links new ce38b397 Merge branch 'master' of github.com:apache/brooklyn-docs d2973a65 is described below commit d2973a65c27fb78003064de633b16eef2e954ba2 Author: Alex Heneveld AuthorDate: Mon Jul 22 11:04:22 2024 +0100 fix a few broken links --- guide/blueprints/chef/creating-blueprints.md | 2 +- guide/blueprints/winrm/client.md | 4 ++-- guide/locations/cloud-credentials.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/guide/blueprints/chef/creating-blueprints.md b/guide/blueprints/chef/creating-blueprints.md index 97397b9f..cafb5e1a 100644 --- a/guide/blueprints/chef/creating-blueprints.md +++ b/guide/blueprints/chef/creating-blueprints.md @@ -15,7 +15,7 @@ An illustrative example is below: *This works without any installation: try it now, copying-and-pasting to the Brooklyn console. (Don't forget to add your preferred `location: some-cloud` to the spec.)* -Notice, if you target `google-compute-engine` location, you may need to specify `bind_address: 0.0.0.0` for the `mysql` cookbook, as described [here](https://github.com/chef-cookbooks/mysql/blob/46dccac22d282a05ee6a401e10ae8f5f8114fd66/README.md#parameters). +Notice, if you target `google-compute-engine` location, you may need to specify `bind_address: 0.0.0.0` for the `mysql` cookbook, as described [here](https://github.com/sous-chefs/mysql/blob/main/documentation/resource_mysql_service.md#parameters). We'll now walk through the important constituent parts, and then proceed to describing things which can be done to simplify the deployment. diff --git a/guide/blueprints/winrm/client.md b/guide/blueprints/winrm/client.md index 24b3fc17..268248c7 100644 --- a/guide/blueprints/winrm/client.md +++ b/guide/blueprints/winrm/client.md @@ -5,8 +5,8 @@ layout: website-normal ## WinRM4j parameters -Check [org.apache.brooklyn.location.winrm.WinRmMachineLocation](https://github.com/apache/brooklyn-server/blob/master/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java#L82-L112) -parameters available for WinRM. +Per the `ConfigKey` entries in [org.apache.brooklyn.location.winrm.WinRmMachineLocation](https://github.com/apache/brooklyn-server/blob/master/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java), +the parameters available for WinRM are: * host : Host to connect to (required).Default value `null` * port : WinRM port to use when connecting to the remote machine. diff --git a/guide/locations/cloud-credentials.md b/guide/locations/cloud-credentials.md index 36041e0a..6809bbc7 100644 --- a/guide/locations/cloud-credentials.md +++ b/guide/locations/cloud-credentials.md @@ -3,4 +3,4 @@ title: More Clouds layout: website-normal --- -This page has moved. See [More Clouds](index.html#more-details-on-specific-clouds) instead. +This page has moved. See [More Clouds](../locations/index.md#more-details-on-specific-clouds) instead.
(brooklyn-docs) branch master updated (a842a61e -> b83355bf)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git from a842a61e Merge branch 'docs-for-attr-when-ready-options' add a5f3f64d remove section about legacy account as it is now fully retired new b83355bf Merge pull request #386 from zan-mateusz/remove-legacy-account-section 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. Summary of changes: guide/locations/_AWS.md | 51 - 1 file changed, 51 deletions(-)
(brooklyn-docs) 01/01: Merge pull request #386 from zan-mateusz/remove-legacy-account-section
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git commit b83355bf0ec0c2218cf4f190e1ffc301e8b614d5 Merge: a842a61e a5f3f64d Author: Alex Heneveld AuthorDate: Mon Jul 22 11:03:17 2024 +0100 Merge pull request #386 from zan-mateusz/remove-legacy-account-section remove section about legacy account as it is now fully retired guide/locations/_AWS.md | 51 - 1 file changed, 51 deletions(-)
(brooklyn-server) 01/01: Merge pull request #1417 from ahgittin/retry-move-if-access-denied
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit e1b0eeb618e597473f28197801b1a2c878cd53bb Merge: 1006bff329 424951d58a Author: Alex Heneveld AuthorDate: Mon Jul 22 09:23:16 2024 +0100 Merge pull request #1417 from ahgittin/retry-move-if-access-denied add a retry if file move has a transient access issue .../core/mgmt/persist/FileBasedObjectStore.java| 47 +++--- 1 file changed, 33 insertions(+), 14 deletions(-)
(brooklyn-server) branch master updated (1006bff329 -> e1b0eeb618)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 1006bff329 byon locations can be dynamic add 424951d58a add a retry if file move has a transient access issue new e1b0eeb618 Merge pull request #1417 from ahgittin/retry-move-if-access-denied 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. Summary of changes: .../core/mgmt/persist/FileBasedObjectStore.java| 47 +++--- 1 file changed, 33 insertions(+), 14 deletions(-)
(brooklyn-server) 02/02: byon locations can be dynamic
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 1006bff329d66683f503f347f248be5ec065dcfb Author: Alex Heneveld AuthorDate: Fri Jul 19 15:43:40 2024 +0100 byon locations can be dynamic --- .../camp/brooklyn/ByonLocationsYamlTest.java | 35 ++- .../location/byon/ByonLocationResolver.java| 10 ++-- .../byon/FixedListMachineProvisioningLocation.java | 67 -- 3 files changed, 90 insertions(+), 22 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java index 6cab0ebb06..e76712b158 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java @@ -28,13 +28,16 @@ import java.util.Set; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.MachineLocation; +import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.LocationPredicates; import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.core.location.access.PortForwardManager; import org.apache.brooklyn.core.location.access.PortForwardManagerLocationResolver; import org.apache.brooklyn.core.location.cloud.CloudLocationConfig; +import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.entity.software.base.DoNothingSoftwareProcess; import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation; import org.apache.brooklyn.location.ssh.SshMachineLocation; @@ -42,6 +45,8 @@ import org.apache.brooklyn.location.winrm.WinRmMachineLocation; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.net.UserAndHostAndPort; +import org.apache.brooklyn.util.time.Duration; +import org.apache.brooklyn.util.time.Time; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; @@ -121,6 +126,34 @@ public class ByonLocationsYamlTest extends AbstractYamlTest { assertMachine(machine, UserAndHostAndPort.fromParts(machine.getUser(), "1.2.3.4", 22), Collections.emptyMap()); } +@Test +@SuppressWarnings("unchecked") +public void testByonMachineResolvesDynamicDependentConfigForHost() throws Exception { +String yaml = Joiner.on("\n").join( +"location:", +" byon:", +"hosts:", +"- $brooklyn:attributeWhenReady(\"ip_address\")", +"services:", +"- type: org.apache.brooklyn.entity.software.base.DoNothingSoftwareProcess" +); + +Entity app = createApplicationUnstarted(yaml); +Task start = app.invoke(Startable.START, null); +Time.sleep(Duration.millis(100)); +Asserts.assertFalse(start.isDone()); + + Iterables.getOnlyElement(app.getChildren()).sensors().set(Sensors.newStringSensor("ip_address"), "1.2.3.4"); +start.getUnchecked(); +start.getUnchecked(Duration.seconds(5)); + +FixedListMachineProvisioningLocation loc = (FixedListMachineProvisioningLocation) Iterables.get(app.getLocations(), 0); + +Set machines = loc.getAllMachines(); +SshMachineLocation machine = Iterables.getOnlyElement(machines); +assertMachine(machine, UserAndHostAndPort.fromParts(machine.getUser(), "1.2.3.4", 22), Collections.emptyMap()); +} + @Test @SuppressWarnings("unchecked") public void testByonMachineResolvesDependentConfigForHosts() throws Exception { @@ -357,7 +390,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest { Entity app = createStartWaitAndLogApplication(yaml); Asserts.shouldHaveFailedPreviously("app="+app); } catch (Exception e) { -Asserts.expectedFailureContains(e, "Invalid location", "byon", "at least one host must be defined"); +Asserts.expectedFailureContains(e, "Invalid location", "byon", "hosts must be defined"); } } diff --git a/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java b/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java index 26d42fd0a6..f219434c32 100644 --- a/core/src/main/jav
(brooklyn-server) branch master updated (29069e9da1 -> 1006bff329)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 29069e9da1 allow AttrWhenReadyOptions fields to be edited new f887c9afd8 don't allow blocking when entities are creating new 1006bff329 byon locations can be dynamic The 2 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. Summary of changes: .../spi/dsl/BrooklynDslDeferredSupplier.java | 4 +- .../camp/brooklyn/ByonLocationsYamlTest.java | 35 ++- .../mgmt/internal/LocalSubscriptionManager.java| 18 +++--- .../core/objs/proxy/InternalEntityFactory.java | 39 +++-- .../core/workflow/WorkflowInitializer.java | 17 +- .../core/workflow/WorkflowStepResolution.java | 7 ++- .../location/byon/ByonLocationResolver.java| 10 ++-- .../byon/FixedListMachineProvisioningLocation.java | 67 -- .../org/apache/brooklyn/util/concurrent/Locks.java | 15 - 9 files changed, 169 insertions(+), 43 deletions(-)
(brooklyn-server) 01/02: don't allow blocking when entities are creating
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit f887c9afd8b10642e53b8a2ada7a418697c4c6db Author: Alex Heneveld AuthorDate: Fri Jul 19 15:28:19 2024 +0100 don't allow blocking when entities are creating --- .../spi/dsl/BrooklynDslDeferredSupplier.java | 4 +-- .../mgmt/internal/LocalSubscriptionManager.java| 18 ++ .../core/objs/proxy/InternalEntityFactory.java | 39 +++--- .../core/workflow/WorkflowInitializer.java | 17 -- .../core/workflow/WorkflowStepResolution.java | 7 ++-- .../org/apache/brooklyn/util/concurrent/Locks.java | 15 +++-- 6 files changed, 79 insertions(+), 21 deletions(-) diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java index 971e571c09..ea4b3ce02f 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java @@ -125,8 +125,8 @@ public abstract class BrooklynDslDeferredSupplier implements DeferredSupplier Task task = newTask(); T result; try { -result = exec.submit(task).get(); -} catch (InterruptedException | ExecutionException e) { +result = exec.get(task); +} catch (Exception e) { Task currentTask = Tasks.current(); if (currentTask != null && currentTask.isCancelled()) { task.cancel(true); diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java index 6a6b1f21fb..6d17612616 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java @@ -25,10 +25,7 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.Multimaps; import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.mgmt.ExecutionContext; -import org.apache.brooklyn.api.mgmt.ExecutionManager; -import org.apache.brooklyn.api.mgmt.SubscriptionHandle; -import org.apache.brooklyn.api.mgmt.SubscriptionManager; +import org.apache.brooklyn.api.mgmt.*; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Sensor; import org.apache.brooklyn.api.sensor.SensorEvent; @@ -42,6 +39,7 @@ import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.task.BasicExecutionContext; import org.apache.brooklyn.util.core.task.BasicExecutionManager; +import org.apache.brooklyn.util.core.task.BasicTask; import org.apache.brooklyn.util.core.task.SingleThreadedScheduler; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.text.Identifiers; @@ -166,7 +164,7 @@ public class LocalSubscriptionManager extends AbstractSubscriptionManager { if (notifyOfInitialValue) { if (LOG.isTraceEnabled()) LOG.trace("sending initial value of {} -> {} to {}", new Object[] {s.producer, s.sensor, s}); -// this is run asynchronously to prevent deadlock when trying to get attribute and publish; +// after entity creation, this is run asynchronously to prevent deadlock when trying to get attribute and publish; // however we want it: // (a) to run in the same order as subscriptions are made, so use the manager tag scheduler // (b) ideally to use the last value that was not published to this target, and @@ -179,8 +177,10 @@ public class LocalSubscriptionManager extends AbstractSubscriptionManager { // window between adding the subscription and taking the last value, // we will think the last value hasn't changed. but we will never send a // wrong value as this backs out if there is any confusion over the last value. -em.submit( -MutableMap.of("tags", getPublishTags(s, s.producer), +// while the entity is being created, it should run in the same thread. +boolean isPreManagement = s.producer!=null && !((EntityInternal)s.producer).getManagementSupport().wasDeployed(); + +Task t = new BasicTask(MutableMap.of("tags", getPublishTags(s, s.producer), "displayName", "
(brooklyn-server) branch master updated: allow AttrWhenReadyOptions fields to be edited
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 29069e9da1 allow AttrWhenReadyOptions fields to be edited 29069e9da1 is described below commit 29069e9da1245f48075ee2a35951c69a064e2863 Author: Alex Heneveld AuthorDate: Fri Jul 19 13:37:58 2024 +0100 allow AttrWhenReadyOptions fields to be edited --- .../org/apache/brooklyn/core/sensor/DependentConfiguration.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java index e29cc3ee10..c95cf7e68e 100644 --- a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java +++ b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java @@ -138,13 +138,13 @@ public class DependentConfiguration { public static class AttributeWhenReadyOptions { @JsonAlias("timeoutIfDown") -Duration timeout_if_down; -Duration timeout; +public Duration timeout_if_down; +public Duration timeout; @JsonAlias("abortIfOnFire") -boolean abort_if_on_fire = true; +public boolean abort_if_on_fire = true; @JsonAlias("waitForTruthy") -boolean wait_for_truthy = true; +public boolean wait_for_truthy = true; public static AttributeWhenReadyOptions defaultOptions() { AttributeWhenReadyOptions result = new AttributeWhenReadyOptions();
(brooklyn-docs) branch master updated: document the new attributeWhenReady options
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git The following commit(s) were added to refs/heads/master by this push: new 38c72b2b document the new attributeWhenReady options new a842a61e Merge branch 'docs-for-attr-when-ready-options' 38c72b2b is described below commit 38c72b2b80dd3584b190192e6e7853b803a5705a Author: Alex Heneveld AuthorDate: Wed Jul 17 13:02:19 2024 +0100 document the new attributeWhenReady options --- guide/blueprints/yaml-reference.md | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/guide/blueprints/yaml-reference.md b/guide/blueprints/yaml-reference.md index 6a4d1d97..e16cc753 100644 --- a/guide/blueprints/yaml-reference.md +++ b/guide/blueprints/yaml-reference.md @@ -236,7 +236,10 @@ concise DSL defined here: * `$brooklyn:attributeWhenReady("sensor")` will store a future which will be blocked when it is accessed, until the given `sensor` from this entity "truthy" (i.e. non-trivial, non-empty, non-zero) value - (see below on `component` for looking up values on other sensors) + (see below on `component` for looking up values on other sensors); + this can take a second argument being a map of options `timeout`, `timeout_if_down`, `abort_if_on_fire` (default `true`), + and `wait_for_truthy` (default `true`); + the default is `{ $brooklyn:attributeWhenReady: [ "sensor", { timeout: "forever", timeouf_if_down: "1m" } ] }` * `$brooklyn:config("key")` will insert the value set against the given key at this entity (or nearest ancestor); can be used to supply config at the root which is used in multiple places in the plan * `$brooklyn:sensor("sensor.name")` returns the given sensor on the current entity if found, or an untyped (Object) sensor; @@ -283,6 +286,8 @@ concise DSL defined here: using the simple Jackson deserialization in the `EntitySpec` class (this is similar to CAMP but is not as extensive, and other formats are not supported in coercion; if there are any issues with a direct map, consider wrapping it in the `$brooklyn:entitySpec` DSL) +* `$brooklyn:chain: [ dsl, chained_function ]` allows chaining another `dsl` expression with a function on the result of that expression, + identical to using `dsl.chained_function` but for cases where one or the other requires list or maps Parameters above can be supplied either as strings or as lists and maps in YAML, and the `$brooklyn:` syntax can be used within those parameters.
(brooklyn-server) branch master updated: tidy-up of attributeWhenReady options, and tests
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 2a56281088 tidy-up of attributeWhenReady options, and tests 2a56281088 is described below commit 2a56281088ef0a0035196523e33bf4f8d57161a1 Author: Alex Heneveld AuthorDate: Fri Jul 19 11:39:55 2024 +0100 tidy-up of attributeWhenReady options, and tests --- .../brooklyn/camp/brooklyn/ConfigYamlTest.java | 240 ++--- .../core/sensor/DependentConfiguration.java| 160 -- 2 files changed, 312 insertions(+), 88 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java index 8b819ba880..777310d6d1 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java @@ -19,47 +19,42 @@ package org.apache.brooklyn.camp.brooklyn; import com.google.common.annotations.Beta; -import java.util.Map; - +import com.google.common.base.Joiner; import com.google.common.base.Stopwatch; -import org.apache.brooklyn.core.config.Sanitizer; -import org.apache.brooklyn.core.entity.EntityAsserts; -import org.apache.brooklyn.core.internal.BrooklynProperties; -import org.apache.brooklyn.core.server.BrooklynServerConfig; -import org.apache.brooklyn.util.guava.Maybe; -import org.apache.brooklyn.util.internal.BrooklynSystemProperties; -import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes; -import org.apache.brooklyn.util.yaml.Yamls; -import org.testng.Assert; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.config.Sanitizer; +import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.core.server.BrooklynServerConfig; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException; +import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; +import org.apache.brooklyn.util.yaml.Yamls; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.testng.Assert.*; public class ConfigYamlTest extends AbstractYamlTest { @@ -436,7 +431,7 @@ public class ConfigYamlTest extends AbstractYamlTest { } @Test -public void testAttributeWhenReadyOptions() throws Exception { +public void testAttributeWhenReadyOptionsBasic() throws Exception { String yaml = Joiner.on("\n").join( "services:", "- type: org.apache.brooklyn.core.test.entity.TestEntity", @@ -457,7 +452,7 @@ public class ConfigYamlTest extends AbstractYamlTest { } @Test -public void testOtherEntityAttributeWhenReadyOptions() throws Exception { +public void testAttributeWhenReadyOptionsBasicOnOtherEntity() throws Exception { String v0 = "{ $brooklyn:chain: [ $brooklyn:entity(\"entity2\"), { attributeWhenReady: [ \"test.name\", { timeout: 10ms } ] } ] }"; String v1 = "{ $brooklyn:chain: [ $brooklyn:entity(\"entity2\"), { attributeWhenReady: [ \"test.name\", { \"timeout\": \"10ms\" } ] } ] }&q
(brooklyn-server) 03/04: expose an attributeWhenReadyAllowingOnFire
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit aef8b330e6a3874bf77dfe458ce46e7c6a77624a Author: Alex Heneveld AuthorDate: Wed Jul 17 15:48:12 2024 +0100 expose an attributeWhenReadyAllowingOnFire --- .../brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java | 4 .../brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java | 8 .../org/apache/brooklyn/core/sensor/DependentConfiguration.java | 4 3 files changed, 16 insertions(+) diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java index b22207cb67..bd6790450a 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java @@ -330,6 +330,10 @@ public class BrooklynDslCommon { return attributeWhenReady(sensorName, null); } @DslAccessible +public BrooklynDslDeferredSupplier attributeWhenReadyAllowingOnFire(final Object sensorName) { +return attributeWhenReady(sensorName, DependentConfiguration.AttributeWhenReadyOptions.allowingOnFireMap()); +} +@DslAccessible public static BrooklynDslDeferredSupplier attributeWhenReady(final Object sensorName, Map options) { return new DslComponent(Scope.THIS, "").attributeWhenReady(sensorName, options); } diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java index cb0e14c382..7d3ef9f0c1 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java @@ -657,6 +657,10 @@ public class DslComponent extends BrooklynDslDeferredSupplier implements return new AttributeWhenReady(this, sensorNameOrSupplier); } @DslAccessible +public BrooklynDslDeferredSupplier attributeWhenReadyAllowingOnFire(final Object sensorNameOrSupplier) { +return new AttributeWhenReady(this, sensorNameOrSupplier, DependentConfiguration.AttributeWhenReadyOptions.allowingOnFireMap()); +} +@DslAccessible public BrooklynDslDeferredSupplier attributeWhenReady(final Object sensorNameOrSupplier, Map options) { return new AttributeWhenReady(this, sensorNameOrSupplier, options); } @@ -747,6 +751,10 @@ public class DslComponent extends BrooklynDslDeferredSupplier implements } @Override public String toDslString(boolean yamlAllowed) { +if (options!=null && DependentConfiguration.AttributeWhenReadyOptions.allowingOnFireMap().equals(options)) { +return DslToStringHelpers.chainFunctionOnComponent1(yamlAllowed, component, +"attributeWhenReadyAllowingOnFire", sensorName); +} return DslToStringHelpers.chainFunctionOnComponent(yamlAllowed, component, "attributeWhenReady", MutableList.of(sensorName).appendIfNotNull(options)); } diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java index eef904bb22..39567f8116 100644 --- a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java +++ b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java @@ -169,6 +169,10 @@ public class DependentConfiguration { result.timeoutIfDown = Duration.ONE_MINUTE; return result; } + +public static Map allowingOnFireMap() { +return MutableMap.of("timeout", "forever"); +} } public static Task attributeWhenReady(final Entity source, final AttributeSensor sensor, AttributeWhenReadyOptions options) {
(brooklyn-server) branch master updated (e1f4a41d28 -> 0e4e943976)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from e1f4a41d28 service up wait tidy up new 930309ccd1 add basic attr when ready options new 33a68bd303 add support for dsl to take maps as function args, and to chain when necessary new aef8b330e6 expose an attributeWhenReadyAllowingOnFire new 0e4e943976 Merge branch 'attr-when-ready-options' The 4 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. Summary of changes: .../spi/dsl/BrooklynDslDeferredSupplier.java | 10 ++ .../brooklyn/spi/dsl/DslDeferredFunctionCall.java | 13 +- .../spi/dsl/DslDeferredPropertyAccess.java | 13 +- .../spi/dsl/methods/BrooklynDslCommon.java | 137 + .../brooklyn/spi/dsl/methods/DslComponent.java | 89 +++-- .../spi/dsl/methods/DslToStringHelpers.java| 123 ++ .../brooklyn/camp/brooklyn/ConfigYamlTest.java | 55 + .../core/entity/lifecycle/ServiceStateLogic.java | 2 +- .../core/sensor/DependentConfiguration.java| 40 +- 9 files changed, 365 insertions(+), 117 deletions(-)
(brooklyn-server) 01/04: add basic attr when ready options
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 930309ccd1cecd03d9ef2349b28e374d704ce0a8 Author: Alex Heneveld AuthorDate: Wed Jul 17 14:59:28 2024 +0100 add basic attr when ready options --- .../core/sensor/DependentConfiguration.java| 36 -- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java index eb4ee249fa..eef904bb22 100644 --- a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java +++ b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java @@ -148,7 +148,6 @@ public class DependentConfiguration { Builder builder = builder().attributeWhenReady(source, sensor); if (ready != null) builder.readiness(ready); return builder.build(); - } /** as {@link #attributeWhenReady(Entity, AttributeSensor, Predicate)} but with no timeout and not aborting if the entity goes on fire. */ @@ -159,6 +158,23 @@ public class DependentConfiguration { } +public static class AttributeWhenReadyOptions { +Duration timeoutIfOnFire; +Duration timeoutIfDown; +Duration timeout; + +public static AttributeWhenReadyOptions defaultOptions() { +AttributeWhenReadyOptions result = new AttributeWhenReadyOptions(); +result.timeoutIfOnFire = Duration.ZERO; +result.timeoutIfDown = Duration.ONE_MINUTE; +return result; +} +} + +public static Task attributeWhenReady(final Entity source, final AttributeSensor sensor, AttributeWhenReadyOptions options) { +return builder().attributeWhenReady(source, sensor).options(options).build(); +} + /** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @@ -871,7 +887,7 @@ public class DependentConfiguration { * then it will timeout after 1 minute. */ public Builder attributeWhenReady(Entity source, AttributeSensor sensor) { -return new Builder(source, sensor).abortIfOnFire().timeoutIfStoppingOrDestroyed(Duration.ONE_MINUTE); +return new Builder(source, sensor).options(AttributeWhenReadyOptions.defaultOptions()); } /** @@ -961,6 +977,20 @@ public class DependentConfiguration { timeoutIf(source, Attributes.SERVICE_STATE_ACTUAL, Predicates.equalTo(Lifecycle.DESTROYED), time); return this; } +public Builder options(AttributeWhenReadyOptions options) { +if (options!=null) { +if (options.timeout!=null) { +timeout(options.timeout); +} +if (options.timeoutIfOnFire!=null) { +if (Duration.ZERO.equals(options.timeoutIfOnFire)) abortIfOnFire(); +else timeoutIf(source, Attributes.SERVICE_STATE_ACTUAL, Predicates.equalTo(Lifecycle.ON_FIRE), options.timeoutIfOnFire); +} +if (options.timeoutIfDown!=null) timeoutIfStoppingOrDestroyed(options.timeoutIfDown); +} +return this; +} + public Builder blockingDetails(String val) { blockingDetails = val; return this; @@ -972,6 +1002,8 @@ public class DependentConfiguration { } /** specifies the supplied timeout if the condition is met */ public Builder timeoutIf(Entity source, AttributeSensor sensor, Predicate predicate, Duration val) { +// TODO these only apply to the target entity's state at initialization time; +// it would be nice to store these and recheck periodically in case state changes subsequently (either from down to up or up to down) if (predicate.apply(source.sensors().get(sensor))) timeout(val); return this; }
(brooklyn-server) 02/04: add support for dsl to take maps as function args, and to chain when necessary
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 33a68bd303689f99dd4fd7e29c030aeb8ecf5d97 Author: Alex Heneveld AuthorDate: Wed Jul 17 14:59:52 2024 +0100 add support for dsl to take maps as function args, and to chain when necessary --- .../spi/dsl/BrooklynDslDeferredSupplier.java | 10 ++ .../brooklyn/spi/dsl/DslDeferredFunctionCall.java | 13 +- .../spi/dsl/DslDeferredPropertyAccess.java | 13 +- .../spi/dsl/methods/BrooklynDslCommon.java | 133 + .../brooklyn/spi/dsl/methods/DslComponent.java | 81 +++-- .../spi/dsl/methods/DslToStringHelpers.java| 123 +++ .../brooklyn/camp/brooklyn/ConfigYamlTest.java | 55 + .../core/entity/lifecycle/ServiceStateLogic.java | 2 +- 8 files changed, 315 insertions(+), 115 deletions(-) diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java index 04eee1cb34..971e571c09 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java @@ -161,4 +161,14 @@ public abstract class BrooklynDslDeferredSupplier implements DeferredSupplier Tasks.addTagDynamically(tag); } + +public String toString() { +try { +return toDslString(false); +} catch (DslToStringHelpers.YamlSyntaxRequired e) { +return toDslString(true); +} +} + +public abstract String toDslString(boolean yamlAllowed); } diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java index 5d90cb63b7..9c24474805 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java @@ -28,6 +28,7 @@ import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon; import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslToStringHelpers; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; +import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.core.task.ImmediateSupplier; import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.core.task.ValueResolver; @@ -170,7 +171,13 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier instanceArgs = ImmutableList.builder().add(obj).addAll(args).build(); method = Reflections.getMethodFromArgs(instance, fnName, instanceArgs); if (method.isPresent()) return ; - + +method = Reflections.findMethodMaybe((Class)instance, fnName, List.class); +if (method.isPresent()) { +instanceArgs = ImmutableList.of(args); +return; +} + Maybe facade; try { facade = Reflections.invokeMethodFromArgs(BrooklynDslCommon.DslFacades.class, "wrap", ImmutableList.of(obj)); @@ -239,11 +246,11 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier } @Override -public String toString() { +public String toDslString(boolean yamlAllowed) { // prefer the dsl set on us, if set if (dsl instanceof String && Strings.isNonBlank((String)dsl)) return (String)dsl; -return DslToStringHelpers.fn(DslToStringHelpers.internal(object) + "." + fnName, args); +return DslToStringHelpers.chainFunction(yamlAllowed, object, fnName, args); } } diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredPropertyAccess.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredPropertyAccess.java index f5f9a17719..5cbcdd8f66 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredPropertyAccess.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredPropertyAccess.java @@ -21,6 +21,7 @@ package org.apache.brooklyn.camp.brooklyn.spi.dsl; import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.api.objs.Configurable; +import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods
(brooklyn-server) 04/04: Merge branch 'attr-when-ready-options'
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 0e4e9439760e6d72f8c8dbc8cce099d1c7673506 Merge: e1f4a41d28 aef8b330e6 Author: Alex Heneveld AuthorDate: Wed Jul 17 17:19:10 2024 +0100 Merge branch 'attr-when-ready-options' .../spi/dsl/BrooklynDslDeferredSupplier.java | 10 ++ .../brooklyn/spi/dsl/DslDeferredFunctionCall.java | 13 +- .../spi/dsl/DslDeferredPropertyAccess.java | 13 +- .../spi/dsl/methods/BrooklynDslCommon.java | 137 + .../brooklyn/spi/dsl/methods/DslComponent.java | 89 +++-- .../spi/dsl/methods/DslToStringHelpers.java| 123 ++ .../brooklyn/camp/brooklyn/ConfigYamlTest.java | 55 + .../core/entity/lifecycle/ServiceStateLogic.java | 2 +- .../core/sensor/DependentConfiguration.java| 40 +- 9 files changed, 365 insertions(+), 117 deletions(-)
(brooklyn-client) 01/01: Merge pull request #104 from iuliana/upgrade
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-client.git commit caa1d227667cb660c2d811c27992a3bef8a42487 Merge: 93d8160 6331a53 Author: Alex Heneveld AuthorDate: Wed Jul 17 12:16:23 2024 +0100 Merge pull request #104 from iuliana/upgrade Upgraded Go version an Go dependencies versions Dockerfile| 10 +- cli/README.md | 1 - cli/go.mod| 16 cli/go.sum| 28 ++-- 4 files changed, 27 insertions(+), 28 deletions(-)
(brooklyn) branch master updated (3ea4c8a -> 4f253cc)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn.git from 3ea4c8a added sdkman config file add 956e041 Upgraded Go version add 29e7b84 updated checksum new 4f253cc Merge pull request #59 from iuliana/upgrade-go 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. Summary of changes: Dockerfile | 10 +- brooklyn-client | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
(brooklyn) 01/01: Merge pull request #59 from iuliana/upgrade-go
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn.git commit 4f253ccf3ab63870c04c6a0386122de77c904908 Merge: 3ea4c8a 29e7b84 Author: Alex Heneveld AuthorDate: Wed Jul 17 12:16:26 2024 +0100 Merge pull request #59 from iuliana/upgrade-go Upgraded Go version Dockerfile | 10 +- brooklyn-client | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
(brooklyn-client) branch master updated (93d8160 -> caa1d22)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-client.git from 93d8160 Change version to 1.2.0-SNAPSHOT add 9bd72e1 Upgraded Go version an Go dependencies versions add 6331a53 upgraded Go in Docker file new caa1d22 Merge pull request #104 from iuliana/upgrade 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. Summary of changes: Dockerfile| 10 +- cli/README.md | 1 - cli/go.mod| 16 cli/go.sum| 28 ++-- 4 files changed, 27 insertions(+), 28 deletions(-)
(brooklyn-ui) branch master updated (20ba7e71 -> b5960c21)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from 20ba7e71 make quick launch deploy act exactly like catalog deploy add 3985fab7 add a leading slash to use absolute path in ha/persist/import new b5960c21 Merge pull request #388 from zan-mateusz/fix/absolute-path-for-persistence-import-call 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. Summary of changes: ui-modules/utils/api/brooklyn/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(brooklyn-ui) 01/01: Merge pull request #388 from zan-mateusz/fix/absolute-path-for-persistence-import-call
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit b5960c211b211479e50209022210469539e686f8 Merge: 20ba7e71 3985fab7 Author: Alex Heneveld AuthorDate: Mon Jul 15 22:41:49 2024 +0100 Merge pull request #388 from zan-mateusz/fix/absolute-path-for-persistence-import-call add a leading slash to use absolute path in ha/persist/import ui-modules/utils/api/brooklyn/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(brooklyn-docs) 01/01: Merge pull request #378 from nakomis/ternary-operator
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git commit 869d5d44be22d30a2d9acb8aaecc249a31a028d7 Merge: bb1e516a 7d8b9a1d Author: Alex Heneveld AuthorDate: Mon Jul 15 22:36:10 2024 +0100 Merge pull request #378 from nakomis/ternary-operator Adds docs for ternary operator guide/blueprints/workflow/variables.md | 6 ++ 1 file changed, 6 insertions(+) diff --cc guide/blueprints/workflow/variables.md index a2b421bb,80dc23d8..1780bfe2 --- a/guide/blueprints/workflow/variables.md +++ b/guide/blueprints/workflow/variables.md @@@ -201,24 -200,18 +201,30 @@@ A limited number of other operations i namely the basic mathematical operands `+`, `-`, `*`, and `/` for integers and doubles, and the modulo operator `%` for integers giving the remainder. These are evaluated in usual mathematical order. + The ternary `?` operator is supported as follows: + + ``` + - let x = ? : + ``` + Parentheses are not supported. -The `transform` step can be used for more complicated transformations, such as whether to `wait` on values that are not yet ready, -conversion using `json` and `yaml`, and whether to `trim` strings or yaml documents. -This supports two types of trimming: if a `type` is specified, the value is scanned for `---` on a line by itself -and that token is used as a "document separator", and only the last document is considered; +The `transform` step can be used for more complicated transformations, such as +to `wait` on values that are not yet ready, +to convert `json` and `yaml`, to `trim` strings, merge lists and maps, and much more. +For example: + +``` +- transform x = " [ a, b ] " | trim` # sets x to the string '[ a, b ]' +- transform y = ${x} | json` # sets y to the list of strings '[ "a", "b" ]' +- step: transform | merge | set z` # sets z to the list of strings '[ "a", "b", "c" ]' + value: + - ${x} + - [ c ] +``` + +The `yaml` transform will treat a `---` on a line by itself +as a "document separator", and only the last document is considered; if no `type` is specified, the value has leading and trailing whitespace removed. The former is primarily intended for YAML processing from a script which might include unwanted output prior to the outputting the YAML intended to set in the variable: the script can do `echo ---` before the
(brooklyn-docs) branch master updated (bb1e516a -> 869d5d44)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git from bb1e516a Merge pull request #384 from zan-mateusz/doc-fixes add 7d8b9a1d Adds docs for ternary operator new 869d5d44 Merge pull request #378 from nakomis/ternary-operator 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. Summary of changes: guide/blueprints/workflow/variables.md | 6 ++ 1 file changed, 6 insertions(+)
(brooklyn-server) branch master updated: service up wait tidy up
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new e1f4a41d28 service up wait tidy up e1f4a41d28 is described below commit e1f4a41d2863add5c24e4ead2e6dc32aece3fac0 Author: Alex Heneveld AuthorDate: Mon Jul 15 22:33:40 2024 +0100 service up wait tidy up don't recompute service up if the trigger was service up --- .../core/entity/lifecycle/ServiceStateLogic.java | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java index e64b6a7f86..5ded2a7033 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java @@ -57,7 +57,6 @@ import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.sensor.BasicSensorEvent; import org.apache.brooklyn.enricher.stock.AbstractMultipleSensorAggregator; import org.apache.brooklyn.enricher.stock.Enrichers; -import org.apache.brooklyn.enricher.stock.Transformer; import org.apache.brooklyn.enricher.stock.UpdatingMap; import org.apache.brooklyn.util.collections.CollectionFunctionals; import org.apache.brooklyn.util.collections.MutableList; @@ -68,7 +67,6 @@ import org.apache.brooklyn.util.collections.QuorumCheck.QuorumChecks; import org.apache.brooklyn.util.core.task.ValueResolver; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.guava.Functionals; -import org.apache.brooklyn.util.guava.IfFunctions; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.repeat.Repeater; import org.apache.brooklyn.util.text.Strings; @@ -185,10 +183,11 @@ public class ServiceStateLogic { private static void waitBrieflyForServiceUpIfStateIsRunning(String when, Entity entity, Lifecycle state) { if (state==Lifecycle.RUNNING) { -log.debug("Service is not up when setting "+ state +" when "+when+" on " + entity+", but possibly just needs a recompute; doing recompute now"); - Boolean up = entity.getAttribute(Attributes.SERVICE_UP); if (!Boolean.TRUE.equals(up) && Entities.isManagedActive(entity)) { + +log.debug("Service is not up when setting "+ state +" when "+when+" on " + entity+", but possibly just needs a recompute; doing recompute now"); + try { Iterables.filter(entity.enrichers(), x -> x instanceof ComputeServiceIndicatorsFromChildrenAndMembers).forEach( x -> { @@ -204,10 +203,10 @@ public class ServiceStateLogic { if (notUpIndicators == null || notUpIndicators.isEmpty()) { Maybe css = EntityAdjuncts.tryFindWithUniqueTag(entity.enrichers(), ServiceNotUpLogic.DEFAULT_ENRICHER_UNIQUE_TAG); if (css.isPresent()) { -log.debug("Service not up pre-check recompute rerunning "+css); SensorEvent> pseudoEvent = new BasicSensorEvent<>(Attributes.SERVICE_NOT_UP_INDICATORS, entity, notUpIndicators); ((SensorEventListener) css.get()).onEvent(pseudoEvent); up = entity.getAttribute(Attributes.SERVICE_UP); +log.debug("Service not up pre-check recompute ran, service.isUp="+up+" after: "+css); } } else { log.debug("Service not up pre-check recompute not running because not up indicators are: " + notUpIndicators); @@ -316,7 +315,7 @@ public class ServiceStateLogic { /** Enricher which sets {@link Attributes#SERVICE_STATE_ACTUAL} on changes to * {@link Attributes#SERVICE_STATE_EXPECTED}, {@link Attributes#SERVICE_PROBLEMS}, and {@link Attributes#SERVICE_UP} * - * The default implementation uses {@link #computeActualStateWhenExpectedRunning()} if the last expected transition + * The default implementation uses {@link #computeActualStateWhenExpectedRunning(SensorEvent)} if the last expected transition * was to {@link Lifecycle#RUNNING} and * {@link #computeActualStateWhenNotExpectedRunning(org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition)} otherwise. * If these methods return null, the {@link Attributes#SERVICE_STATE_ACTUAL} sensor will be cleared (removed). @@ -361,13 +360,13 @@ public class ServiceStateLogic { Lifecycle.T
(brooklyn-server) branch master updated: allow user in byon to be dynamic
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new f018049b3f allow user in byon to be dynamic f018049b3f is described below commit f018049b3f425240af9bcde14a4e26244f61aef4 Author: Alex Heneveld AuthorDate: Mon Jul 15 15:10:47 2024 +0100 allow user in byon to be dynamic --- .../camp/brooklyn/ByonLocationsYamlTest.java | 23 + .../location/byon/ByonLocationResolver.java| 24 ++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java index a57670015e..6cab0ebb06 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java @@ -165,6 +165,29 @@ public class ByonLocationsYamlTest extends AbstractYamlTest { assertMachine(machine, UserAndHostAndPort.fromParts("Beth", "1.2.3.4", 22), Collections.emptyMap()); } +@Test +@SuppressWarnings("unchecked") +public void testByonMachineResolvesDependentConfigForHostWithUser() throws Exception { +String yaml = Joiner.on("\n").join( +"location:", +" byon:", +"hosts:", +" - ssh: 1.2.3.4", +"user: $brooklyn:config(\"uzer\")", +"services:", +"- type: org.apache.brooklyn.entity.stock.BasicApplication", +" brooklyn.config:", +"uzer: Beth" +); + +Entity app = createStartWaitAndLogApplication(yaml); +FixedListMachineProvisioningLocation loc = (FixedListMachineProvisioningLocation) Iterables.get(app.getLocations(), 0); + +Set machines = loc.getAvailable(); +SshMachineLocation machine = Iterables.getOnlyElement(machines); +assertMachine(machine, UserAndHostAndPort.fromParts("Beth", "1.2.3.4", 22), Collections.emptyMap()); +} + @Test @SuppressWarnings("unchecked") public void testByonWindowsMachine() throws Exception { diff --git a/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java b/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java index ba361e38b6..26d42fd0a6 100644 --- a/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java +++ b/core/src/main/java/org/apache/brooklyn/location/byon/ByonLocationResolver.java @@ -24,7 +24,6 @@ import java.net.InetAddress; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.function.Supplier; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.Location; @@ -45,11 +44,9 @@ import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.core.flags.TypeCoercions; import org.apache.brooklyn.util.core.task.DeferredSupplier; import org.apache.brooklyn.util.core.task.Tasks; -import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.net.UserAndHostAndPort; import org.apache.brooklyn.util.text.WildcardGlobs; import org.apache.brooklyn.util.text.WildcardGlobs.PhraseTreatment; -import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -154,6 +151,11 @@ public class ByonLocationResolver extends AbstractLocationResolver { v = resolveOrThrow(dynamicAllowed, v); return TypeCoercions.coerce(v, type); } +protected T resolveRemoveOrThrow(boolean dynamicAllowed, Map map, String key, Class type) { +Object v = map.remove(key); +v = resolveOrThrow(dynamicAllowed, v); +return TypeCoercions.coerce(v, type); +} protected Object resolveOrThrow(boolean dynamicAllowed, Object v) { if (v instanceof DeferredSupplier) { if (dynamicAllowed) throw new UsesDeferredSupplier(); @@ -204,7 +206,7 @@ public class ByonLocationResolver extends AbstractLocationResolver { if (host instanceof String) { machineSpec = parseMachine((String) host, locationClass, defaultProps, spec); } else if (host instanceof Map) { -machineSpec = parseMachine(mgmt, context, (Map) host, locationClass, defaultProps, spec); +machineSpec = parseMachine(mgmt, context, (Map) h
(brooklyn-server) branch master updated: skip intermediate service not up indicators triggering failure if cleared soon after
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 4c39d30207 skip intermediate service not up indicators triggering failure if cleared soon after 4c39d30207 is described below commit 4c39d30207947433bb994094070581570913e688 Author: Alex Heneveld AuthorDate: Mon Jul 15 14:45:49 2024 +0100 skip intermediate service not up indicators triggering failure if cleared soon after and more logging for service up false --- .../brooklyn/core/entity/AbstractApplication.java | 1 - .../core/entity/lifecycle/ServiceStateLogic.java | 61 +++--- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java index 1c3d73f6a1..ced6112d03 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java @@ -205,7 +205,6 @@ public abstract class AbstractApplication extends AbstractEntity implements Star ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL); } -ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); setExpectedStateAndRecordLifecycleEvent(Lifecycle.RUNNING); logApplicationLifecycle("Started"); diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java index 55cbc23745..e64b6a7f86 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java @@ -68,6 +68,7 @@ import org.apache.brooklyn.util.collections.QuorumCheck.QuorumChecks; import org.apache.brooklyn.util.core.task.ValueResolver; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.guava.Functionals; +import org.apache.brooklyn.util.guava.IfFunctions; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.repeat.Repeater; import org.apache.brooklyn.util.text.Strings; @@ -166,7 +167,7 @@ public class ServiceStateLogic { private static void setExpectedState(Entity entity, Lifecycle state, boolean waitBrieflyForServiceUpIfRunning) { if (waitBrieflyForServiceUpIfRunning) { -waitBrieflyForServiceUpIfStateIsRunning(entity, state); +waitBrieflyForServiceUpIfStateIsRunning("setting expected state", entity, state); } ((EntityInternal)entity).sensors().set(Attributes.SERVICE_STATE_EXPECTED, new Lifecycle.Transition(state, new Date())); @@ -182,26 +183,34 @@ public class ServiceStateLogic { return expected.getState(); } -private static void waitBrieflyForServiceUpIfStateIsRunning(Entity entity, Lifecycle state) { +private static void waitBrieflyForServiceUpIfStateIsRunning(String when, Entity entity, Lifecycle state) { if (state==Lifecycle.RUNNING) { +log.debug("Service is not up when setting "+ state +" when "+when+" on " + entity+", but possibly just needs a recompute; doing recompute now"); + Boolean up = entity.getAttribute(Attributes.SERVICE_UP); if (!Boolean.TRUE.equals(up) && Entities.isManagedActive(entity)) { try { Iterables.filter(entity.enrichers(), x -> x instanceof ComputeServiceIndicatorsFromChildrenAndMembers).forEach( x -> { ComputeServiceIndicatorsFromChildrenAndMembers mx = (ComputeServiceIndicatorsFromChildrenAndMembers) x; -if (mx.isRunning()) mx.onUpdated(); +if (mx.isRunning()) { +log.debug("Service not up pre-check recompute rerunning "+mx); +mx.onUpdated(); +} } ); Map notUpIndicators = entity.sensors().get(Attributes.SERVICE_NOT_UP_INDICATORS); -if (notUpIndicators != null && notUpIndicators.isEmpty()) { -Optional css = Iterables.tryFind(entity.enrichers(), x -> ServiceNotUpLogic.DEFAULT_ENRICHER_UNIQUE_TAG.equals(x.getUniqueTag())); +if (notUpIndicators == null || notUpIndicators.isEmpty()) { +Maybe css = EntityAdjuncts.tryFindWithUniqueTag(entity.enrichers
(brooklyn-server) branch master updated: allow byon/fixed-list config to be dynamic
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 8f8eb59c08 allow byon/fixed-list config to be dynamic 8f8eb59c08 is described below commit 8f8eb59c0845dd098df3e9cba95fc6d2322455a2 Author: Alex Heneveld AuthorDate: Mon Jul 15 11:42:17 2024 +0100 allow byon/fixed-list config to be dynamic --- .../camp/brooklyn/ByonLocationsYamlTest.java | 70 +++- .../location/byon/ByonLocationResolver.java| 354 - 2 files changed, 281 insertions(+), 143 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java index d5cec29916..a57670015e 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java @@ -21,6 +21,8 @@ package org.apache.brooklyn.camp.brooklyn; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.Set; @@ -38,7 +40,7 @@ import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.location.winrm.WinRmMachineLocation; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.util.exceptions.Exceptions; +import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.net.UserAndHostAndPort; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -97,6 +99,72 @@ public class ByonLocationsYamlTest extends AbstractYamlTest { assertEquals(machine.getPrivateAddresses(), ImmutableSet.of("10.0.0.1")); } +@Test +@SuppressWarnings("unchecked") +public void testByonMachineResolvesDependentConfigForHost() throws Exception { +String yaml = Joiner.on("\n").join( +"location:", +" byon:", +"hosts:", +"- $brooklyn:config(\"ip_address\")", +"services:", +"- type: org.apache.brooklyn.entity.stock.BasicApplication", +" brooklyn.config:", +"ip_address: 1.2.3.4" +); + +Entity app = createStartWaitAndLogApplication(yaml); +FixedListMachineProvisioningLocation loc = (FixedListMachineProvisioningLocation) Iterables.get(app.getLocations(), 0); + +Set machines = loc.getAvailable(); +SshMachineLocation machine = Iterables.getOnlyElement(machines); +assertMachine(machine, UserAndHostAndPort.fromParts(machine.getUser(), "1.2.3.4", 22), Collections.emptyMap()); +} + +@Test +@SuppressWarnings("unchecked") +public void testByonMachineResolvesDependentConfigForHosts() throws Exception { +String yaml = Joiner.on("\n").join( +"location:", +" byon:", +"hosts: $brooklyn:config(\"ip_addresses\")", +"services:", +"- type: org.apache.brooklyn.entity.stock.BasicApplication", +" brooklyn.config:", +"ip_addresses: [ 1.2.3.4, { ssh: 1.2.3.5, user: Beth } ]" +); + +Entity app = createStartWaitAndLogApplication(yaml); +FixedListMachineProvisioningLocation loc = (FixedListMachineProvisioningLocation) Iterables.get(app.getLocations(), 0); + +List machines = MutableList.copyOf(loc.getAvailable()); +Asserts.assertSize(machines, 2); +assertMachine(machines.get(0), UserAndHostAndPort.fromParts(machines.get(0).getUser(), "1.2.3.4", 22), Collections.emptyMap()); +assertMachine(machines.get(1), UserAndHostAndPort.fromParts("Beth", "1.2.3.5", 22), Collections.emptyMap()); +} + +@Test +@SuppressWarnings("unchecked") +public void testByonMachineResolvesDependentConfigForUser() throws Exception { +String yaml = Joiner.on("\n").join( +"location:", +" byon:", +"user: $brooklyn:config(\"uzer\")", +"hosts: [ 1.2.3.4 ]", +"services:", +"- type: org.apache.brooklyn.entity.stock.BasicApplication", +
(brooklyn-server) branch master updated: prevent flapping when entity service state has children dependencies
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 94cb482e17 prevent flapping when entity service state has children dependencies 94cb482e17 is described below commit 94cb482e175faf7223c191076a19dc34406ec1b1 Author: Alex Heneveld AuthorDate: Fri Jul 12 09:33:48 2024 +0100 prevent flapping when entity service state has children dependencies fix one other place where service state is recomputed possibly too early due to race --- .../core/entity/lifecycle/ServiceStateLogic.java | 57 +- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java index 244a32a073..55cbc23745 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java @@ -293,9 +293,9 @@ public class ServiceStateLogic { /** Enricher which sets {@link Attributes#SERVICE_STATE_ACTUAL} on changes to * {@link Attributes#SERVICE_STATE_EXPECTED}, {@link Attributes#SERVICE_PROBLEMS}, and {@link Attributes#SERVICE_UP} * - * The default implementation uses {@link #computeActualStateWhenExpectedRunning(Map, Boolean)} if the last expected transition + * The default implementation uses {@link #computeActualStateWhenExpectedRunning()} if the last expected transition * was to {@link Lifecycle#RUNNING} and - * {@link #computeActualStateWhenNotExpectedRunning(Map, Boolean, org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition)} otherwise. + * {@link #computeActualStateWhenNotExpectedRunning(org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition)} otherwise. * If these methods return null, the {@link Attributes#SERVICE_STATE_ACTUAL} sensor will be cleared (removed). * Either of these methods can be overridden for custom logic, and that custom enricher can be created using * {@link ServiceStateLogic#newEnricherForServiceState(Class)} and added to an entity. @@ -335,37 +335,50 @@ public class ServiceStateLogic { public void onEvent(@Nullable SensorEvent event) { Preconditions.checkNotNull(entity, "Cannot handle subscriptions or compute state until associated with an entity"); -Map serviceProblems = entity.getAttribute(SERVICE_PROBLEMS); -Boolean serviceUp = entity.getAttribute(SERVICE_UP); Lifecycle.Transition serviceExpected = entity.getAttribute(SERVICE_STATE_EXPECTED); if (serviceExpected!=null && serviceExpected.getState()==Lifecycle.RUNNING) { -setActualState( computeActualStateWhenExpectedRunning(serviceProblems, serviceUp) ); +setActualState( computeActualStateWhenExpectedRunning() ); } else { -setActualState( computeActualStateWhenNotExpectedRunning(serviceProblems, serviceUp, serviceExpected) ); +setActualState( computeActualStateWhenNotExpectedRunning(serviceExpected) ); } } -protected Maybe computeActualStateWhenExpectedRunning(Map problems, Boolean serviceUp) { -if (Boolean.TRUE.equals(serviceUp) && (problems==null || problems.isEmpty())) { -return Maybe.of(Lifecycle.RUNNING); -} else { -if (!Entities.isManagedActive(entity)) { -return Maybe.absent("entity not managed active"); -} -if (!Lifecycle.ON_FIRE.equals(entity.getAttribute(SERVICE_STATE_ACTUAL))) { -Lifecycle.Transition serviceExpected = entity.getAttribute(SERVICE_STATE_EXPECTED); -// very occasional race here; might want to give a grace period if entity has just transitioned, -// allow children to catch up -BrooklynLogging.log(log, BrooklynLogging.levelDependingIfReadOnly(entity, LoggingLevel.WARN, LoggingLevel.TRACE, LoggingLevel.DEBUG), -"Setting "+entity+" "+Lifecycle.ON_FIRE+" due to problems when expected running, up="+serviceUp+", "+ -(problems==null || problems.isEmpty() ? "not-up-indicators: "+entity.getAttribute(SERVICE_NOT_UP_INDICATORS) : "problems: "+problems)); +protected Maybe computeActualStateWhenExpectedRunning() { +int count=0; +while (true) { +Map problems = entity.getAttribute(SERVICE_PROBLEMS); +Boolean serviceUp = entity.getA
(brooklyn-server) branch master updated: when running service state expected logic, don't rely on eventual consistency
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new e90fe710f8 when running service state expected logic, don't rely on eventual consistency e90fe710f8 is described below commit e90fe710f8d65f47445f509d547b905697a0191d Author: Alex Heneveld AuthorDate: Thu Jul 11 18:00:16 2024 +0100 when running service state expected logic, don't rely on eventual consistency try explicitly running the other related enrichers first --- .../core/entity/lifecycle/ServiceStateLogic.java | 64 +++--- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java index 2fc948ffce..244a32a073 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java @@ -28,6 +28,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.annotation.Nullable; +import com.google.common.base.*; +import com.google.common.collect.Iterables; import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntityLocal; @@ -52,8 +54,10 @@ import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition; import org.apache.brooklyn.core.entity.trait.Startable; +import org.apache.brooklyn.core.sensor.BasicSensorEvent; import org.apache.brooklyn.enricher.stock.AbstractMultipleSensorAggregator; import org.apache.brooklyn.enricher.stock.Enrichers; +import org.apache.brooklyn.enricher.stock.Transformer; import org.apache.brooklyn.enricher.stock.UpdatingMap; import org.apache.brooklyn.util.collections.CollectionFunctionals; import org.apache.brooklyn.util.collections.MutableList; @@ -62,6 +66,7 @@ import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.collections.QuorumCheck; import org.apache.brooklyn.util.collections.QuorumCheck.QuorumChecks; import org.apache.brooklyn.util.core.task.ValueResolver; +import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.guava.Functionals; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.repeat.Repeater; @@ -70,11 +75,6 @@ import org.apache.brooklyn.util.time.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Function; -import com.google.common.base.Functions; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -186,19 +186,45 @@ public class ServiceStateLogic { if (state==Lifecycle.RUNNING) { Boolean up = entity.getAttribute(Attributes.SERVICE_UP); if (!Boolean.TRUE.equals(up) && Entities.isManagedActive(entity)) { -// pause briefly to allow any recent problem-clearing processing to complete -Stopwatch timer = Stopwatch.createStarted(); -boolean nowUp = Repeater.create() -.every(ValueResolver.REAL_QUICK_PERIOD) -.limitTimeTo(ValueResolver.PRETTY_QUICK_WAIT) -.until(entity, EntityPredicates.attributeEqualTo(Attributes.SERVICE_UP, true)) -.run(); -if (nowUp) { -log.debug("Had to wait "+Duration.of(timer)+" for "+entity+" "+Attributes.SERVICE_UP+" to be true before setting "+state); -} else { -if (Entities.isManagedActive(entity)) { -log.warn("Service is not up when setting " + state + " on " + entity + "; delayed " + Duration.of(timer) + " " -+ "but " + Attributes.SERVICE_UP + " did not recover from " + up + "; not-up-indicators=" + entity.getAttribute(Attributes.SERVICE_NOT_UP_INDICATORS)); +try { +Iterables.filter(entity.enrichers(), x -> x instanceof ComputeServiceIndicatorsFromChildrenAndMembers).forEach( +x -> { +ComputeServiceIndicatorsFromChildrenAndMembers mx = (ComputeServiceIndicatorsFromChildrenAndMembers) x; +
(brooklyn-ui) branch master updated: make quick launch deploy act exactly like catalog deploy
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/master by this push: new 20ba7e71 make quick launch deploy act exactly like catalog deploy 20ba7e71 is described below commit 20ba7e7127366fc2bb9fc5f559fccb109365bda8 Author: Alex Heneveld AuthorDate: Thu Jul 11 13:11:24 2024 +0100 make quick launch deploy act exactly like catalog deploy --- ui-modules/catalog/app/views/bundle/type/type.state.js | 15 +-- .../home/app/views/main/deploy/deploy.controller.js| 18 -- ui-modules/utils/quick-launch/quick-launch.less| 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ui-modules/catalog/app/views/bundle/type/type.state.js b/ui-modules/catalog/app/views/bundle/type/type.state.js index e5d4f3bf..dc2eb12b 100644 --- a/ui-modules/catalog/app/views/bundle/type/type.state.js +++ b/ui-modules/catalog/app/views/bundle/type/type.state.js @@ -126,23 +126,26 @@ export function typeController($scope, $state, $stateParams, $q, $uibModal, brBr $scope.bundle = responses[0]; $scope.type = responses[1]; -// this is the initially selected item in the dropdown of the definition -const specItem = this.specItem = $scope.type.specList[0]; - +const entitySpec = $scope.type; +// update entity spec to keep the right format (repeated in home deploy.controller.js) +const specItem = entitySpec.specList[0]; // if the implementation plan does not declare its format but the first spec list item does // then we should replace the low-level implementation plan (probably auto-generated) with // the first spec list item (which is what the user created) -var preferredContents = $scope.type.plan && $scope.type.plan.data; -var preferredFormat = $scope.type.plan && $scope.type.plan.format; +var preferredContents = entitySpec.plan && entitySpec.plan.data; +var preferredFormat = entitySpec.plan && entitySpec.plan.format; if (!preferredFormat) { if (specItem && specItem.format && specItem.contents) { preferredFormat = specItem.format; // also take those contents preferredContents = specItem.contents; -$scope.type.plan = { data: preferredContents, format: preferredFormat }; +entitySpec.plan = { data: preferredContents, format: preferredFormat }; } } +// save this as the initially selected item in the dropdown of the definition +this.specItem = specItem; + // this is used to link to the right editor in composer, preserve the format used to define the item being quick-launched $scope.typeFormat = preferredFormat ? 'format=' + preferredFormat + '&' : ''; diff --git a/ui-modules/home/app/views/main/deploy/deploy.controller.js b/ui-modules/home/app/views/main/deploy/deploy.controller.js index dd296831..7cf9d6bd 100644 --- a/ui-modules/home/app/views/main/deploy/deploy.controller.js +++ b/ui-modules/home/app/views/main/deploy/deploy.controller.js @@ -78,8 +78,23 @@ export function deployStateController($scope, $state, $stateParams, $uibModal, b }); function modalController($scope, $location, entitySpec, locations) { +// update entity spec to keep the right format (repeated in catalog type.state.js) +const specItem = entitySpec.specList[0]; +// if the implementation plan does not declare its format but the first spec list item does +// then we should replace the low-level implementation plan (probably auto-generated) with +// the first spec list item (which is what the user created) +var preferredContents = entitySpec.plan && entitySpec.plan.data; +var preferredFormat = entitySpec.plan && entitySpec.plan.format; +if (!preferredFormat) { +if (specItem && specItem.format && specItem.contents) { +preferredFormat = specItem.format; +// also take those contents +preferredContents = specItem.contents; +entitySpec.plan = { data: preferredContents, format: preferredFormat }; +} +} + $scope.app = entitySpec; -$scope.app.plan.format = $scope.app.specList[0].format; $scope.locations = filterCatalogQuickLaunch(locations, (t) => { $scope.usingLocationCatalogQuickLaunchTags = t.length > 0; }); @@ -93,7 +108,6 @@ export function deployStateController($scope, $state, $stateParams, $uibModal, b noCreateLocationLink: $scope.usingLocationCatalogQuickLaunchTags }, $location.search()); - }
(brooklyn-ui) branch master updated: use a fixed width container for catalog icons, like we do for other icons
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/master by this push: new 88f4eece use a fixed width container for catalog icons, like we do for other icons 88f4eece is described below commit 88f4eece7a295d1fc027563a23580309ac83ff1e Author: Alex Heneveld AuthorDate: Thu Jul 11 12:28:47 2024 +0100 use a fixed width container for catalog icons, like we do for other icons 96px and this technique is what is used elsewhere (from bootstrap) --- ui-modules/catalog/app/index.less | 5 + ui-modules/catalog/app/views/bundle/bundle.template.html | 2 +- ui-modules/catalog/app/views/catalog/catalog.template.html | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui-modules/catalog/app/index.less b/ui-modules/catalog/app/index.less index ba3d5fb7..f268798a 100644 --- a/ui-modules/catalog/app/index.less +++ b/ui-modules/catalog/app/index.less @@ -153,3 +153,8 @@ // Load last so that these style rules and var values trump others @import "~brooklyn-shared/style/last.less"; +.icon-96 { + width: 96px; + min-width: 96px; + max-width: 96px; +} \ No newline at end of file diff --git a/ui-modules/catalog/app/views/bundle/bundle.template.html b/ui-modules/catalog/app/views/bundle/bundle.template.html index 19ae6949..2a636473 100644 --- a/ui-modules/catalog/app/views/bundle/bundle.template.html +++ b/ui-modules/catalog/app/views/bundle/bundle.template.html @@ -21,7 +21,7 @@ - + diff --git a/ui-modules/catalog/app/views/catalog/catalog.template.html b/ui-modules/catalog/app/views/catalog/catalog.template.html index cee272bd..972c5fdf 100644 --- a/ui-modules/catalog/app/views/catalog/catalog.template.html +++ b/ui-modules/catalog/app/views/catalog/catalog.template.html @@ -74,7 +74,7 @@ ng-class="{'expanded': !isCollapsed, 'is-expandable': bundle.types.length > 0}" class="list-group-item bundles-list"> - +
(brooklyn-ui) branch simple-kilt deleted (was 5edadb8e)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git was 5edadb8e tidy popup for kilt colors, and set simple to be the default The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(brooklyn-ui) 01/01: Merge pull request #387 from apache/simple-kilt
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit dafe1397a57af42637fb322e5433f3e0abb73224 Merge: 2429a734 5edadb8e Author: Alex Heneveld AuthorDate: Fri Jun 28 15:44:22 2024 +0100 Merge pull request #387 from apache/simple-kilt Use simpler colors for kilt, with option to expand package-lock.json | 3585 .../components/task-list/task-list.directive.js| 25 +- .../task-sunburst/task-sunburst.directive.js | 74 +- .../task-sunburst/task-sunburst.template.html |2 +- .../components/task-sunburst/task-sunburst.util.js | 61 +- ui-modules/app-inspector/app/index.js |3 +- ui-modules/app-inspector/app/index.less|5 + .../inspect/activities/activities.controller.js| 27 - .../views/main/inspect/activities/activities.less | 17 + .../inspect/activities/activities.template.html| 20 +- .../inspect/activities/detail/detail.controller.js | 18 +- .../inspect/activities/detail/detail.template.html | 18 +- .../activities/detail/kilt.modal.template.html | 26 - .../inspect/activities/kilt-panel.directive.js | 74 + .../inspect/activities/kilt-panel.template.html| 83 + .../inspect/activities/kilt.modal.template.html|4 +- ui-modules/shared/config/build/webpack.config.js |1 + 17 files changed, 3879 insertions(+), 164 deletions(-)
(brooklyn-ui) branch master updated (2429a734 -> dafe1397)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from 2429a734 add logging and extra headers to login form add c578e1b3 Option of simple kilt add 081d5a7f Merge branch 'master' into simple-kilt add ec480fd5 tidy up - use constant, darken color, remove debug line add fec514fb refactor task list and kilt to its own widget add 5bddf424 kilt diagram improve resize and redraws add c54d1b49 use color scheme mode as string add 40bcc605 put kilt multi-colored toggle into a settings popover add 5edadb8e tidy popup for kilt colors, and set simple to be the default new dafe1397 Merge pull request #387 from apache/simple-kilt 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. Summary of changes: package-lock.json | 3585 .../components/task-list/task-list.directive.js| 25 +- .../task-sunburst/task-sunburst.directive.js | 74 +- .../task-sunburst/task-sunburst.template.html |2 +- .../components/task-sunburst/task-sunburst.util.js | 61 +- ui-modules/app-inspector/app/index.js |3 +- ui-modules/app-inspector/app/index.less|5 + .../inspect/activities/activities.controller.js| 27 - .../views/main/inspect/activities/activities.less | 17 + .../inspect/activities/activities.template.html| 20 +- .../inspect/activities/detail/detail.controller.js | 18 +- .../inspect/activities/detail/detail.template.html | 18 +- .../activities/detail/kilt.modal.template.html | 26 - .../inspect/activities/kilt-panel.directive.js | 74 + .../inspect/activities/kilt-panel.template.html| 83 + .../inspect/activities/kilt.modal.template.html|4 +- ui-modules/shared/config/build/webpack.config.js |1 + 17 files changed, 3879 insertions(+), 164 deletions(-) create mode 100644 package-lock.json delete mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/detail/kilt.modal.template.html create mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js create mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html
(brooklyn-ui) branch simple-kilt updated: tidy popup for kilt colors, and set simple to be the default
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/simple-kilt by this push: new 5edadb8e tidy popup for kilt colors, and set simple to be the default 5edadb8e is described below commit 5edadb8e98e10d8a2e9a689249be5ee61e233d2a Author: Alex Heneveld AuthorDate: Fri Jun 28 15:43:56 2024 +0100 tidy popup for kilt colors, and set simple to be the default --- .../task-sunburst/task-sunburst.directive.js | 4 +--- .../components/task-sunburst/task-sunburst.util.js | 19 --- .../views/main/inspect/activities/activities.less| 15 --- .../main/inspect/activities/kilt-panel.directive.js | 13 - .../main/inspect/activities/kilt-panel.template.html | 20 +++- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js index 78eeecea..a16bd378 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js @@ -29,8 +29,6 @@ angular.module(MODULE_NAME, []) export default MODULE_NAME; -export const STORAGE_KEY_COLOR_MODE = 'brooklyn.'+MODULE_NAME+'.color_mode'; - export function taskSunburstDirective() { return { template: template, @@ -47,7 +45,7 @@ export function taskSunburstDirective() { function controller($scope, $element, $state, $window, $timeout) { function lookupColorScheme() { -$scope.colorScheme = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || 'normal'; +$scope.colorScheme = util.getSunburstColorMode($window); } lookupColorScheme(); diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js index 1fd8d620..39d32f2f 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js @@ -18,6 +18,10 @@ */ import * as d3 from "d3"; +import MODULE_NAME from "./task-sunburst.directive"; + +export const COLOR_MODES = [ 'simple', 'multi' ]; +export const DEFAULT_COLOR_MODE = COLOR_MODES[0]; export function isNewEntity(d) { return d.data.task && d.parent && d.parent.data.task && d.data.task.entityId && d.data.task.entityId != d.parent.data.task.entityId; @@ -76,7 +80,7 @@ colors = { { // build a palette to use, avoiding anything that looks like success // (danger we don't avoid as it is usually bright) -var palettes = ["normal", "simple"]; +var palettes = COLOR_MODES; for(var p of palettes) { var hueToAvoid = d3.hsl(colors.ACTIVE_NORMAL).h; var palette = []; @@ -103,7 +107,7 @@ Object.assign(colors, colors, { ACTIVE_BRIGHT: colors.ACTIVE_NORMAL.brighter(0.2), scale: function(x, scheme) { - const palette = colors.PALETTES[scheme||"normal"]; + const palette = colors.PALETTES[scheme||DEFAULT_COLOR_MODE]; return palette[((hash(x) % palette.length)+palette.length)%palette.length]; }, nodeToUseForHue: function(x) { @@ -186,4 +190,13 @@ export function arcF(options) { export function taskId(d) { return findTask(d).id; } export function id(x) { return x; } - + +const STORAGE_KEY_COLOR_MODE = 'brooklyn.'+MODULE_NAME+'.color_mode'; + +export function getSunburstColorMode($window) { +return $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || DEFAULT_COLOR_MODE; +} +export function toggleSunburstColorMode($window) { +const m = getSunburstColorMode($window); +$window.localStorage.setItem(STORAGE_KEY_COLOR_MODE, COLOR_MODES[ (COLOR_MODES.findIndex(x => x == m) + 1) % COLOR_MODES.length ]); +} diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less index 9a02dfa2..6de05c46 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less @@ -58,16 +58,17 @@ .kilt-settings-popover { margin-left: 10px; //needed to budge it right to line up with settings icon, oddly - width: 500px; - max-width: 500px; - min-width: 500px; + width: 540px; + max-width: 540px; + min-width: 540px; .swatch-square { -width: 10px; -height: 10px; +width: 1em; +height: 1em; float: left; -margin-right: 1ex; -margin-top: 4px; +margin-right: 1em;
(brooklyn-ui) 03/04: use color scheme mode as string
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit c54d1b4968d092965f431d864ccb998c2232ae38 Author: Alex Heneveld AuthorDate: Fri Jun 28 14:02:08 2024 +0100 use color scheme mode as string --- .../components/task-sunburst/task-sunburst.directive.js | 17 - .../main/inspect/activities/kilt-panel.directive.js | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js index 066fc6bd..78eeecea 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js @@ -29,7 +29,7 @@ angular.module(MODULE_NAME, []) export default MODULE_NAME; -export const STORAGE_KEY_COLOR_MODE = 'brooklyn.'+MODULE_NAME+'.toggle_colors'; +export const STORAGE_KEY_COLOR_MODE = 'brooklyn.'+MODULE_NAME+'.color_mode'; export function taskSunburstDirective() { return { @@ -46,8 +46,10 @@ export function taskSunburstDirective() { function controller($scope, $element, $state, $window, $timeout) { -const simpleColors = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; -$scope.colorScheme = simpleColors ? "simple" : "normal"; +function lookupColorScheme() { +$scope.colorScheme = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || 'normal'; +} +lookupColorScheme(); const vizOptions = {}; vizOptions.transitionScale = 1; @@ -66,9 +68,7 @@ export function taskSunburstDirective() { console.warn("ResizeObserver not available; kilt diagram will not resize correctly.", e); } -$scope.$on('toggleColorScheme', (event, args) => { -$scope.colorScheme = args.simpleColors ? "simple" : "normal"; -}); +$scope.$on('changedKiltColorScheme', lookupColorScheme); function onUpdate() { viz.prepData(); @@ -427,7 +427,7 @@ function initVisualization($scope, $element, $state, options) { $state.go("main.inspect.activities.detail", {entityId: t.entityId, activityId: t.id}); } -result.redraw = function(simpleColorScheme) { +result.redraw = function() { // update chart size width = $element.find("svg")[0].getBoundingClientRect().width; var height = width * sizing.height_width_ratio; @@ -444,8 +444,7 @@ function initVisualization($scope, $element, $state, options) { }; result.resize = result.redraw; -result.toggleColorScheme = result.redraw; - + result.prepData(); result.redraw(); chart.on("mouseleave", mouseleave); diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js index ef7dfb16..8baf14e3 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js @@ -55,12 +55,12 @@ export function activitiesListAndKiltPanelDirective() { vm.wideKilt = newValue; }; -vm.simpleColors = window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; +vm.simpleColors = window.localStorage.getItem(STORAGE_KEY_COLOR_MODE)=='simple'; vm.toggleColorScheme = function () { vm.simpleColors = !vm.simpleColors; -$window.localStorage.setItem(STORAGE_KEY_COLOR_MODE, vm.simpleColors); +$window.localStorage.setItem(STORAGE_KEY_COLOR_MODE, vm.simpleColors ? 'simple' : 'normal'); $timeout(function () { -$scope.$broadcast('toggleColorScheme', {simpleColors: vm.simpleColors}) +$scope.$broadcast('changedKiltColorScheme') }, 0); }; }
(brooklyn-ui) 01/04: refactor task list and kilt to its own widget
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit fec514fba1861d53bb5c5998eb2039f4d503fb5d Author: Alex Heneveld AuthorDate: Fri Jun 28 12:07:55 2024 +0100 refactor task list and kilt to its own widget as used for details and general --- .../components/task-list/task-list.directive.js| 25 .../task-sunburst/task-sunburst.directive.js | 2 +- ui-modules/app-inspector/app/index.js | 3 +- .../inspect/activities/activities.controller.js| 32 -- .../inspect/activities/activities.template.html| 23 +-- .../inspect/activities/detail/detail.controller.js | 18 +- .../inspect/activities/detail/detail.template.html | 18 ++ .../activities/detail/kilt.modal.template.html | 26 .../inspect/activities/kilt-panel.directive.js | 74 ++ ...ties.template.html => kilt-panel.template.html} | 20 ++ .../inspect/activities/kilt.modal.template.html| 4 +- 11 files changed, 108 insertions(+), 137 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js index 5bd99d00..c4c07bfc 100644 --- a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js +++ b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js @@ -201,7 +201,7 @@ export function taskListDirective() { try { const filters = sessionStorage.getItem('brooklyn-task-list-filters-' + $scope.contextKey); if (filters) { -//console.debug("Read filters for", $scope.contextKey, filters); +// console.debug("Read filters for", $scope.contextKey, filters); preselectedFilters = JSON.parse(filters); } } catch (e) { @@ -250,17 +250,18 @@ export function taskListDirective() { selectFilter($scope.taskType); } } else { -if (!isActivityChildren) { -// defaults (when not in subtask view; in subtask view it is as above) -selectFilter('_cross_entity'); -selectFilter('_all_effectors'); -selectFilter('TOP-LEVEL'); -selectFilter('EFFECTOR'); -selectFilter('WORKFLOW'); -selectFilter('_periodic'); -selectFilter('_other_entity'); -} else { -// in children mode we don't want any such filters +selectFilter('_cross_entity'); +selectFilter('_all_effectors'); +selectFilter('TOP-LEVEL'); +selectFilter('EFFECTOR'); +selectFilter('WORKFLOW'); +selectFilter('_periodic'); +selectFilter('_other_entity'); + +if (isActivityChildren) { +// in children mode we also want sub-tasks +// (previously selected no filters in subtask view) +selectFilter('SUB-TASK'); } } if (!isActivityChildren) selectFilter("_workflowStepsHidden"); diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js index 578348eb..6278f98e 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js @@ -47,6 +47,7 @@ export function taskSunburstDirective() { function controller($scope, $element, $state, $window, $timeout) { const simpleColors = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; $scope.colorScheme = simpleColors ? "simple" : "normal"; + var viz = initVisualization($scope, $element, $state); angular.element($window).on('resize', viz.resize); @@ -54,7 +55,6 @@ export function taskSunburstDirective() { $scope.$on('toggleColorScheme', (event, args) => { $scope.colorScheme = args.simpleColors ? "simple" : "normal"; -$window.localStorage.setItem(STORAGE_KEY_COLOR_MODE, args.simpleColors); }); $scope.$on('$destroy', function() { diff --git a/ui-modules/app-inspector/app/index.js b/ui-modules
(brooklyn-ui) branch simple-kilt updated (ec480fd5 -> 40bcc605)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from ec480fd5 tidy up - use constant, darken color, remove debug line new fec514fb refactor task list and kilt to its own widget new 5bddf424 kilt diagram improve resize and redraws new c54d1b49 use color scheme mode as string new 40bcc605 put kilt multi-colored toggle into a settings popover The 4 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. Summary of changes: .../components/task-list/task-list.directive.js| 25 +++ .../task-sunburst/task-sunburst.directive.js | 71 ++- .../task-sunburst/task-sunburst.template.html | 2 +- ui-modules/app-inspector/app/index.js | 3 +- ui-modules/app-inspector/app/index.less| 5 ++ .../inspect/activities/activities.controller.js| 34 - .../views/main/inspect/activities/activities.less | 16 + .../inspect/activities/activities.template.html| 23 +- .../inspect/activities/detail/detail.controller.js | 18 + .../inspect/activities/detail/detail.template.html | 18 ++--- .../activities/detail/kilt.modal.template.html | 26 --- .../inspect/activities/kilt-panel.directive.js | 71 +++ .../inspect/activities/kilt-panel.template.html| 81 ++ .../inspect/activities/kilt.modal.template.html| 4 +- 14 files changed, 239 insertions(+), 158 deletions(-) delete mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/detail/kilt.modal.template.html create mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js create mode 100644 ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html
(brooklyn-ui) 02/04: kilt diagram improve resize and redraws
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 5bddf424e93e5d8387c1e17513fddf2fec053563 Author: Alex Heneveld AuthorDate: Fri Jun 28 13:46:03 2024 +0100 kilt diagram improve resize and redraws --- .../task-sunburst/task-sunburst.directive.js | 54 +- ui-modules/app-inspector/app/index.less| 5 ++ .../inspect/activities/activities.controller.js| 2 - .../inspect/activities/kilt-panel.directive.js | 8 +--- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js index 6278f98e..066fc6bd 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js @@ -41,49 +41,56 @@ export function taskSunburstDirective() { filteredTo: '=?', // optionally restrict tasks to a subset (and descendants); for use with tag and name filters excludeTransient: '=?', // optionally descendants not to include transients }, -controller: ['$scope', '$element', '$state', '$window', '$timeout', controller] +controller: ['$scope', '$element', '$state', '$window', '$timeout', controller], }; + function controller($scope, $element, $state, $window, $timeout) { const simpleColors = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; $scope.colorScheme = simpleColors ? "simple" : "normal"; -var viz = initVisualization($scope, $element, $state); +const vizOptions = {}; +vizOptions.transitionScale = 1; + +var viz = initVisualization($scope, $element, $state, vizOptions); -angular.element($window).on('resize', viz.resize); -$scope.$on('resize', viz.resize); +try { +new ResizeObserver(() => { +vizOptions.transitionScale = 0; +setTimeout(() => { +viz.resize(); +vizOptions.transitionScale = 1; +}, 0); +}).observe($element[0]) +} catch (e) { +console.warn("ResizeObserver not available; kilt diagram will not resize correctly.", e); +} $scope.$on('toggleColorScheme', (event, args) => { $scope.colorScheme = args.simpleColors ? "simple" : "normal"; }); -$scope.$on('$destroy', function() { -angular.element($window).off('resize', viz.resize); -}); - function onUpdate() { viz.prepData(); viz.redraw(); +viz.redraw(); // second redraw needed because we don't update chart right away } $scope.$watch('tasks', onUpdate); $scope.$watch('filteredTo', onUpdate); $scope.$watch('excludeTransient', onUpdate); $scope.$watch('colorScheme', onUpdate); - -// seems to help with the window being ready, otherwise kilt expects to be too wide -$timeout(onUpdate, 0); } } // this could be its own class independent of angular in future -function initVisualization($scope, $element, $state) { +function initVisualization($scope, $element, $state, options) { var result = {}; var tasksData; var tasksById; -result.prepData = function() { +result.prepData = function() { tasksData = {name: "root", task: null, children: []}; const tasks = Array.isArray($scope.tasks) ? $scope.tasks : Object.values($scope.tasks); @@ -224,7 +231,7 @@ function initVisualization($scope, $element, $state) { // Transition each segment to full opacity and then reactivate it. d3_root.selectAll("path") .transition() - .duration(300) + .duration(300 * options.transitionScale) .style("opacity", 1); d3_root.selectAll(".detail #detail1 .value").style("display", "none"); @@ -265,7 +272,7 @@ function initVisualization($scope, $element, $state) { chart.selectAll("path") // Fade all the segments. .transition() - .duration(100) + .duration(100 * options.transitionScale) .style("opacity", 0.3); // But highlight those that are an ancestor of the current segment. @@ -274,7 +281,7 @@ function initVisualization($scope, $element, $state) { return (sequenceArray.indexOf(node) >= 0); }) .transition() - .duration(100) + .duration(100 * options.transitionScale) .style
(brooklyn-ui) 04/04: put kilt multi-colored toggle into a settings popover
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 40bcc605a389349514e483d051703d98b7e4ab2e Author: Alex Heneveld AuthorDate: Fri Jun 28 14:57:29 2024 +0100 put kilt multi-colored toggle into a settings popover --- .../task-sunburst/task-sunburst.template.html | 2 +- .../views/main/inspect/activities/activities.less | 16 +++ .../inspect/activities/kilt-panel.directive.js | 3 ++ .../inspect/activities/kilt-panel.template.html| 49 -- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.template.html b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.template.html index 5c8ebff6..abfff55a 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.template.html +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.template.html @@ -17,7 +17,7 @@ under the License. --> - + diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less index 3987a78a..9a02dfa2 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.less @@ -54,4 +54,20 @@ } } } +} + +.kilt-settings-popover { + margin-left: 10px; //needed to budge it right to line up with settings icon, oddly + width: 500px; + max-width: 500px; + min-width: 500px; + + .swatch-square { +width: 10px; +height: 10px; + +float: left; +margin-right: 1ex; +margin-top: 4px; + } } \ No newline at end of file diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js index 8baf14e3..68675d02 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.directive.js @@ -21,6 +21,7 @@ import {HIDE_INTERSTITIAL_SPINNER_EVENT} from 'brooklyn-ui-utils/interstitial-sp import template from './kilt-panel.template.html'; import modalTemplate from './kilt.modal.template.html'; import {STORAGE_KEY_COLOR_MODE} from "../../../../components/task-sunburst/task-sunburst.directive"; +import {colors} from "../../../../components/task-sunburst/task-sunburst.util"; const MODULE_NAME = 'activities.kilt-panel'; @@ -50,6 +51,8 @@ export function activitiesListAndKiltPanelDirective() { vm.isNonEmpty = Utils.isNonEmpty; vm.modalTemplate = modalTemplate; +vm.colors = colors; + vm.wideKilt = false; vm.setWideKilt = function (newValue) { vm.wideKilt = newValue; diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html index 07ccd273..e88ec925 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt-panel.template.html @@ -22,11 +22,11 @@ -Progress Map +Progress Map - - + + @@ -36,5 +36,46 @@ + +<div> +<p> +The progress map shows task progress and completion. +Tasks are shown chronologically left-to-right based on start time, +and hierarchically (subtasks) top-to-bottom. +</p><p> +<span style="background-color: {{vm.colors.ACTIVE_BRIGHT}};" class="swatch-square"></span> +Active tasks are shown in bright, pulsing green. +</p><p> +<span style="background-color: {{vm.colors.ERROR}};" class="swatch-square"></span> +Failed tasks are shown in red. +</p><p> +<span style="background-color: {{vm.colors.unstartedFn('sample','simple')}};" class="swatch-square"></span> +Unstarted tasks are shown as pale. +</p><p> +<span style="background-color: {{vm.colors.succeededFn('sample','simple')}};" class="swatch-square"></span> +Completed tasks are shown as dark. +</p> +<div style="d
(brooklyn-ui) 02/02: tidy up - use constant, darken color, remove debug line
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit ec480fd5bec0fdef4791be0d0353beb97849b30c Author: Alex Heneveld AuthorDate: Fri Jun 28 09:11:15 2024 +0100 tidy up - use constant, darken color, remove debug line --- .../app/components/task-sunburst/task-sunburst.directive.js | 6 -- .../app/components/task-sunburst/task-sunburst.util.js | 2 +- .../app/views/main/inspect/activities/activities.controller.js | 3 ++- .../app/views/main/inspect/activities/kilt.modal.template.html | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js index 336a6d8c..578348eb 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.directive.js @@ -29,6 +29,8 @@ angular.module(MODULE_NAME, []) export default MODULE_NAME; +export const STORAGE_KEY_COLOR_MODE = 'brooklyn.'+MODULE_NAME+'.toggle_colors'; + export function taskSunburstDirective() { return { template: template, @@ -43,7 +45,7 @@ export function taskSunburstDirective() { }; function controller($scope, $element, $state, $window, $timeout) { -const simpleColors = $window.localStorage.getItem('simpleColors') || false; +const simpleColors = $window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; $scope.colorScheme = simpleColors ? "simple" : "normal"; var viz = initVisualization($scope, $element, $state); @@ -52,7 +54,7 @@ export function taskSunburstDirective() { $scope.$on('toggleColorScheme', (event, args) => { $scope.colorScheme = args.simpleColors ? "simple" : "normal"; -$window.localStorage.setItem('simpleColors', args.simpleColors); +$window.localStorage.setItem(STORAGE_KEY_COLOR_MODE, args.simpleColors); }); $scope.$on('$destroy', function() { diff --git a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js index 80800f74..1fd8d620 100644 --- a/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js +++ b/ui-modules/app-inspector/app/components/task-sunburst/task-sunburst.util.js @@ -69,7 +69,7 @@ export function orderFn(d1, d2) { var colors; colors = { ERROR: d3.color(__BRAND_DANGER__ || "#B43"), - NORMAL_COMPLETE: d3.color(__BRAND_COMPLETE__ || "#007600"), + NORMAL_COMPLETE: d3.color(__BRAND_COMPLETE__ || "#007600").darker(1), ACTIVE_NORMAL: d3.color(__BRAND_SUCCESS__ || "#090"), PALETTES: {} }; diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js index ff2cd788..1a375aad 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js @@ -19,6 +19,7 @@ import {HIDE_INTERSTITIAL_SPINNER_EVENT} from 'brooklyn-ui-utils/interstitial-spinner/interstitial-spinner'; import template from "./activities.template.html"; import modalTemplate from './kilt.modal.template.html'; +import {STORAGE_KEY_COLOR_MODE} from "../../../../components/task-sunburst/task-sunburst.directive"; export const activitiesState = { name: 'main.inspect.activities', @@ -56,7 +57,7 @@ function ActivitiesController($scope, $state, $stateParams, $log, $timeout, enti $timeout(function() { $scope.$broadcast('resize') }, 100); }; -vm.simpleColors = window.localStorage.getItem('simpleColors') || false; +vm.simpleColors = window.localStorage.getItem(STORAGE_KEY_COLOR_MODE) || false; vm.toggleColorScheme = function () { vm.simpleColors = !vm.simpleColors; $timeout(function() { $scope.$broadcast('toggleColorScheme', {simpleColors: vm.simpleColors}) }, 100); diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt.modal.template.html b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt.modal.template.html index d7aff16d..649fa7fa 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/kilt.modal.template.html +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/kilt.modal.template.html @@ -17,7 +17,7 @@ under the License. --> - + Progress Map
(brooklyn-ui) 01/02: Merge branch 'master' into simple-kilt
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 081d5a7ff7f4a881828969dec6717f308ddb4f55 Merge: c578e1b3 2429a734 Author: Alex Heneveld AuthorDate: Fri Jun 28 08:58:53 2024 +0100 Merge branch 'master' into simple-kilt .../catalog/app/views/catalog/catalog.state.js | 14 +++- ui-modules/login/app/views/main/main.controller.js | 32 ++-- ui-modules/login/package.json | 2 +- .../utils/catalog-uploader/catalog-uploader.html | 88 +--- .../utils/catalog-uploader/catalog-uploader.js | 27 -- .../utils/catalog-uploader/catalog-uploader.less | 95 +++--- 6 files changed, 180 insertions(+), 78 deletions(-)
(brooklyn-ui) branch simple-kilt updated (c578e1b3 -> ec480fd5)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch simple-kilt in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from c578e1b3 Option of simple kilt add d18cd390 Added clickable URLs, that open in a new tab for imported types, added a 'Return to Catalog Button' and cleaned up the list of imported types on returning to catalog add 3237ca42 Merge remote-tracking branch 'iuliana/type-url-fix' add 2ab3c4af merge iuliana's uploader enhancements, adding a couple things add 4bb46783 tweak name of login form add 2429a734 add logging and extra headers to login form new 081d5a7f Merge branch 'master' into simple-kilt new ec480fd5 tidy up - use constant, darken color, remove debug line The 2 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. Summary of changes: .../task-sunburst/task-sunburst.directive.js | 6 +- .../components/task-sunburst/task-sunburst.util.js | 2 +- .../inspect/activities/activities.controller.js| 3 +- .../inspect/activities/kilt.modal.template.html| 2 +- .../catalog/app/views/catalog/catalog.state.js | 14 +++- ui-modules/login/app/views/main/main.controller.js | 32 ++-- ui-modules/login/package.json | 2 +- .../utils/catalog-uploader/catalog-uploader.html | 88 +--- .../utils/catalog-uploader/catalog-uploader.js | 27 -- .../utils/catalog-uploader/catalog-uploader.less | 95 +++--- 10 files changed, 188 insertions(+), 83 deletions(-)
(brooklyn-server) branch master updated: support icons on bundles using bundleIconUrl
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new d0ce66d1cd support icons on bundles using bundleIconUrl d0ce66d1cd is described below commit d0ce66d1cda3c0c99b6d862b1b42bc6a2feafae7 Author: Alex Heneveld AuthorDate: Thu Jun 27 17:21:42 2024 +0100 support icons on bundles using bundleIconUrl previously worked from bom files only, now routine is shared with catalog.bom file in an archive; also sets tags, and searches in the bundle correctly to find the icon. --- .../mgmt/ha/BrooklynBomOsgiArchiveInstaller.java | 57 +++--- .../mgmt/internal/AbstractManagementContext.java | 10 +++- .../BrooklynBomYamlCatalogBundleResolver.java | 26 ++ .../brooklyn/rest/resources/BundleResource.java| 4 +- 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BrooklynBomOsgiArchiveInstaller.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BrooklynBomOsgiArchiveInstaller.java index 011abd316b..e6b89ca141 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BrooklynBomOsgiArchiveInstaller.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BrooklynBomOsgiArchiveInstaller.java @@ -389,38 +389,39 @@ public class BrooklynBomOsgiArchiveInstaller { private void discoverManifestFromCatalogBom(boolean isCatalogBomRequired) { discoveredManifest = new BundleMaker(mgmt()).getManifest(zipFile.getFile()); -if (Strings.isNonBlank(bomText)) { -discoveredBomVersionedName = BasicBrooklynCatalog.getVersionedName(BasicBrooklynCatalog.getCatalogMetadata(bomText), false ); -return; -} - -ZipFile zf = null; -try { +Map catalogMetadata = null; +if (Strings.isBlank(bomText)) { +ZipFile zf = null; try { -zf = new ZipFile(zipFile.getFile()); -} catch (IOException e) { -throw new IllegalArgumentException("Invalid ZIP/JAR archive: "+e); -} -ZipEntry bom = zf.getEntry(BasicBrooklynCatalog.CATALOG_BOM); -if (bom==null) { -bom = zf.getEntry("/"+BasicBrooklynCatalog.CATALOG_BOM); -} -if (bom==null) { -if (isCatalogBomRequired) { -throw new IllegalArgumentException("Archive must contain a catalog.bom file in the root"); -} else { -return; +try { +zf = new ZipFile(zipFile.getFile()); +} catch (IOException e) { +throw new IllegalArgumentException("Invalid ZIP/JAR archive: " + e); } +ZipEntry bom = zf.getEntry(BasicBrooklynCatalog.CATALOG_BOM); +if (bom == null) { +bom = zf.getEntry("/" + BasicBrooklynCatalog.CATALOG_BOM); +} +if (bom == null) { +if (isCatalogBomRequired) { +throw new IllegalArgumentException("Archive must contain a catalog.bom file in the root"); +} else { +return; +} +} +try { +bomText = Streams.readFullyString(zf.getInputStream(bom)); +} catch (IOException e) { +throw new IllegalArgumentException("Error reading catalog.bom from ZIP/JAR archive: " + e); +} +} finally { +Streams.closeQuietly(zf); } -try { -bomText = Streams.readFullyString(zf.getInputStream(bom)); -} catch (IOException e) { -throw new IllegalArgumentException("Error reading catalog.bom from ZIP/JAR archive: "+e); -} -discoveredBomVersionedName = BasicBrooklynCatalog.getVersionedName( BasicBrooklynCatalog.getCatalogMetadata(bomText), false ); -} finally { -Streams.closeQuietly(zf); } + +catalogMetadata = BasicBrooklynCatalog.getCatalogMetadata(bomText); +discoveredBomVersionedName = BasicBrooklynCatalog.getVersionedName(catalogMetadata, false ); + BrooklynBomYamlCatalogBundleResolver.setTagsAndIconUrl(catalogMetadata, inferredMetadata); } private void updateManifestFromAllSourceInformation() { diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java index 7d569dc146..8450b6e425 100644 --- a/core/src/main/java/org/a
(brooklyn-docs) branch master updated: update docs for logging, documenting the `username` context var
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git The following commit(s) were added to refs/heads/master by this push: new 4ce267ec update docs for logging, documenting the `username` context var 4ce267ec is described below commit 4ce267ec3d8ef268a06ac9549a72711aa2cf402b Author: Alex Heneveld AuthorDate: Thu Jun 27 16:09:45 2024 +0100 update docs for logging, documenting the `username` context var --- guide/ops/logging/index.md | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guide/ops/logging/index.md b/guide/ops/logging/index.md index c12deb22..736feb1b 100644 --- a/guide/ops/logging/index.md +++ b/guide/ops/logging/index.md @@ -40,11 +40,22 @@ such as new appenders or different log levels, can be made directly in this file Karaf logging is highly configurable. For example enable the sift appender to log to separate log files for each bundle as described here: [Advanced configuration](https://karaf.apache.org/manual/latest/#_advanced_configuration) -Using the default configuration the log entries are reported in UTC time. If you want the logging to be reported using the server local time you can replace the `log4j2.pattern` removing the UTC flag and the Z suffix: +By default, file logging uses the following pattern, in the PAX logging file: + ```properties log4j2.pattern = %d{ISO8601}Z %X{task.id}-%X{entity.ids} %-5.5p %3X{bundle.id} %c{1.} [%.16t] %m%n ``` +This uses UTC time, and includes any context thread (`%t`), as well as the bundle ID, task ID, and entity IDs. +This makes the log easy to search, either from within AMP or using standard tools. +As log messages are written for all tasks when they are created, these IDs make it possible +trace back through the creation stack and identify the originating task or REST API call. +The `bundle.id`, `task.id` and `entity.ids` are set as logging context variables, accessed using `%X`. +The context variable `username` is also available if in the context of a REST API request, +and can be included by inserting `%X{username}` into the pattern above. + + + ## Advanced Configuration The default `logback.xml` file references a collection of other log configuration files
(brooklyn-server) branch master updated (77bb2c2515 -> 9ed4c13080)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 77bb2c2515 remove the WWW-Authenticate header when using the login form add a09fca94e7 Lookup user using BrooklynSecurityProviderFilterHelper add ecb37dc9b2 Add username to logging context new 9ed4c13080 Merge pull request #1416 from duncangrant/fix-rest-username-logging 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. Summary of changes: .../org/apache/brooklyn/rest/filter/LoggingResourceFilter.java| 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-)
(brooklyn-server) 01/01: Merge pull request #1416 from duncangrant/fix-rest-username-logging
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 9ed4c13080698aa89eea3407ee14cdeb703cf405 Merge: 77bb2c2515 ecb37dc9b2 Author: Alex Heneveld AuthorDate: Thu Jun 27 16:07:18 2024 +0100 Merge pull request #1416 from duncangrant/fix-rest-username-logging Lookup user using BrooklynSecurityProviderFilterHelper .../org/apache/brooklyn/rest/filter/LoggingResourceFilter.java| 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-)
(brooklyn-ui) 01/02: tweak name of login form
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 4bb467833975b97b59079e1b129f0e794073daae Author: Alex Heneveld AuthorDate: Thu Jun 27 13:45:33 2024 +0100 tweak name of login form --- ui-modules/login/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-modules/login/package.json b/ui-modules/login/package.json index bdc325c5..a86785e3 100644 --- a/ui-modules/login/package.json +++ b/ui-modules/login/package.json @@ -37,7 +37,7 @@ "yarn": ">=1.22.0" }, "brooklyn": { -"appname": "Login manager" +"appname": "Login" }, "dependencies": { "angular": "^1.6.1",
(brooklyn-ui) branch master updated (2ab3c4af -> 2429a734)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from 2ab3c4af merge iuliana's uploader enhancements, adding a couple things new 4bb46783 tweak name of login form new 2429a734 add logging and extra headers to login form The 2 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. Summary of changes: ui-modules/login/app/views/main/main.controller.js | 32 ++ ui-modules/login/package.json | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-)
(brooklyn-ui) 02/02: add logging and extra headers to login form
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 2429a734217cb70135a9c28ea394b0b5a4b5644c Author: Alex Heneveld AuthorDate: Thu Jun 27 13:52:23 2024 +0100 add logging and extra headers to login form --- ui-modules/login/app/views/main/main.controller.js | 32 ++ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/ui-modules/login/app/views/main/main.controller.js b/ui-modules/login/app/views/main/main.controller.js index d35c6518..a8f6d2bd 100644 --- a/ui-modules/login/app/views/main/main.controller.js +++ b/ui-modules/login/app/views/main/main.controller.js @@ -27,7 +27,13 @@ import './login-failed.less'; const MODULE_NAME = 'states.login'; angular.module(MODULE_NAME, [uiRouter, serverApi]) -.config(['$stateProvider', loginStateConfig]); +.config(['$stateProvider', loginStateConfig]) +.config(['$httpProvider', function($httpProvider) { + // Sometimes this can help prevent the auth popup from appearing, + // by indicating the apache and nginx that WWW-Authenticate should be omitted. + // Not necessary because Brooklyn server rewrites BASIC where necessary, but potentially useful. + $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; +}]); export default MODULE_NAME; @@ -52,13 +58,27 @@ export function loginStateController($scope, $http, $window, $uibModal, brBrandI let loginController = this; loginController.error = {}; -var testAuthReq = { +const testAuthReq = { method: 'HEAD', -url: '/v1/server/up/extended' +url: '/v1/server/up/extended', +headers: { + // as above (httpProvider) + 'X-Requested-With': 'XMLHttpRequest' +} } // If the user is already logged in then redirect to home -$http(testAuthReq).then( () => ( $window.location.href = '/' ) ); +// (note httpProvider call above to prevent browser popup) +$http(testAuthReq).then( () => { +if ($window.location.pathname = '/') { + throw new Error('Actually API request was successful, and we are logged in, but this page is configured to be shown as the root. A redirect will result in an infinite loop, so will ignore and simply show this form.'); + // will get caught below +} +console.debug("API request successful. Either already logged in or no login necessary. Redirecting to main page instead of showing login form. Coming from: "+$window.location.href); +$window.location.href = '/'; + }).catch(err => { +console.debug("API request unsuccessful. Not already logged in. Showing login form.", err); + }); $scope.login = (user)=> { if (user==null) { @@ -66,9 +86,9 @@ export function loginStateController($scope, $http, $window, $uibModal, brBrandI return; } var req = { -method: 'HEAD', -url: '/v1/server/up/extended', +...testAuthReq, headers: { +...testAuthReq.headers, 'Authorization': 'Basic ' + btoa(user.name +":" + user.password) } }
(brooklyn-server) 02/02: remove the WWW-Authenticate header when using the login form
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 77bb2c25156c108e7755f1a33435d6fa0b84c38d Author: Alex Heneveld AuthorDate: Thu Jun 27 14:04:42 2024 +0100 remove the WWW-Authenticate header when using the login form it had been added for errors as part of oauth support, but when using the login form, it triggers a browser login popup --- .../BrooklynSecurityProviderFilterJersey.java | 28 ++ 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/filter/BrooklynSecurityProviderFilterJersey.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/filter/BrooklynSecurityProviderFilterJersey.java index d2c91f2819..be2c9752b5 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/filter/BrooklynSecurityProviderFilterJersey.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/filter/BrooklynSecurityProviderFilterJersey.java @@ -19,6 +19,7 @@ package org.apache.brooklyn.rest.filter; import java.io.IOException; +import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -63,6 +64,8 @@ public class BrooklynSecurityProviderFilterJersey implements ContainerRequestFil @Context private ContextResolver mgmtC; +private static boolean LOGGED_LOGIN_FORM_WITH_INCOMPATIBLE_AUTH_WARNING = false; + @SuppressWarnings("resource") @Override public void filter(ContainerRequestContext requestContext) throws IOException { @@ -85,10 +88,7 @@ public class BrooklynSecurityProviderFilterJersey implements ContainerRequestFil rin = Response.status(Status.UNAUTHORIZED).entity("Authentication is required").build(); } } -if (rin.getStatus()==Status.UNAUTHORIZED.getStatusCode() && - Strings.isNonBlank(mgmt.getConfig().getConfig(BrooklynSecurityProviderFilterJavax.LOGIN_FORM))) { -rin = Response.status(Status.UNAUTHORIZED).entity("Authentication is required").header(LOGIN_PAGE_HEADER, mgmt.getConfig().getConfig(BrooklynSecurityProviderFilterJavax.LOGIN_FORM)).build(); -} + // adding headers in `headersToForward` if they are present in the original response MultivaluedMap responseHeaders = e.getResponse().getHeaders(); if(responseHeaders != null && !responseHeaders.isEmpty()){ @@ -98,6 +98,26 @@ public class BrooklynSecurityProviderFilterJersey implements ContainerRequestFil } }; } + +// if form is being used, we must NOT forward the WWW-Auth header +if (rin.getStatus()==Status.UNAUTHORIZED.getStatusCode()) { +String form = mgmt.getConfig().getConfig(BrooklynSecurityProviderFilterJavax.LOGIN_FORM); +if (Strings.isNonBlank(form)) { +if (!LOGGED_LOGIN_FORM_WITH_INCOMPATIBLE_AUTH_WARNING) { +List existingAuthHeaders = rin.getHeaders().get(HttpHeader.WWW_AUTHENTICATE); +if (!existingAuthHeaders.isEmpty() && existingAuthHeaders.stream().noneMatch(x -> ("" + x).toLowerCase().startsWith("basic "))) { +LOGGED_LOGIN_FORM_WITH_INCOMPATIBLE_AUTH_WARNING = true; + log.warn(BrooklynSecurityProviderFilterJavax.LOGIN_FORM.getName() + " " + form + " being used with incompatible auth scheme (logging once only): " + existingAuthHeaders); +} +} +rin = Response.fromResponse(rin).status(Status.UNAUTHORIZED).entity("Authentication is required using form at "+form) +.header(LOGIN_PAGE_HEADER, form) +.header(HttpHeaders.WWW_AUTHENTICATE, null) // clear the previous, so we don't return basic as browsers interecept that +.header(HttpHeaders.WWW_AUTHENTICATE, "X-Basic realm=\"login-form\"") // then add our custom one +.build(); +} +} + requestContext.abortWith(rin); } }
(brooklyn-server) 01/02: improve handling if ssh expiry set to 0/negative/forever
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 064a4eb145816fbb91948f3c286aeafc1f7f3933 Author: Alex Heneveld AuthorDate: Thu Jun 27 10:51:13 2024 +0100 improve handling if ssh expiry set to 0/negative/forever --- .../brooklyn/location/ssh/SshMachineLocation.java | 24 -- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java b/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java index a1619b7e00..cef74dae72 100644 --- a/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java +++ b/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java @@ -307,14 +307,26 @@ public class SshMachineLocation extends AbstractMachineLocation implements Machi } private LoadingCache, Pool> buildSshToolPoolCacheLoader() { -// TODO: Appropriate numbers for maximum size and expire after access -// At the moment every SshMachineLocation instance creates its own pool. -// It might make more sense to create one pool and inject it into all SshMachineLocations. +// Every SshMachineLocation instance creates its own pool. +// Expiry is configurable, but max size is not. + +CacheBuilder db = CacheBuilder.newBuilder(); + Duration expiryDuration = getConfig(SSH_CACHE_EXPIRY_DURATION); - -LoadingCache, Pool> delegate = CacheBuilder.newBuilder() +if (expiryDuration!=null) { +// has a default, so shouldn't normally be null +if (!expiryDuration.isPositive()) { +// non-positive duration is an error, as it disables cache +throw new IllegalArgumentException("Expiry duration must be positive if specified. " + +"To trigger an immediate close after use, set " + + ConfigUtils.prefixedKey(SshTool.BROOKLYN_CONFIG_KEY_PREFIX, CLOSE_CONNECTION).getName() + "=true instead."); +} else if (expiryDuration.isShorterThan(Duration.PRACTICALLY_FOREVER)){ +db = db.expireAfterAccess(expiryDuration.toNanoseconds(), TimeUnit.NANOSECONDS); +} +} + +LoadingCache, Pool> delegate = db .maximumSize(10) -.expireAfterAccess(expiryDuration.toMilliseconds(), TimeUnit.MILLISECONDS) .recordStats() .removalListener(new RemovalListener, Pool>() { // TODO: Does it matter that this is synchronous? - Can closing pools cause long delays?
(brooklyn-server) branch master updated (471161db1f -> 77bb2c2515)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 471161db1f provide a way for extended rest endpoints to indicate the correct path to swagger new 064a4eb145 improve handling if ssh expiry set to 0/negative/forever new 77bb2c2515 remove the WWW-Authenticate header when using the login form The 2 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. Summary of changes: .../brooklyn/location/ssh/SshMachineLocation.java | 24 ++- .../BrooklynSecurityProviderFilterJersey.java | 28 ++ 2 files changed, 42 insertions(+), 10 deletions(-)
(brooklyn-docs) branch master updated: document ssh close and cache behaviour
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git The following commit(s) were added to refs/heads/master by this push: new 936ac07b document ssh close and cache behaviour 936ac07b is described below commit 936ac07b69c7f29737ac5f306cd875094c47bcf0 Author: Alex Heneveld AuthorDate: Thu Jun 27 10:52:29 2024 +0100 document ssh close and cache behaviour --- guide/locations/_clouds.md | 9 + guide/ops/troubleshooting/slow-unresponsive.md | 15 +++ 2 files changed, 24 insertions(+) diff --git a/guide/locations/_clouds.md b/guide/locations/_clouds.md index ef59924b..7ecf7d37 100644 --- a/guide/locations/_clouds.md +++ b/guide/locations/_clouds.md @@ -230,6 +230,8 @@ For more keys and more detail on the keys below, see This setting prevents scripts executed on the VMs from being deleted on completion. Note that some scripts run periodically so this can eventually fill a disk; it should only be used for dev/test. +## SSH Low-Level Configuration + - Use `scripts.ignoreCerts: false` to issue `curl` and other download commands on-box in such a way that they require valid certificates from the servers they connect to (e.g. without the `-k` argument to `curl`, or GPG check for package installers); @@ -285,6 +287,13 @@ For more keys and more detail on the keys below, see the CLI is not good practice. It can be tricky to pass password directly (e.g. using expect scripts or askpass) and password-less mechanisms are normally recommended when using a CLI-based SSH. +- `sshCacheExpiryDuration` will override how long SSH sessions are kept open for reuse, defaulting to 5 minutes. + This can be any positive duration, such as `15s` to close pretty quickly, or `forever` not to close + (unless the location is unmanaged or there is another trigger). This may not be 0, but see the next key. + +- `brooklyn.ssh.config.close` can be set `true` to cause SSH sessions to be closed immediately after use. + This overrides any `sshCacheExpiryDuration`, and is useful where many entities may SSH to the same target. + Other low level parameters are available in specific contexts, as described in the JavaDoc for the relevant classes and in some cases in `BrooklynConfigKeys`. diff --git a/guide/ops/troubleshooting/slow-unresponsive.md b/guide/ops/troubleshooting/slow-unresponsive.md index 9c777615..a2e8a777 100644 --- a/guide/ops/troubleshooting/slow-unresponsive.md +++ b/guide/ops/troubleshooting/slow-unresponsive.md @@ -109,6 +109,21 @@ tasks like ssh to also be extremely slow. See for details of how to work around this. + SSHD Limits + +Apache Brooklyn will attempt to re-use the SSH connections to machines on a per-location basis, by default, +keeping sessions open for up to 5 minutes if the entity/location is managed. +If the same target is used via multiple `SshMachineLocation` instances +(such as through BYON or localhost), this may trigger SSHD throttling. + +This can be resolved by setting either `sshCacheExpiryDuration: 10s` or `brooklyn.ssh.config.close: true`, +on the location, as described [here](/guide/locations#ssh-low-level-configuration). + +It could also be resolved by increasing `MaxSessions` and `MaxStartups` in `sshd_config` on the target system. +More info on SSHD limits are documented [here](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Load_Balancing). + + + ## Process Diagnostics Thread and Memory Usage
(brooklyn-ui) 02/02: merge iuliana's uploader enhancements, adding a couple things
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 2ab3c4af4b57927253f62914138c9cc74a8fccee Author: Alex Heneveld AuthorDate: Fri Jun 21 10:31:39 2024 +0100 merge iuliana's uploader enhancements, adding a couple things - updates catalog after save - shows like a modal rather than a full screen - show failure more clearly --- .../catalog/app/views/catalog/catalog.state.js | 14 +++- .../utils/catalog-uploader/catalog-uploader.html | 94 + .../utils/catalog-uploader/catalog-uploader.js | 24 -- .../utils/catalog-uploader/catalog-uploader.less | 95 +++--- 4 files changed, 150 insertions(+), 77 deletions(-) diff --git a/ui-modules/catalog/app/views/catalog/catalog.state.js b/ui-modules/catalog/app/views/catalog/catalog.state.js index 64534312..1d931f0e 100644 --- a/ui-modules/catalog/app/views/catalog/catalog.state.js +++ b/ui-modules/catalog/app/views/catalog/catalog.state.js @@ -24,6 +24,7 @@ import brUtils from 'brooklyn-ui-utils/utils/general'; import template from './catalog.template.html'; import {analyzeDescription} from 'brooklyn-ui-utils/md-helper'; import {HIDE_INTERSTITIAL_SPINNER_EVENT} from 'brooklyn-ui-utils/interstitial-spinner/interstitial-spinner'; +import {CATALOG_UPLOAD_COMPLETED} from 'brooklyn-ui-utils/catalog-uploader/catalog-uploader'; const MODULE_NAME = 'catalog.state'; @@ -136,10 +137,15 @@ export function catalogController($scope, $rootScope, catalogApi, brUtilsGeneral $rootScope.$broadcast('open-catalog-uploader'); }; -catalogApi.getBundles({params: {detail: true}}).then(data => { -$scope.$emit(HIDE_INTERSTITIAL_SPINNER_EVENT); - -processBundles(data); +function getBundles(initialLoad) { +catalogApi.getBundles({params: {detail: true}}).then(data => { +if (initialLoad) $scope.$emit(HIDE_INTERSTITIAL_SPINNER_EVENT); +processBundles(data); +}); +} +getBundles(true); +$scope.$on(CATALOG_UPLOAD_COMPLETED, ()=>{ +getBundles(false); }); function processBundles(bundles) { diff --git a/ui-modules/utils/catalog-uploader/catalog-uploader.html b/ui-modules/utils/catalog-uploader/catalog-uploader.html index bc6b9d4f..0cb633e1 100644 --- a/ui-modules/utils/catalog-uploader/catalog-uploader.html +++ b/ui-modules/utils/catalog-uploader/catalog-uploader.html @@ -17,46 +17,70 @@ under the License. --> - - - - - - - -Choose files or drag & drop them here. - - + + + + + + + + + + + + + + +Choose files or drag & drop them here. + - - - - -Importing {{selectedFile.name}} - - - {{isDetailsCollapsed ? 'View' : 'hide'}} details - -Successfully imported the following items: - - - -{{item.itemType}} {{item.symbolicName}}:{{item.version}} - - - -{{selectedFile.error}} + + + + + +Importing {{selectedFile.name}} - - - - - -Return to catalog - + + + + Upload failed. + + + Completed. + + + Click {{isDetailsCollapsed ? 'for' : 'to hide'}} {{selectedFile.error ? ' error ' : ''}} details. + + + + +Successfully imported the following items: + + + +{{item.itemType}} {{item.symbolicName}}:{{item.version}} + + + +{{selectedFile.error}} + + + + + + +Return to catalog + + + + diff --git a/ui-modules/utils/catalog-uploader/catalog-uploader.js b/ui-modules/utils/catalog-uploader/catalog-uploader.js index d16f7716..0beed85b 100644 --- a/ui-modules/utils/catalog-uploader/catalog-uploader.js +++ b/ui-modules/utils/catalog-uploader/catalog-uploader.js @@ -3
(brooklyn-ui) branch master updated (94ad2d04 -> 2ab3c4af)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from 94ad2d04 support for more binary archives add d18cd390 Added clickable URLs, that open in a new tab for imported types, added a 'Return to Catalog Button' and cleaned up the list of imported types on returning to catalog new 3237ca42 Merge remote-tracking branch 'iuliana/type-url-fix' new 2ab3c4af merge iuliana's uploader enhancements, adding a couple things The 2 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. Summary of changes: .../catalog/app/views/catalog/catalog.state.js | 14 +++- .../utils/catalog-uploader/catalog-uploader.html | 88 +--- .../utils/catalog-uploader/catalog-uploader.js | 27 -- .../utils/catalog-uploader/catalog-uploader.less | 95 +++--- 4 files changed, 153 insertions(+), 71 deletions(-)
(brooklyn-ui) 01/02: Merge remote-tracking branch 'iuliana/type-url-fix'
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git commit 3237ca42ff44508407fdce6569555f4d0483ffa2 Merge: 94ad2d04 d18cd390 Author: Alex Heneveld AuthorDate: Fri Jun 21 08:43:35 2024 +0100 Merge remote-tracking branch 'iuliana/type-url-fix' ui-modules/utils/catalog-uploader/catalog-uploader.html | 14 +++--- ui-modules/utils/catalog-uploader/catalog-uploader.js | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-)
(brooklyn-ui) branch master updated: support for more binary archives
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/master by this push: new 94ad2d04 support for more binary archives 94ad2d04 is described below commit 94ad2d049317329c1b45c26246fa2f0c89bef495 Author: Alex Heneveld AuthorDate: Mon Jun 17 17:37:06 2024 +0100 support for more binary archives --- .../utils/catalog-uploader/catalog-uploader.js | 62 -- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/ui-modules/utils/catalog-uploader/catalog-uploader.js b/ui-modules/utils/catalog-uploader/catalog-uploader.js index d7480a35..f9141de9 100644 --- a/ui-modules/utils/catalog-uploader/catalog-uploader.js +++ b/ui-modules/utils/catalog-uploader/catalog-uploader.js @@ -139,25 +139,36 @@ export function catalogUploaderDirective($compile, brooklynCatalogUploader) { * Encapsulate the logic to validate files to upload to the catalog. */ export function catalogUploaderService($q, catalogApi) { -let extensions = { -'bom': { +function getFileTypeProperties(fn) { + if (!fn) return null; + const fnl = fn.toLowerCase(); + if (["bom","yml","yaml"].find(ext => fnl.endsWith("."+ext))) { +return { + http: { headers: {'Content-Type': 'application/yaml'} -}, -'yml': { -headers: {'Content-Type': 'application/yaml'} -}, -'yaml': { -headers: {'Content-Type': 'application/yaml'} -}, -'zip' : { -headers: {'Content-Type': 'application/x-zip'}, -transformRequest: angular.identity -}, -'jar' : { + } +}; + } + if (fnl.endsWith(".jar")) { +return { + binary: true, + http: { headers: {'Content-Type': 'application/x-jar'}, -transformRequest: angular.identity -} -}; +transformRequest: angular.identity + } +}; + } + if (fnl.endsWith(".zip") || fnl.endsWith("ar")) { // support other archive types, tar, csar, etc +return { + binary: true, + http: { +headers: {'Content-Type': 'application/x-zip'}, +transformRequest: angular.identity + } +}; + } + return null; +} return { /** @@ -181,19 +192,15 @@ export function catalogUploaderService($q, catalogApi) { function upload(file) { let defer = $q.defer(); -if (new RegExp('^.*\.(' + Object.keys(extensions).join('|') + ')$').test(file.name)) { -Object.keys(extensions).forEach((extension)=> { -if (!new RegExp('^.*\.(' + extension + ')$').test(file.name)) { -return; -} +const options = getFileTypeProperties(file.name); -let options = extensions[extension]; +if (options!=null) { let reader = new FileReader(); reader.addEventListener('load', ()=> { try { let rawData = new Uint8Array(reader.result); -let data = ['zip', 'jar'].indexOf(extension) > -1 ? rawData : String.fromCharCode.apply(null, rawData); -catalogApi.create(data, {}, options).then((response)=> { +let data = options.binary ? rawData : String.fromCharCode.apply(null, rawData); +catalogApi.create(data, {}, options.http).then((response)=> { defer.resolve(response); }).catch((response)=> { defer.reject('Cannot upload item to the catalog: ' + response.error.message); @@ -203,9 +210,8 @@ export function catalogUploaderService($q, catalogApi) { } }, false); reader.readAsArrayBuffer(file); -}); } else { -defer.reject('Unsupported file type. Please upload only files with the following extensions: ' + Object.keys(extensions).map((extension)=>('*.' + extension)).join(', ')); +defer.reject("Unsupported file type. Supported types include BOM, YAML, and ZIP. The extension is significant."); } return defer.promise; @@ -225,4 +231,4 @@ export function customOnChangeDirective() { }); } }; -} \ No newline at end of file +}
(brooklyn-server) branch master updated: provide a way for extended rest endpoints to indicate the correct path to swagger
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 471161db1f provide a way for extended rest endpoints to indicate the correct path to swagger 471161db1f is described below commit 471161db1f4c46b9766dde4c06d34039acd9fcdc Author: Alex Heneveld AuthorDate: Mon Jun 17 16:55:45 2024 +0100 provide a way for extended rest endpoints to indicate the correct path to swagger without this, swagger looks at the @Path annotation and the basepath, but that doesn't work for osgi blueprints that have an intermediate path that is non-empty, and only one can be installed at the base path. --- .../rest/apidoc/RestApiResourceScanner.java| 54 +- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/utils/rest-swagger/src/main/java/org/apache/brooklyn/rest/apidoc/RestApiResourceScanner.java b/utils/rest-swagger/src/main/java/org/apache/brooklyn/rest/apidoc/RestApiResourceScanner.java index dc164b0415..be78868fea 100644 --- a/utils/rest-swagger/src/main/java/org/apache/brooklyn/rest/apidoc/RestApiResourceScanner.java +++ b/utils/rest-swagger/src/main/java/org/apache/brooklyn/rest/apidoc/RestApiResourceScanner.java @@ -15,17 +15,6 @@ */ package org.apache.brooklyn.rest.apidoc; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.WeakHashMap; - -import javax.servlet.ServletConfig; -import javax.ws.rs.core.Application; - import io.swagger.annotations.Api; import io.swagger.config.Scanner; import io.swagger.config.ScannerFactory; @@ -35,6 +24,7 @@ import io.swagger.jaxrs.config.JaxrsScanner; import io.swagger.jaxrs.config.SwaggerContextService; import io.swagger.jaxrs.config.SwaggerScannerLocator; import io.swagger.models.Info; +import io.swagger.models.Path; import io.swagger.models.Scheme; import io.swagger.models.Swagger; import io.swagger.models.auth.ApiKeyAuthDefinition; @@ -44,6 +34,18 @@ import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; import io.swagger.models.refs.RefFormat; +import io.swagger.util.ReflectionUtils; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.WeakHashMap; +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Application; /** * Scans resources for Swagger API resources. Makes them available to the Swagger scanner. @@ -64,6 +66,7 @@ public class RestApiResourceScanner extends AbstractScanner implements JaxrsScan private boolean scannerDirty = true; private final Set> globalClasses = new HashSet<>(); +private final Map,String> classExtraPrefixes = new LinkedHashMap<>(); private final Map>> appCache = new WeakHashMap<>(); @@ -157,6 +160,27 @@ public class RestApiResourceScanner extends AbstractScanner implements JaxrsScan arrayProp.setItems(new RefProperty("#/definitions/TypeToken", RefFormat.INTERNAL)); } } + +if (!classExtraPrefixes.isEmpty()) { +Map extraPrefixesByTag = new LinkedHashMap<>(); +classExtraPrefixes.forEach((clazz, prefix) -> { +Api api = ReflectionUtils.getAnnotation(clazz, Api.class); +if (api==null) throw new IllegalStateException("Cannot install "+clazz+" to REST API doc because it does not define an @Api tag for Swagger."); +extraPrefixesByTag.put(api.value(), prefix); +}); +Map oldPaths = swagger.getPaths(); +Map newPaths = new LinkedHashMap<>(); +oldPaths.forEach((k, v) -> { +Optional prefix = v.getOperations().stream().filter(op -> op != null).flatMap(op -> op.getTags().stream().map(extraPrefixesByTag::get).filter(x -> x != null)) +.findFirst(); +if (prefix.isPresent()) { +newPaths.put("/" + prefix.get() + k, v); +} else { +newPaths.put(k,v); +} +}); +swagger.setPaths(newPaths); +} } private Info getSwaggerInfo() { @@ -190,6 +214,14 @@ public class RestApiResourceScanner extends AbstractScanner implements JaxrsScan ((RestApiResourceScanner)ScannerFactory.getScanner()).scannerDirty = true; } +/** as {@link #install(Collection)} but for one resource class, with an extra prefix prepended b
(brooklyn-server) branch master updated: Change config/sensor to return 200, 204, or 404. Tidy other API documentation bits.
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new bfe0677f24 Change config/sensor to return 200, 204, or 404. Tidy other API documentation bits. bfe0677f24 is described below commit bfe0677f247d15f47f20bb86fa23e1b2b9db87f1 Author: Alex Heneveld AuthorDate: Mon Jun 17 13:22:39 2024 +0100 Change config/sensor to return 200, 204, or 404. Tidy other API documentation bits. @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 204, message = "No Content. The config is known, but unset."), @ApiResponse(code = 404, message = "Could not find application, entity or config key"), The behavior is now as above. 404 is returned if the sensor (or config) is not defined, and 204 if it is defined but unset. 200 with null or empty string is only returned if the sensor/config is explictly set as such. Additionally, some discrepancies where Accepted was used instead of Created or sometimes OK has been fixed, and OK is returned in some places where ACCEPTED or CREATED had been where it makes more sense to do so. --- .../org/apache/brooklyn/rest/api/ActivityApi.java | 3 ++- .../apache/brooklyn/rest/api/ApplicationApi.java | 2 +- .../org/apache/brooklyn/rest/api/BundleApi.java| 9 --- .../org/apache/brooklyn/rest/api/CatalogApi.java | 4 +-- .../org/apache/brooklyn/rest/api/EffectorApi.java | 5 ++-- .../org/apache/brooklyn/rest/api/EntityApi.java| 16 ++-- .../apache/brooklyn/rest/api/EntityConfigApi.java | 10 +--- .../org/apache/brooklyn/rest/api/LogoutApi.java| 7 +++--- .../org/apache/brooklyn/rest/api/ScriptApi.java| 2 +- .../org/apache/brooklyn/rest/api/SensorApi.java| 9 --- .../org/apache/brooklyn/rest/api/ServerApi.java| 14 +-- .../org/apache/brooklyn/rest/domain/ApiError.java | 15 +++ .../brooklyn/rest/resources/EffectorResource.java | 7 +- .../rest/resources/EntityConfigResource.java | 20 +-- .../brooklyn/rest/resources/SensorResource.java| 29 +++--- .../brooklyn/rest/util/EntityAttributesUtils.java | 21 .../brooklyn/rest/util/WebResourceUtils.java | 14 +++ .../rest/resources/ApplicationResourceTest.java| 4 +-- .../rest/resources/EffectorResourceTest.java | 6 ++--- .../rest/resources/SensorResourceTest.java | 7 -- .../entity/brooklynnode/DeployBlueprintTest.java | 5 ++-- 21 files changed, 152 insertions(+), 57 deletions(-) diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java index aabc2d2bd5..8679528957 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java @@ -44,7 +44,8 @@ public interface ActivityApi { @Path("/{task}") @ApiOperation(value = "Fetch task details", response = org.apache.brooklyn.rest.domain.TaskSummary.class) @ApiResponses(value = { -@ApiResponse(code = 200, message = "OK"), +@ApiResponse(code = 200, message = "OK. The task is completed and details are returned."), +@ApiResponse(code = 202, message = "Accepted. The task is still running but it is not permitted to wait any longer so current details are returned."), @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 404, message = "Could not find task"), diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java index bd9ed5b473..e3f9f2e6fa 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java @@ -384,7 +384,7 @@ public interface ApplicationApi { response = org.apache.brooklyn.rest.domain.TaskSummary.class ) @ApiResponses(value = { -@ApiResponse(code = 200, message = "OK"), +@ApiResponse(code = 202, message = "Accepted. The application is submitted for deletion."), @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 404, message = "Application not found"), diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api
(brooklyn-server) branch master updated: catch and recover on rare CME
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new e9e4852f0c catch and recover on rare CME e9e4852f0c is described below commit e9e4852f0cd36383815baff1e6b3c620ff265835 Author: Alex Heneveld AuthorDate: Tue Jun 4 00:23:39 2024 +0100 catch and recover on rare CME --- .../util/core/task/CrossTaskThreadLocalStack.java | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/CrossTaskThreadLocalStack.java b/core/src/main/java/org/apache/brooklyn/util/core/task/CrossTaskThreadLocalStack.java index 8421395d73..c83b6f967b 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/task/CrossTaskThreadLocalStack.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/task/CrossTaskThreadLocalStack.java @@ -19,15 +19,20 @@ package org.apache.brooklyn.util.core.task; import java.util.Collection; +import java.util.ConcurrentModificationException; import java.util.WeakHashMap; import java.util.stream.Stream; import com.google.common.collect.Streams; import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.util.collections.ThreadLocalStack; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CrossTaskThreadLocalStack extends ThreadLocalStack { +private static final Logger log = LoggerFactory.getLogger(CrossTaskThreadLocalStack.class); + public CrossTaskThreadLocalStack(boolean acceptDuplicates) { super(acceptDuplicates); } @@ -52,7 +57,17 @@ public class CrossTaskThreadLocalStack extends ThreadLocalStack { return getCopyReversed(Thread.currentThread()); } protected Collection getCopyReversed(Thread t) { -synchronized (backingOverride) { return copyReversed(get(t)); } +int retries = 0; +while (true) { +try { +synchronized (backingOverride) {return copyReversed(get(t));} +} catch (ConcurrentModificationException cme) { +// can happen as the collections within the map are not synchronized. simply retry. +// unusual if it loops +if (retries++ >= 10) throw cme; +log.debug("CME checking cross-thread local stack; retrying (#" + retries + "): " + cme); +} +} } public Stream stream() {
(brooklyn-server) branch master updated: add conveniences for entity tests
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 531a72de93 add conveniences for entity tests 531a72de93 is described below commit 531a72de93496435a70e25c44e121d6b88fd6581 Author: Alex Heneveld AuthorDate: Sat Jun 1 02:09:11 2024 +0100 add conveniences for entity tests --- .../main/java/org/apache/brooklyn/core/entity/EntityAsserts.java | 8 1 file changed, 8 insertions(+) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java index 836ca17c19..74436f3b51 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java @@ -32,7 +32,9 @@ import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; +import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.time.Duration; @@ -58,10 +60,16 @@ public class EntityAsserts { public static void assertAttributeEquals(Entity entity, AttributeSensor attribute, T expected) { assertEquals(entity.getAttribute(attribute), expected, "entity=" + entity + "; attribute=" + attribute); } +public static void assertAttributeEquals(Entity entity, String attributeName, T expected) { +assertAttributeEquals(entity, Sensors.newSensor(Object.class, attributeName), expected); +} public static void assertConfigEquals(Entity entity, ConfigKey configKey, T expected) { assertEquals(entity.getConfig(configKey), expected, "entity=" + entity + "; configKey=" + configKey); } +public static void assertConfigEquals(Entity entity, String configKeyName, T expected) { +assertConfigEquals(entity, ConfigKeys.newConfigKey(Object.class, configKeyName), expected); +} public static void assertAttributeEqualsEventually(final Entity entity, final AttributeSensor attribute, final T expected) { assertAttributeEqualsEventually(Maps.newLinkedHashMap(), entity, attribute, expected);
(brooklyn-server) 02/02: workflow flow control - labels, output, end semantics
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit ba15bed0f984c2542fcd08fd7e486073114ab5e9 Author: Alex Heneveld AuthorDate: Fri May 31 15:12:26 2024 +0100 workflow flow control - labels, output, end semantics - add a label step to more easily set an id - support let output to set the output but without returning - goto end will go to the end of the containing list (parent context if inline subworkflow in shorthand) --- .../camp/brooklyn/WorkflowYamlRebindTest.java | 39 +- .../persisted-entity-with-workflow-next-fields.xml | 678 + .../core/workflow/WorkflowExecutionContext.java| 47 +- .../WorkflowStepInstanceExecutionContext.java | 17 +- .../core/workflow/steps/CustomWorkflowStep.java| 46 +- .../core/workflow/steps/flow/IfWorkflowStep.java | 5 +- ...urnWorkflowStep.java => LabelWorkflowStep.java} | 37 +- .../workflow/steps/flow/ReturnWorkflowStep.java| 1 - .../core/workflow/steps/flow/SubWorkflowStep.java | 25 +- .../steps/variables/SetVariableWorkflowStep.java | 2 + .../brooklyn/core/workflow/WorkflowBasicTest.java | 2 + .../workflow/WorkflowParsingEdgeCasesTest.java | 72 --- .../workflow/WorkflowPersistReplayErrorsTest.java | 4 +- .../WorkflowSubIfAndCustomExtensionEdgeTest.java | 91 ++- karaf/init/src/main/resources/catalog.bom | 5 + 15 files changed, 924 insertions(+), 147 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlRebindTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlRebindTest.java index 697428ccec..4fc10f1639 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlRebindTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlRebindTest.java @@ -25,6 +25,7 @@ import java.util.Set; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; +import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.EntitySpec; @@ -45,6 +46,8 @@ import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.workflow.WorkflowBasicTest; import org.apache.brooklyn.core.workflow.WorkflowEffector; +import org.apache.brooklyn.core.workflow.WorkflowExecutionContext; +import org.apache.brooklyn.core.workflow.store.WorkflowStatePersistenceViaSensors; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.entity.stock.BasicApplication; import org.apache.brooklyn.entity.stock.BasicEntity; @@ -54,9 +57,11 @@ import org.apache.brooklyn.tasks.kubectl.ContainerWorkflowStep; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; +import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.text.Strings; import org.apache.brooklyn.util.time.Duration; +import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; @@ -194,7 +199,7 @@ public class WorkflowYamlRebindTest extends AbstractYamlRebindTest { } @Test -void testWorkflowSensorRebind() throws Exception { +public void testWorkflowSensorRebind() throws Exception { Entity app = createAndStartApplication( "services:", "- type: " + BasicEntity.class.getName(), @@ -242,7 +247,7 @@ public class WorkflowYamlRebindTest extends AbstractYamlRebindTest { } @Test -void testWorkflowSensorWithMutexRebind() throws Exception { +public void testWorkflowSensorWithMutexRebind() throws Exception { Entity app = createAndStartApplication( "services:", "- type: " + BasicEntity.class.getName(), @@ -295,4 +300,32 @@ public class WorkflowYamlRebindTest extends AbstractYamlRebindTest { Asserts.assertThat(tt, ts -> ts.stream().anyMatch(ti -> ti.getDisplayName().contains("Workflow for sensor"))); } -} +@Test +public void testRebindsHistoricNextIsReturnLocalWorkflow() throws Exception { +Application app; +//app = mgmt().getEntityManager().createEntity(EntitySpec.create(BasicApplication.class)); +//WorkflowExecutionContext wc1 = WorkflowBasicTest.runWorkflow(app, Strings.lines( +//"steps:
(brooklyn-server) branch master updated (d55ea77c0b -> ba15bed0f9)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from d55ea77c0b add note and increase timeout for intermittent failure new f6716dc8aa allow output from previous step to be accessible in subworkflow new ba15bed0f9 workflow flow control - labels, output, end semantics The 2 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. Summary of changes: .../camp/brooklyn/WorkflowYamlRebindTest.java | 39 +- .../brooklyn/camp/brooklyn/WorkflowYamlTest.java | 16 + .../persisted-entity-with-workflow-next-fields.xml | 678 + .../core/workflow/WorkflowExecutionContext.java| 47 +- .../workflow/WorkflowExpressionResolution.java | 3 +- .../WorkflowStepInstanceExecutionContext.java | 17 +- .../core/workflow/steps/CustomWorkflowStep.java| 47 +- .../core/workflow/steps/flow/IfWorkflowStep.java | 5 +- ...otoWorkflowStep.java => LabelWorkflowStep.java} | 28 +- .../workflow/steps/flow/ReturnWorkflowStep.java| 1 - .../core/workflow/steps/flow/SubWorkflowStep.java | 35 +- .../steps/variables/SetVariableWorkflowStep.java | 2 + .../brooklyn/core/workflow/WorkflowBasicTest.java | 2 + .../workflow/WorkflowParsingEdgeCasesTest.java | 72 --- .../workflow/WorkflowPersistReplayErrorsTest.java | 4 +- .../WorkflowSubIfAndCustomExtensionEdgeTest.java | 91 ++- karaf/init/src/main/resources/catalog.bom | 5 + 17 files changed, 947 insertions(+), 145 deletions(-) create mode 100644 camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/persisted-entity-with-workflow-next-fields.xml copy core/src/main/java/org/apache/brooklyn/core/workflow/steps/flow/{GotoWorkflowStep.java => LabelWorkflowStep.java} (60%)
(brooklyn-server) 01/02: allow output from previous step to be accessible in subworkflow
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit f6716dc8aa4b52955537c8d576191acee2bf5948 Author: Alex Heneveld AuthorDate: Fri May 31 10:53:52 2024 +0100 allow output from previous step to be accessible in subworkflow --- .../apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java | 16 .../core/workflow/WorkflowExpressionResolution.java | 3 ++- .../brooklyn/core/workflow/steps/CustomWorkflowStep.java | 1 + .../core/workflow/steps/flow/SubWorkflowStep.java| 10 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java index 02f9517fd7..7b3ea599a2 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java @@ -1639,4 +1639,20 @@ public class WorkflowYamlTest extends AbstractYamlTest { Asserts.assertEquals(((Map)result).get("exit_code"), 0); } +@Test +public void testOutputAccessibleInSubWorkflow() throws Exception { +Application app = createAndStartApplication( +"services:", +"- type: " + BasicEntity.class.getName(), +" id: child"); + +WorkflowExecutionContext x = WorkflowBasicTest.runWorkflow(app, Strings.lines( +"steps:", +" - transform value { a: 1 } | type map", +" - type: subworkflow", +"steps:", +" - return ${output.a}-${a}" +), "test"); +Asserts.assertEquals(x.getTask(true).get().getUnchecked(), "1-1"); +} } diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java index 633ddbfc2b..90a99de0e3 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java @@ -187,7 +187,8 @@ public class WorkflowExpressionResolution { if (context.currentStepInstance!=null && context.currentStepInstance.getOutput() !=null) return TemplateProcessor.wrapAsTemplateModel(context.currentStepInstance.getOutput()); Object previousStepOutput = context.getPreviousStepOutput(); if (previousStepOutput!=null) return TemplateProcessor.wrapAsTemplateModel(previousStepOutput); -return ifNoMatches(); +if no output in scope then continue to items below, eg consider variables +// return ifNoMatches(); } Maybe candidate = Maybe.absent(); diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/CustomWorkflowStep.java b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/CustomWorkflowStep.java index 237472eec8..259ec06df9 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/CustomWorkflowStep.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/CustomWorkflowStep.java @@ -462,6 +462,7 @@ public class CustomWorkflowStep extends WorkflowStepDefinition implements Workfl return returnValue; } +/** resolves the variables to be reduced, and returns them; stored by the caller and returned at end if appropriate */ protected Map initializeReducingVariables(WorkflowStepInstanceExecutionContext context, Map reducing) { return context.resolve(WorkflowExpressionResolution.WorkflowExpressionStage.STEP_INPUT, reducing, Map.class); } diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/flow/SubWorkflowStep.java b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/flow/SubWorkflowStep.java index 3ce6c3336b..7d0735e211 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/flow/SubWorkflowStep.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/flow/SubWorkflowStep.java @@ -76,7 +76,15 @@ public class SubWorkflowStep extends CustomWorkflowStep { @Override protected Map initializeReducingVariables(WorkflowStepInstanceExecutionContext context, Map reducing) { context.isLocalSubworkflow = true; -return super.initializeReducingVariables(context, context.getWorkflowExectionContext().getWorkflowScratchVariables()); +MutableMap allVarsInScope = MutableMap.copyOf(context.getWorkflowExectionContext().getWorkflowScratchV
(brooklyn-server) branch master updated: add note and increase timeout for intermittent failure
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new d55ea77c0b add note and increase timeout for intermittent failure d55ea77c0b is described below commit d55ea77c0bc7f06558468af51c301023b8052ef9 Author: Alex Heneveld AuthorDate: Fri May 31 10:13:02 2024 +0100 add note and increase timeout for intermittent failure --- .../brooklyn/core/workflow/WorkflowNestedAndCustomExtensionTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/brooklyn/core/workflow/WorkflowNestedAndCustomExtensionTest.java b/core/src/test/java/org/apache/brooklyn/core/workflow/WorkflowNestedAndCustomExtensionTest.java index 245cdd6143..5b8566c674 100644 --- a/core/src/test/java/org/apache/brooklyn/core/workflow/WorkflowNestedAndCustomExtensionTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/workflow/WorkflowNestedAndCustomExtensionTest.java @@ -571,6 +571,7 @@ public class WorkflowNestedAndCustomExtensionTest extends RebindTestFixture waitABit = (phase) -> Time.sleep((long) (10 * Math.random())); -Duration COMPLETION_TIMEOUT = Duration.seconds(20); +Duration COMPLETION_TIMEOUT = Duration.seconds(30); public void run() throws Exception { // based on WorkflowInputOutputTest.testSetSensorAtomicRequire
(brooklyn-server) branch master updated (799907a655 -> 737adf8b20)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 799907a655 fix patch support with body new 74fb372c46 allow workflow scratch to store an explicit null, if somehow it is set new 737adf8b20 easier checking if config is null, and allow explicit null values in workflow The 2 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. Summary of changes: .../org/apache/brooklyn/api/objs/Configurable.java | 3 ++ .../brooklyn/camp/brooklyn/ObjectsYamlTest.java| 9 +++-- .../config/internal/AbstractConfigMapImpl.java | 14 +++- .../core/internal/BrooklynPropertiesImpl.java | 26 --- .../mgmt/internal/DeferredBrooklynProperties.java | 10 -- .../objs/AbstractConfigurationSupportInternal.java | 6 +++- .../core/objs/BasicConfigurableObject.java | 4 +++ .../brooklyn/core/objs/BrooklynObjectInternal.java | 1 + .../core/workflow/WorkflowExecutionContext.java| 17 +++--- .../workflow/WorkflowExpressionResolution.java | 30 ++--- .../WorkflowStepInstanceExecutionContext.java | 21 +--- .../steps/variables/ClearVariableWorkflowStep.java | 2 +- .../brooklyn/util/core/config/ConfigBag.java | 22 +--- .../brooklyn/util/core/text/TemplateProcessor.java | 39 ++ .../workflow/WorkflowConfigSensorEffectorTest.java | 16 - .../brooklyn/util/core/internal/FlagUtilsTest.java | 12 ++- .../java/org/apache/brooklyn/config/ConfigMap.java | 1 + .../exceptions/PropagatedRuntimeException.java | 12 ++- 18 files changed, 171 insertions(+), 74 deletions(-)
(brooklyn-server) 01/02: allow workflow scratch to store an explicit null, if somehow it is set
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 74fb372c461e21224950e37f949f9297d2b0e998 Author: Alex Heneveld AuthorDate: Thu May 30 11:41:12 2024 +0100 allow workflow scratch to store an explicit null, if somehow it is set freemarker will still refuse to return it, but the internal model is now more consistent (that is what we do eg for sensors, config, etc; rather than using 'null' as an indication to remove something) --- .../core/workflow/WorkflowExecutionContext.java | 17 + .../steps/variables/ClearVariableWorkflowStep.java | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java index f026023198..522a6d1c71 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java @@ -441,10 +441,18 @@ public class WorkflowExecutionContext { return MutableMap.copyOf(workflowScratchVariables).asUnmodifiable(); } +public Object clearWorkflowScratchVariable(String s) { +if (workflowScratchVariables == null) getWorkflowScratchVariables(); +Object old = workflowScratchVariables.remove(s); +if (workflowScratchVariablesUpdatedThisStep==null) workflowScratchVariablesUpdatedThisStep = MutableMap.of(); +workflowScratchVariablesUpdatedThisStep.put(s, Entities.REMOVE); +return old; +} + public Object updateWorkflowScratchVariable(String s, Object v) { -if (workflowScratchVariables ==null) getWorkflowScratchVariables(); +if (workflowScratchVariables == null) getWorkflowScratchVariables(); Object old = workflowScratchVariables.put(s, v); -if (v==null) workflowScratchVariables.remove(s); +if (Entities.REMOVE.equals(v)) workflowScratchVariables.remove(s); if (workflowScratchVariablesUpdatedThisStep==null) workflowScratchVariablesUpdatedThisStep = MutableMap.of(); workflowScratchVariablesUpdatedThisStep.put(s, v); return old; @@ -452,8 +460,9 @@ public class WorkflowExecutionContext { public void updateWorkflowScratchVariables(Map newValues) { if (newValues!=null && !newValues.isEmpty()) { -if (workflowScratchVariables ==null) getWorkflowScratchVariables(); +if (workflowScratchVariables == null) getWorkflowScratchVariables(); workflowScratchVariables.putAll(newValues); +newValues.forEach((k,v)->{ if (Entities.REMOVE.equals(v)) workflowScratchVariables.remove(k); }); if (workflowScratchVariablesUpdatedThisStep==null) workflowScratchVariablesUpdatedThisStep = MutableMap.of(); workflowScratchVariablesUpdatedThisStep.putAll(newValues); } @@ -787,7 +796,7 @@ public class WorkflowExecutionContext { includeUpdates = true; if (last.workflowScratch !=null) { result = MutableMap.copyOf(last.workflowScratch).add(result); -result.entrySet().stream().filter(e -> e.getValue()==null).map(Map.Entry::getKey).forEach(result::remove); +result.entrySet().stream().filter(e -> Entities.REMOVE.equals(e.getValue())).map(Map.Entry::getKey).forEach(result::remove); break; } if (last.previous==null || last.previous.isEmpty()) break; diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/ClearVariableWorkflowStep.java b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/ClearVariableWorkflowStep.java index 3623c472de..ab6cbb958f 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/ClearVariableWorkflowStep.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/ClearVariableWorkflowStep.java @@ -43,7 +43,7 @@ public class ClearVariableWorkflowStep extends WorkflowStepDefinition { if (variable ==null) throw new IllegalArgumentException("Variable name is required"); String name = context.resolve(WorkflowExpressionResolution.WorkflowExpressionStage.STEP_INPUT, variable.name, String.class); if (Strings.isBlank(name)) throw new IllegalArgumentException("Variable name is required"); - context.getWorkflowExectionContext().updateWorkflowScratchVariable(name, null); + context.getWorkflowExectionContext().clearWorkflowScratchVariable(name); return context.getPreviousStepOutput(); }
(brooklyn-server) 02/02: easier checking if config is null, and allow explicit null values in workflow
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit 737adf8b208f64664562e8be8b9e0e7417998762 Author: Alex Heneveld AuthorDate: Thu May 30 14:03:23 2024 +0100 easier checking if config is null, and allow explicit null values in workflow allows values when set, but does not make it easy to set null --- .../org/apache/brooklyn/api/objs/Configurable.java | 3 ++ .../brooklyn/camp/brooklyn/ObjectsYamlTest.java| 9 +++-- .../config/internal/AbstractConfigMapImpl.java | 14 +++- .../core/internal/BrooklynPropertiesImpl.java | 26 --- .../mgmt/internal/DeferredBrooklynProperties.java | 10 -- .../objs/AbstractConfigurationSupportInternal.java | 6 +++- .../core/objs/BasicConfigurableObject.java | 4 +++ .../brooklyn/core/objs/BrooklynObjectInternal.java | 1 + .../workflow/WorkflowExpressionResolution.java | 30 ++--- .../WorkflowStepInstanceExecutionContext.java | 21 +--- .../brooklyn/util/core/config/ConfigBag.java | 22 +--- .../brooklyn/util/core/text/TemplateProcessor.java | 39 ++ .../workflow/WorkflowConfigSensorEffectorTest.java | 16 - .../brooklyn/util/core/internal/FlagUtilsTest.java | 12 ++- .../java/org/apache/brooklyn/config/ConfigMap.java | 1 + .../exceptions/PropagatedRuntimeException.java | 12 ++- 16 files changed, 157 insertions(+), 69 deletions(-) diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java index 2f7fb3c820..eac7cacb88 100644 --- a/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java +++ b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java @@ -27,6 +27,7 @@ import org.apache.brooklyn.config.ConfigMap; import com.google.common.annotations.Beta; import com.google.common.base.Predicate; +import org.apache.brooklyn.util.guava.Maybe; /** * Something that has mutable config, such as an entity or policy. @@ -101,5 +102,7 @@ public interface Configurable { /** see {@link ConfigMap#findKeysPresent(Predicate)} */ public Set> findKeysPresent(Predicate> filter); + +public Maybe getMaybe(ConfigKey ck); } } diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java index 31cf646aba..eeb6327a9c 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java @@ -44,6 +44,7 @@ import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.core.flags.SetFromFlag; import org.apache.brooklyn.util.core.flags.TypeCoercions; +import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.time.Time; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -158,13 +159,11 @@ public class ObjectsYamlTest extends AbstractYamlTest { private class BasicConfigurationSupport implements ConfigurationSupport { private final ConfigBag bag = new ConfigBag(); -@Override -public T get(ConfigKey key) { +@Override public T get(ConfigKey key) { return bag.get(key); } - -@Override -public T get(HasConfigKey key) { +@Override public Maybe getMaybe(ConfigKey ck) { return bag.getMaybe(ck); } +@Override public T get(HasConfigKey key) { return get(key.getConfigKey()); } diff --git a/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java b/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java index f7610e56a3..c2a8e44d26 100644 --- a/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java +++ b/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; import java.util.concurrent.Future; @@ -58,6 +59,7 @@ import org.apache.brooklyn.util.core.internal.ConfigKeySelfExtracting; import org.apache.brooklyn.util.core.task.DeferredSupplier; import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.exceptions.Exceptions; +import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException; import org.apache.brooklyn.util.exceptions.ReferenceWithError;
(brooklyn-ui) branch master updated: fix width of nested task in workflow ui
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/master by this push: new 31dabf39 fix width of nested task in workflow ui 31dabf39 is described below commit 31dabf39ac909c9b2da2caf1d2c133514817df90 Author: Alex Heneveld AuthorDate: Wed May 29 12:15:45 2024 +0100 fix width of nested task in workflow ui --- .../app-inspector/app/components/workflow/workflow-step.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html b/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html index 1dc82319..13d49970 100644 --- a/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html +++ b/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html @@ -196,7 +196,7 @@ - + Error {{ vm.yamlOrPrimitive(stepContext.error) }}
(brooklyn-server) branch master updated: fix patch support with body
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 799907a655 fix patch support with body 799907a655 is described below commit 799907a655b1e4fa8070b6bd521f558b312a6de2 Author: Alex Heneveld AuthorDate: Mon May 27 16:40:40 2024 +0100 fix patch support with body --- utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java b/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java index 8d26faa707..7721f0c4b5 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java @@ -480,6 +480,8 @@ public class HttpTool { ((HttpPost) request).setEntity(this.body); } else if (request instanceof HttpPut) { ((HttpPut) request).setEntity(this.body); +} else if (request instanceof HttpPatch) { +((HttpPatch) request).setEntity(this.body); } else { throw new Exception(this.requestClass.getSimpleName() + " does not support a request body"); }
(brooklyn-server) branch master updated: add patch support to http tool
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 86d519a3a3 add patch support to http tool 86d519a3a3 is described below commit 86d519a3a3a8aca65f9d76638683e41f1778ea10 Author: Alex Heneveld AuthorDate: Mon May 27 11:07:47 2024 +0100 add patch support to http tool --- .../org/apache/brooklyn/util/http/HttpTool.java| 38 +- .../brooklyn/util/http/executor/HttpExecutor.java | 1 + .../executor/apacheclient/HttpExecutorImpl.java| 3 ++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java b/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java index 7a3d5ac022..8d26faa707 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/http/HttpTool.java @@ -18,9 +18,6 @@ */ package org.apache.brooklyn.util.http; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URI; @@ -40,10 +37,12 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; - +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.base.Optional; +import com.google.common.base.Throwables; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multimap; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.crypto.SslTrustUtils; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -65,6 +64,7 @@ import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; +import org.apache.http.client.methods.HttpPatch; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; @@ -87,12 +87,8 @@ import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Optional; -import com.google.common.base.Throwables; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multimap; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; /** * A utility tool for HTTP operations. @@ -530,7 +526,14 @@ public class HttpTool { this.uri(uri); } } - + +public static class HttpPatchBuilder extends HttpRequestBuilder { +public HttpPatchBuilder(URI uri) { +super(HttpPatch.class); +this.uri(uri); +} +} + public static HttpToolResponse httpGet(HttpClient httpClient, URI uri, Map headers) { HttpGet req = new HttpGetBuilder(uri).headers(headers).build(); return execAndConsume(httpClient, req); @@ -555,7 +558,12 @@ public class HttpTool { HttpPut req = new HttpPutBuilder(uri).headers(headers).body(body).build(); return execAndConsume(httpClient, req); } - + +public static HttpToolResponse httpPatch(HttpClient httpClient, URI uri, Multimap headers, byte[] body) { +HttpPatch req = new HttpPatchBuilder(uri).headers(headers).body(body).build(); +return execAndConsume(httpClient, req); +} + public static HttpToolResponse httpPut(HttpClient httpClient, URI uri, Map headers, byte[] body) { HttpPut req = new HttpPutBuilder(uri).headers(headers).body(body).build(); return execAndConsume(httpClient, req); diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpExecutor.java b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpExecutor.java index d070d57c88..d9660e3fa1 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpExecutor.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpExecutor.java @@ -34,6 +34,7 @@ public interface HttpExecutor { static final String POST = "POST"; static final String PUT = "PUT"; +static final String PATCH = "PATCH"; static final String DELETE = "DELETE"; diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/apac
(brooklyn-server) branch master updated: improve DSL parsing
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new e946424c0c improve DSL parsing e946424c0c is described below commit e946424c0cab53c4b120f757f2430f1ad35b8d05 Author: Alex Heneveld AuthorDate: Thu May 23 16:13:59 2024 +0100 improve DSL parsing --- .../brooklyn/spi/dsl/BrooklynDslInterpreter.java | 8 ++ .../camp/brooklyn/spi/dsl/parse/DslParser.java | 108 +++-- .../brooklyn/spi/dsl/parse/PropertyAccess.java | 14 +++ .../camp/brooklyn/WorkflowExpressionsYamlTest.java | 6 ++ .../camp/brooklyn/spi/dsl/DslParseTest.java| 29 +- .../java/org/apache/brooklyn/test/Asserts.java | 12 +++ 6 files changed, 146 insertions(+), 31 deletions(-) diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java index c42b7993e7..7e65aa4bfa 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java @@ -29,6 +29,7 @@ import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter; import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter.PlanInterpreterAdapter; import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode; import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode.Role; +import org.apache.brooklyn.core.resolve.jackson.WrappedValue; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.text.Strings; import org.slf4j.Logger; @@ -159,6 +160,10 @@ public class BrooklynDslInterpreter extends PlanInterpreterAdapter { return ((QuotedString)f).unwrapped(); } +if (f instanceof PropertyAccess) { +return ((PropertyAccess)f).getSelector(); +} + throw new IllegalArgumentException("Unexpected element in parse tree: '"+f+"' (type "+(f!=null ? f.getClass() : null)+")"); } @@ -201,6 +206,9 @@ public class BrooklynDslInterpreter extends PlanInterpreterAdapter { } try { Object index = propAccess.getSelector(); +while (index instanceof PropertyAccess) { +index = ((PropertyAccess)index).getSelector(); +} if (index instanceof QuotedString) { index = ((QuotedString)index).unwrapped(); } diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java index 846a1efad1..db8282393a 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java @@ -50,35 +50,32 @@ public class DslParser { public Object next() { int start = index; -boolean isProperty = (index > 0 && (expression.charAt(index -1) == '[' )) || // for [x] syntax - indexes in lists +boolean isAlreadyInBracket = (index > 0 && (expression.charAt(index -1) == '[' )) || // for [x] syntax - indexes in lists (index > 1 && (expression.charAt(index -1) == '"' && expression.charAt(index -2) == '[')) ; // for ["x"] syntax - string properties and map keys -if (!isProperty) { +if (!isAlreadyInBracket) { +// feel like this block shouldn't be used; not sure it is skipWhitespace(); if (index >= expression.length()) throw new IllegalStateException("Unexpected end of expression to parse, looking for content since position " + start); if (expression.charAt(index) == '"') { // assume a string, that is why for property syntax using [x] or ["x"], we skip this part -int stringStart = index; -index++; -do { -if (index >= expression.length()) -throw new IllegalStateException("Unexpected end of expression to parse, looking for close quote since position " + stringStart); -char c = expression.charAt(index); -if (c == '"') break; -if (c == '\\') index++; -index++; -} while (true); -index++; -return new QuotedString(expression.substring(stringStart, index)); +
(brooklyn-ui) branch master updated (f6d2da52 -> f85bdc31)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git from f6d2da52 minor tidies around workflow display add 75fd9fd2 Calculates href so ctrl click works add f85bdc31 restore old logic (just in case), and treat promises correctly No new revisions were added by this update. Summary of changes: ui-modules/utils/quick-launch/quick-launch.html | 6 +-- ui-modules/utils/quick-launch/quick-launch.js | 70 - 2 files changed, 47 insertions(+), 29 deletions(-)
(brooklyn-ui) branch fix-ctrl-click updated: restore old logic (just in case), and treat promises correctly
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch fix-ctrl-click in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git The following commit(s) were added to refs/heads/fix-ctrl-click by this push: new f85bdc31 restore old logic (just in case), and treat promises correctly f85bdc31 is described below commit f85bdc31930c6af4fe4b6c09d8c90489e4bc5847 Author: Alex Heneveld AuthorDate: Tue May 21 12:35:37 2024 +0100 restore old logic (just in case), and treat promises correctly don't think it was used, nor is it really a promise, but in case there is an edge case we aren't considering... --- ui-modules/utils/quick-launch/quick-launch.js | 46 --- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js index 3db4b0d4..6f8c341f 100644 --- a/ui-modules/utils/quick-launch/quick-launch.js +++ b/ui-modules/utils/quick-launch/quick-launch.js @@ -376,11 +376,6 @@ export function quickLaunchDirective() { $scope.yamlViewDisplayed = false; } -function setComposerLink() { -$scope.composerLink = getComposerHref({ expanded:false , validateYaml: true }); -$scope.composerLinkExpanded = getComposerHref({ expanded:true , validateYaml: true }); -} - function getPlanObject({expanded, validateYaml=true}) { if ($scope.yamlViewDisplayed) { return {format: $scope.editorFormat, yaml: angular.copy($scope.editorYaml)}; @@ -417,6 +412,47 @@ export function quickLaunchDirective() { return result + 'graphical?'+stringifyForQuery(plan); } + +function setComposerLink() { +Promise.resolve(getComposerLinkWithFallback(false)).then(href => { +$scope.composerLink = href; +}); +Promise.resolve(getComposerLinkWithFallback(true)).then(href => { +$scope.composerLinkExpanded = href; +}); +} + +function openComposer($event, expanded) { +$event.preventDefault(); +Promise.resolve(getComposerLinkWithFallback(expanded)).then(href => { +window.location.href = href; +}); +} + +function getComposerLinkWithFallback(expanded) { +if (!brBrandInfo.blueprintComposerBaseUrl) { +console.warn("Composer unavailable in this build"); +return; +} +return Promise.resolve(quickLaunch.getComposerHref({ expanded, validateYaml: true })) +.then(href => { +return href; +}) +.catch((error) => { +console.warn("Will open composer in YAML text editor mode because we cannot generate a model for this configuration:", error); +Promise.resolve(quickLaunch.getComposerHref({ +expanded, yamlEditor: true, validateYaml: false, +yamlPrefix: +"# This plan may have items which require attention so is being opened in YAML text editor mode.\n"+ +"# The YAML was autogenerated by merging the plan with any values provided in UI, but issues were\n"+ +"# detected that mean it might not be correct. Please check the blueprint below carefully.\n"+ +"\n" })) +.then(href => { +return href; +}) +}); +} + function convertPlanToPreferredFormat(plan) { return plan; } function getOriginalPlanFormat(scope) {
(brooklyn-docs) 02/03: Merge pull request #21 from cloudsoft/small
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git commit c59ef86577ddc0f3283a80f1ed038f0fb0a08fb7 Merge: 9fde234b 8d69fd8a Author: Iuliana Cosmina AuthorDate: Mon Apr 8 12:01:08 2024 +0100 Merge pull request #21 from cloudsoft/small small change trying to fix doc generation guide/blueprints/workflow/common.md | 41 ++--- 1 file changed, 20 insertions(+), 21 deletions(-)
(brooklyn-docs) branch master updated (81f61f8a -> 07690a80)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git from 81f61f8a update liquid plugin code ('dig' no longer used it seems) new 8d69fd8a small change trying to fix doc generation new c59ef865 Merge pull request #21 from cloudsoft/small new 07690a80 Merge remote-tracking branch 'origin/master' The 3 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. Summary of changes: guide/blueprints/workflow/common.md | 40 +++-- 1 file changed, 21 insertions(+), 19 deletions(-)
(brooklyn-docs) 01/03: small change trying to fix doc generation
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git commit 8d69fd8a4e4685e63e1fe72add115868bcadba09 Author: iuliana AuthorDate: Mon Apr 8 11:51:40 2024 +0100 small change trying to fix doc generation --- guide/blueprints/workflow/common.md | 41 ++--- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/guide/blueprints/workflow/common.md b/guide/blueprints/workflow/common.md index 910a5324..6add6357 100644 --- a/guide/blueprints/workflow/common.md +++ b/guide/blueprints/workflow/common.md @@ -21,7 +21,7 @@ defined by that step type. Internally, steps are maps with multiple inputs and properties, and the shorthand syntax makes it possible to set the most common ones. -For `ssh` this is the command to run; for `container` an image; for `http` a URL; and for `set-xxx` +For `ssh` this is the command to run; for `container` an image; for `http` a URL; and for `set-xxx` an expression of the form `key=value`. It is always possible to write the longhand map syntax, and if using inputs or properties @@ -50,14 +50,17 @@ steps: not: { equals: true } ``` -Care should be taken when using `:` in a step with shorthand. YAML will parse it as a map if it is not quoted in YAML. However at runtime, if the step looks like it came from an accidental colon causing a map, it will be reverted to a string with the colon re-introduced, so you can write steps with shorthand `- log Your name is: ${name}`. +Care should be taken when using `:` in a step with shorthand. YAML will parse it as a map if it is not quoted in YAML. +However at runtime, if the step looks like it came from an accidental colon causing a map, it will be reverted to a +string with the colon re-introduced, so you can write steps with shorthand `- log Your name is: ${name}`. All steps support a number of common properties, described below. ### Explicit IDs and Name Steps can define an explicit ID for use with `next`, for correlation in the UI, -and to be able to reference the output or input from a specific step using the [workflow expression syntax](variables.md). +and to be able to reference the output or input from a specific step using +the [workflow expression syntax](variables.md). They can also include a `name` used in the UI. ``` @@ -77,24 +80,22 @@ steps: step: log skipping ssh date command ``` - ### Conditions The previous example shows the use of conditions, as mentioned as one of the properties common to all steps. -This makes use of the recent "[Predicate DSL](../yaml-reference.md#predicate-dsl)" conditions framework . +This makes use of the recent [Predicate DSL](../yaml-reference.md#predicate-dsl) conditions framework. It is normally necessary to supply a `target`, unless one of the entity-specific target keys (e.g. `sensor` or `config`) -is used. The target and arguments here can use the [workflow expression syntax](variables.md). +is used. The target and arguments here can use the [workflow expression syntax](variables.md). -The condition is evaluated when the step is about to run, and if the condition is not satisfied, +The condition is evaluated when the step is about to run, and if the condition is not satisfied, the workflow moves to the following step in the sequence, or ends if that was the last step. Apart from `name` and `id` above, if a step's `condition` is unmet, the other properties set on a step are ignored. - ### Jumping with "Next" or "Goto" -The common property `next` allows overriding the workflow sequencing, +The common property `next` allows overriding the workflow sequencing, indicating that a different step should be gone to next. This does not apply if a step's condition is not satisfied, as noted at the end of the previous section. @@ -102,7 +103,8 @@ The value of the `next` property should be the ID of the step to go to or one of the following reserved words: * `start`: return to the start of the workflow -* `end`: exit the workflow (or if in a block where this doesn't make sense, such as `retry`, go to the last executed step) +* `end`: exit the workflow (or if in a block where this doesn't make sense, such as `retry`, go to the last executed + step) * `exit`: if in an error handler, exit that error handler The `goto` step type is equivalent to the `no-op` step with `next` set, @@ -112,13 +114,12 @@ for declarative workflow it is fairly common, because it can simplify what might otherwise involve multiple nested workflows. That said, the confusion that `goto` can cause should be kept in mind, and its availability not abused: in particular where a task can be better done -in a proper high-level programming language, consider putting that program +in a proper high-level programming language, consider putting
(brooklyn-docs) 03/03: Merge remote-tracking branch 'origin/master'
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git commit 07690a8014ef34fcb4cfee88e5524b4585779b2a Merge: 81f61f8a c59ef865 Author: Alex Heneveld AuthorDate: Mon May 20 14:38:02 2024 +0100 Merge remote-tracking branch 'origin/master' guide/blueprints/workflow/common.md | 40 +++-- 1 file changed, 21 insertions(+), 19 deletions(-) diff --cc guide/blueprints/workflow/common.md index a2ad6e05,6add6357..66426f1e --- a/guide/blueprints/workflow/common.md +++ b/guide/blueprints/workflow/common.md @@@ -91,12 -93,9 +93,12 @@@ the workflow moves to the following ste Apart from `name` and `id` above, if a step's `condition` is unmet, the other properties set on a step are ignored. +The `if` step can be used for simple conditions, as shown in the next section. + + ### Jumping with "Next" or "Goto" - The common property `next` allows overriding the workflow sequencing, + The common property `next` allows overriding the workflow sequencing, indicating that a different step should be gone to next. This does not apply if a step's condition is not satisfied, as noted at the end of the previous section. @@@ -114,26 -114,12 +117,27 @@@ for declarative workflow it is fairly c might otherwise involve multiple nested workflows. That said, the confusion that `goto` can cause should be kept in mind, and its availability not abused: in particular where a task can be better done - in a proper high-level programming language, consider putting that program + in a proper high-level programming language, consider putting that program into a container and calling it from your workflow. +Thus the above workflow can be written more concisely as: + +``` +steps: +- if ${scratch.skip_date} then goto skipping-ssh-date + +- step: ssh echo today is `date` + next: end + +- id: skipping-ssh-date + name: Not doing SSH + step: log skipping ssh date command +``` + ++ ### Input and Output - Most steps take input parameters and return output. + Most steps take input parameters and return output. Many step-specific input parameters can be set in the shorthand, but not all. All input parameters can be specified in an `input` block. It is also possible to customize the output from a step using an `output` block.
(brooklyn-docs) branch master updated: update liquid plugin code ('dig' no longer used it seems)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git The following commit(s) were added to refs/heads/master by this push: new 81f61f8a update liquid plugin code ('dig' no longer used it seems) 81f61f8a is described below commit 81f61f8a3ed45222c72a89e1279d1e18ae0566b2 Author: Alex Heneveld AuthorDate: Mon May 20 13:39:41 2024 +0100 update liquid plugin code ('dig' no longer used it seems) --- _plugins/read.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_plugins/read.rb b/_plugins/read.rb index df0a26a1..c0faf574 100644 --- a/_plugins/read.rb +++ b/_plugins/read.rb @@ -45,7 +45,7 @@ module JekyllRead # is there a better way to trim a leading / ? file = file.relative_path_from(Pathname.new("/")) unless file.relative? - raise "No such file #{file} in read call (from #{context.dig('page','path')})" unless file.exist? + raise "No such file #{file} in read call (from #{context_page['path']})" unless file.exist? file end
(brooklyn-server) branch master updated: optimize absent stack trace origin, and improve version serialization for jackson
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new e4599a0ab9 optimize absent stack trace origin, and improve version serialization for jackson e4599a0ab9 is described below commit e4599a0ab908eb7a27a46f661b4d0b98f7dc2b01 Author: Alex Heneveld AuthorDate: Mon May 13 17:34:38 2024 +0100 optimize absent stack trace origin, and improve version serialization for jackson --- .../org/apache/brooklyn/util/collections/ThreadLocalStack.java | 2 +- .../main/java/org/apache/brooklyn/util/osgi/VersionedName.java | 9 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/collections/ThreadLocalStack.java b/utils/common/src/main/java/org/apache/brooklyn/util/collections/ThreadLocalStack.java index 4170dbcf8d..4355269246 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/collections/ThreadLocalStack.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/collections/ThreadLocalStack.java @@ -93,7 +93,7 @@ public class ThreadLocalStack implements Iterable { public Maybe peek() { Iterator si = stream().iterator(); -if (!si.hasNext()) return Maybe.absent("Nothing in local stack"); +if (!si.hasNext()) return Maybe.absent(() -> new IllegalStateException("Nothing in local stack")); return Maybe.of( si.next() ); } diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java b/utils/common/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java index 3c8bda55f8..db96fceedf 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java @@ -21,6 +21,7 @@ import java.util.Comparator; import javax.annotation.Nullable; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import org.apache.brooklyn.util.guava.Maybe; @@ -46,7 +47,7 @@ public class VersionedName implements Comparable { @Deprecated // since 0.12.0 - but null was not omitted in jackson serialization, so remove these fields after 1.2 private final Version version = null; - +private VersionedName() { name=null; v=null; } /* jackson, will sneakily set it as needed even though final */ public VersionedName(Bundle b) { this(b.getSymbolicName(), b.getVersion().toString()); } @@ -85,6 +86,7 @@ public class VersionedName implements Comparable { } private transient Version cachedOsgiVersion; +@JsonIgnore @Nullable public Version getOsgiVersion() { if (cachedOsgiVersion==null && v!=null) { @@ -93,6 +95,7 @@ public class VersionedName implements Comparable { return cachedOsgiVersion; } +@JsonIgnore @Nullable public String getOsgiVersionString() { Version ov = getOsgiVersion(); @@ -100,11 +103,13 @@ public class VersionedName implements Comparable { return ov.toString(); } +@JsonIgnore @Nullable public String getVersionString() { return v; } - + +@JsonIgnore @Deprecated /** @deprecated since 0.12.0 use {@link #getVersionString()} or {@link #getOsgiVersion()} */ public Version getVersion() { return getOsgiVersion();
(brooklyn-server) branch master updated (3bfae5b2fa -> a5830edd79)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git from 3bfae5b2fa allow workflow policy and callable to be subclassed new f05fe050fb better ordering of type coercions, run "wrong bean" coercions after standard coercions new c8e7bbbedd apply type deserialization even into maps and lists by default new a5830edd79 better resolution of workflow inputs The 3 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. Summary of changes: .../org/apache/brooklyn/api/objs/Configurable.java | 4 - .../brooklyn/camp/brooklyn/ObjectsYamlTest.java| 5 - .../brooklyn/camp/brooklyn/WorkflowYamlTest.java | 28 + .../brooklyn/spi/dsl/DslSerializationTest.java | 6 +- .../apache/brooklyn/core/config/ConfigUtils.java | 10 +- .../config/internal/AbstractConfigMapImpl.java | 25 ++--- .../core/internal/BrooklynPropertiesImpl.java | 5 - .../mgmt/internal/DeferredBrooklynProperties.java | 5 - .../objs/AbstractConfigurationSupportInternal.java | 7 +- .../core/objs/BasicConfigurableObject.java | 12 +- .../brooklyn/core/objs/BrooklynObjectInternal.java | 6 +- .../resolve/jackson/AsPropertyIfAmbiguous.java | 8 +- .../core/resolve/jackson/BeanWithTypeUtils.java| 25 - .../jackson/BrooklynJacksonSerializationUtils.java | 63 +++ .../resolve/jackson/CommonTypesSerialization.java | 4 +- .../jackson/JsonSymbolDependentDeserializer.java | 12 +- .../jackson/ObjectReferencingSerialization.java| 2 +- .../workflow/WorkflowExpressionResolution.java | 49 +++- .../brooklyn/core/workflow/WorkflowPolicy.java | 2 +- .../brooklyn/core/workflow/WorkflowSensor.java | 14 +++ .../brooklyn/util/core/flags/TypeCoercions.java| 6 +- .../util/core/predicates/DslPredicates.java| 66 ++- .../resolve/jackson/PerverseSerializationTest.java | 14 ++- .../workflow/WorkflowInputOutputExtensionTest.java | 34 +- .../brooklyn/util/core/internal/FlagUtilsTest.java | 5 - .../java/org/apache/brooklyn/config/ConfigMap.java | 10 -- .../coerce/CommonAdaptorTypeCoercions.java | 4 +- .../javalang/coerce/TypeCoercerExtensible.java | 124 - .../javalang/coerce/TypeCoercerExtensibleTest.java | 33 ++ 29 files changed, 410 insertions(+), 178 deletions(-)
(brooklyn-server) 01/03: better ordering of type coercions, run "wrong bean" coercions after standard coercions
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit f05fe050fbce8404222896481163807abcbe7f15 Author: Alex Heneveld AuthorDate: Fri May 10 14:04:01 2024 +0100 better ordering of type coercions, run "wrong bean" coercions after standard coercions negative indexed coercions run after the standard coercions, and the natural order comparator is used so that 11 runs after 9 --- .../brooklyn/util/core/flags/TypeCoercions.java| 2 +- .../coerce/CommonAdaptorTypeCoercions.java | 4 +- .../javalang/coerce/TypeCoercerExtensible.java | 124 - .../javalang/coerce/TypeCoercerExtensibleTest.java | 33 ++ 4 files changed, 109 insertions(+), 54 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/util/core/flags/TypeCoercions.java b/core/src/main/java/org/apache/brooklyn/util/core/flags/TypeCoercions.java index 3840c0b838..35b1752690 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/flags/TypeCoercions.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/flags/TypeCoercions.java @@ -381,7 +381,7 @@ public class TypeCoercions { } }); -registerAdapter("81-wrong-bean-to-map-or-bean", new TryCoercer() { +registerAdapter("-20-wrong-bean-to-map-or-bean", new TryCoercer() { @Override public Maybe tryCoerce(Object input, TypeToken type) { diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/CommonAdaptorTypeCoercions.java b/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/CommonAdaptorTypeCoercions.java index 20c8649b40..a792c70880 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/CommonAdaptorTypeCoercions.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/CommonAdaptorTypeCoercions.java @@ -88,7 +88,9 @@ public class CommonAdaptorTypeCoercions { public synchronized Function registerAdapter(Class sourceType, Class targetType, Function fn) { return coercer.registerAdapter(sourceType, targetType, fn); } -/** Registers an adapter for use with type coercion. */ +/** Registers an adapter for use with type coercion. nameAndOrder is of the form NUM-NAME with the natural order prevailing (ordered by NUM numerically), + * eg 1-x before 2-x before 9-x before 11-x; + * negative indexed orders are processed after, with -1-x before -2-x before -11-x */ public synchronized void registerAdapter(String nameAndOrder, TryCoercer coerceFn) { coercer.registerAdapter(nameAndOrder, coerceFn); } diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/TypeCoercerExtensible.java b/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/TypeCoercerExtensible.java index c235d537ab..fe5ec0ca49 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/TypeCoercerExtensible.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/TypeCoercerExtensible.java @@ -20,10 +20,26 @@ package org.apache.brooklyn.util.javalang.coerce; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.*; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; import java.util.stream.Collectors; -import com.google.common.collect.*; +import com.google.common.annotations.Beta; +import com.google.common.base.Function; +import com.google.common.base.Objects; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.common.collect.Table; +import com.google.common.reflect.TypeToken; import org.apache.brooklyn.core.validation.BrooklynValidation; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -32,17 +48,13 @@ import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.guava.TypeTokens; import org.apache.brooklyn.util.javalang.Boxing; import org.apache.brooklyn.util.javalang.Reflections; +import org.apache.brooklyn.util.text.NaturalOrderComparator; import org.apache.brooklyn.util.text.Strings; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.annotations.Beta; -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.reflect.TypeToken; - /** * A
(brooklyn-server) 02/03: apply type deserialization even into maps and lists by default
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit c8e7bbbedd729932c137b8fe755bdb96acf16849 Author: Alex Heneveld AuthorDate: Fri May 10 15:09:02 2024 +0100 apply type deserialization even into maps and lists by default --- .../brooklyn/spi/dsl/DslSerializationTest.java | 6 ++- .../core/resolve/jackson/BeanWithTypeUtils.java| 12 - .../jackson/BrooklynJacksonSerializationUtils.java | 63 ++ .../jackson/ObjectReferencingSerialization.java| 2 +- .../resolve/jackson/PerverseSerializationTest.java | 14 +++-- 5 files changed, 89 insertions(+), 8 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslSerializationTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslSerializationTest.java index f331bc588e..a71b79ccad 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslSerializationTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslSerializationTest.java @@ -29,9 +29,12 @@ import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon; import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent; +import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent.DslConfigSupplier; import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent.Scope; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.resolve.jackson.*; +import org.apache.brooklyn.core.resolve.jackson.BrooklynJacksonSerializationUtils.ConfigurableBeanDeserializerModifier; +import org.apache.brooklyn.core.resolve.jackson.BrooklynRegisteredTypeJacksonSerializationTest.SampleBean; import org.apache.brooklyn.core.resolve.jackson.WrappedValuesSerializationTest.ObjectWithWrappedValueString; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.workflow.WorkflowBasicTest; @@ -77,7 +80,8 @@ public class DslSerializationTest extends AbstractYamlTest implements MapperTest Object stuff2 = mapper.readValue(out, Object.class); Object stuff2I = ((Map) stuff2).get("stuff"); -Asserts.assertInstanceOf(stuff2I, Map.class); +Class expectedDeserializedTypedMapNested = ConfigurableBeanDeserializerModifier.DEFAULT_APPLY_ONLY_TO_BEAN_DESERIALIZERS ? Map.class : DslConfigSupplier.class; +Asserts.assertInstanceOf(stuff2I, expectedDeserializedTypedMapNested); } private ObjectMapper newMapper() { diff --git a/core/src/main/java/org/apache/brooklyn/core/resolve/jackson/BeanWithTypeUtils.java b/core/src/main/java/org/apache/brooklyn/core/resolve/jackson/BeanWithTypeUtils.java index 2c85657c93..5df6c020f9 100644 --- a/core/src/main/java/org/apache/brooklyn/core/resolve/jackson/BeanWithTypeUtils.java +++ b/core/src/main/java/org/apache/brooklyn/core/resolve/jackson/BeanWithTypeUtils.java @@ -164,6 +164,7 @@ public class BeanWithTypeUtils { // so the former calls the latter, and the latter calls the former. but stop at some point! if (stack.contains(mapOrListToSerializeThenDeserialize)) throw new IllegalStateException("Aborting recursive attempt to convert '"+mapOrListToSerializeThenDeserialize+"'"); +T wrongTypeResult = null; try { stack.push(mapOrListToSerializeThenDeserialize); @@ -184,14 +185,21 @@ public class BeanWithTypeUtils { //return result2; //} -return result; +if (result!=null && !type.getRawType().isInstance(result)) { +wrongTypeResult = result; +throw new IllegalStateException("Wrong type returned"); // will be ignored below +} else { +return result; +} } catch (Exception e) { try { // needed for a few things, mainly where a bean has a type field that conflicts with the type here, -// tryCoercer 81-wrong-bean uses this +// tryCoercer -20-wrong-bean uses this return convertDeeply(mgmt, mapOrListToSerializeThenDeserialize, type, allowRegisteredTypes, loader, allowJavaTypes); } catch (Exception e2) { +Exceptions.propagateIfFatal(e2); +if (wrongTypeResult!=null) return wrongTypeResult; throw Exceptions.propagate(Arrays.asList(e, e2)); } } finally { diff --git a/core/src/main/java/org/apache/brooklyn/core/resolve/jackson/BrooklynJacksonSerializationUtils.java b/core/src/ma
(brooklyn-server) 03/03: better resolution of workflow inputs
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git commit a5830edd791b232e5b7987cdbcad8d4664c570f0 Author: Alex Heneveld AuthorDate: Fri May 10 19:20:26 2024 +0100 better resolution of workflow inputs - prevent confusion with subkeys having dot qualifiers and being omitted when used in sensor/policy definition - don't coerce a supplier to a map - allow unknown types under type key in maps, since we now use our deserializers for it - allow access to selected workflow.util vars even outwith workflow - return entity predicate where required, and better coercion from boolean to conditions - remove deprecated findKeys method - better error messages - more tests --- .../org/apache/brooklyn/api/objs/Configurable.java | 4 -- .../brooklyn/camp/brooklyn/ObjectsYamlTest.java| 5 -- .../brooklyn/camp/brooklyn/WorkflowYamlTest.java | 28 + .../apache/brooklyn/core/config/ConfigUtils.java | 10 +--- .../config/internal/AbstractConfigMapImpl.java | 25 .../core/internal/BrooklynPropertiesImpl.java | 5 -- .../mgmt/internal/DeferredBrooklynProperties.java | 5 -- .../objs/AbstractConfigurationSupportInternal.java | 7 +-- .../core/objs/BasicConfigurableObject.java | 12 +--- .../brooklyn/core/objs/BrooklynObjectInternal.java | 6 +- .../resolve/jackson/AsPropertyIfAmbiguous.java | 8 +-- .../core/resolve/jackson/BeanWithTypeUtils.java| 13 - .../resolve/jackson/CommonTypesSerialization.java | 4 +- .../jackson/JsonSymbolDependentDeserializer.java | 12 +++- .../workflow/WorkflowExpressionResolution.java | 49 ++-- .../brooklyn/core/workflow/WorkflowPolicy.java | 2 +- .../brooklyn/core/workflow/WorkflowSensor.java | 14 + .../brooklyn/util/core/flags/TypeCoercions.java| 4 ++ .../util/core/predicates/DslPredicates.java| 66 +- .../workflow/WorkflowInputOutputExtensionTest.java | 34 +-- .../brooklyn/util/core/internal/FlagUtilsTest.java | 5 -- .../java/org/apache/brooklyn/config/ConfigMap.java | 10 22 files changed, 212 insertions(+), 116 deletions(-) diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java index 5187d00fe9..2f7fb3c820 100644 --- a/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java +++ b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java @@ -96,10 +96,6 @@ public interface Configurable { */ T set(HasConfigKey key, Task val); -/** @deprecated since 0.11.0 see {@link ConfigMap#findKeys(Predicate)} */ -@Deprecated -Set> findKeys(Predicate> filter); - /** see {@link ConfigMap#findKeysDeclared(Predicate)} */ public Set> findKeysDeclared(Predicate> filter); diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java index 32749897db..31cf646aba 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java @@ -194,11 +194,6 @@ public class ObjectsYamlTest extends AbstractYamlTest { return set(key.getConfigKey(), val); } -@Override @Deprecated -public Set> findKeys(Predicate> filter) { - return findKeysDeclared(filter); -} - @Override public Set> findKeysDeclared(Predicate> filter) { return MutableSet.copyOf(Iterables.filter(bag.getAllConfigAsConfigKeyMap().keySet(), filter)); diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java index f5d93fb499..02f9517fd7 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java @@ -88,6 +88,7 @@ import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; +import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.text.Strings; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; @@ -425,6 +426,33 @@ public class WorkflowYamlTest extends AbstractYamlTest { if (extraChecks!=null) extraChecks.accept(policy); } +
(brooklyn-server) branch master updated: allow workflow policy and callable to be subclassed
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 3bfae5b2fa allow workflow policy and callable to be subclassed 3bfae5b2fa is described below commit 3bfae5b2fa8d7d25e79703271ecc49bb9b5529df Author: Alex Heneveld AuthorDate: Wed May 8 10:46:35 2024 +0100 allow workflow policy and callable to be subclassed --- .../main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java index 1d2c9db914..58e445e296 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java @@ -146,12 +146,16 @@ public class WorkflowPolicy extends AbstractPolicy implements WorkflowCommonC .condition(new ConditionSupplierFromAdjunct()); Set pollConfigs = MutableSet.of(pc); -pollCallable = new WorkflowPollCallable(WorkflowContextType.POLICY, getDisplayName() + " (policy)", config().getBag(), this); +pollCallable = newWorkflowPollCallable(); poller.schedulePoll(this, pollConfigs, pollCallable, new PolicyNoOpPollHandler()); if (!isSuspended()) resume(); } +protected WorkflowPollCallable newWorkflowPollCallable() { +return new WorkflowPollCallable(WorkflowContextType.POLICY, getDisplayName() + " (policy)", config().getBag(), this); +} + @Override public void suspend() { super.suspend();
(brooklyn-server) branch master updated: fix async delay for initializer, and intermittent failing test
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 0f56dd8704 fix async delay for initializer, and intermittent failing test 0f56dd8704 is described below commit 0f56dd870491d81370f35ae873f3698c72cc3955 Author: Alex Heneveld AuthorDate: Fri May 3 13:56:22 2024 +0100 fix async delay for initializer, and intermittent failing test --- .../java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java | 4 +--- .../org/apache/brooklyn/core/workflow/WorkflowInitializer.java | 7 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java index f69138a4f8..f5d93fb499 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java @@ -1000,9 +1000,6 @@ public class WorkflowYamlTest extends AbstractYamlTest { } @Test -// non-deterministic failure seen once: -// testInitializerDelay:1031 failed succeeds-eventually, 75 attempts, 3ms elapsed: -// AssertionError: entity=BasicEntityImpl{id=v65dmc7x81}; attribute=Sensor: x (java.lang.Integer) expected [6] but found [3] public void testInitializerDelay() throws Exception { Entity app = createAndStartApplication( "services:", @@ -1020,6 +1017,7 @@ public class WorkflowYamlTest extends AbstractYamlTest { "brooklyn.config:", " name: pre-init", " steps:", +//"- sleep 1s", // to check that 'async' really does always wait "- set-sensor integer x = 3"); waitForApplicationTasks(app); Entity entity = Iterables.getOnlyElement(app.getChildren()); diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowInitializer.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowInitializer.java index 5c1c82b0b0..0e80227a9b 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowInitializer.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowInitializer.java @@ -35,6 +35,7 @@ import org.apache.brooklyn.util.core.task.DynamicTasks; import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.repeat.Repeater; import org.apache.brooklyn.util.text.Strings; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; @@ -101,6 +102,12 @@ public class WorkflowInitializer extends EntityInitializers.InitializerPatternWi if (delayed) { DynamicTasks.queue(Tasks.create("Delaying until " + delaySummary, () -> { ((EntityInternal) entity).getManagementContext().waitForManagementStartupComplete(null); +while (!Entities.isManagedActive(entity)) { +if (!Entities.isManagedActiveOrComingUp(entity)) { +return; +} +Time.sleep(Repeater.DEFAULT_REAL_QUICK_PERIOD); +} if (delayDuration.isPositive()) Time.sleep(delayDuration); })); }
(brooklyn-server) branch master updated: allow tests to update the external config registry from properties
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new edca9fb889 allow tests to update the external config registry from properties edca9fb889 is described below commit edca9fb8893bc01b94bce600ca2bbe4880468e8a Author: Alex Heneveld AuthorDate: Wed May 1 16:29:35 2024 +0100 allow tests to update the external config registry from properties --- .../core/mgmt/internal/BasicExternalConfigSupplierRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java index a667ce5926..b55081336e 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java @@ -93,7 +93,7 @@ public class BasicExternalConfigSupplierRegistry implements ExternalConfigSuppli } @SuppressWarnings("unchecked") -private void updateFromBrooklynProperties(ManagementContext mgmt) { +public void updateFromBrooklynProperties(ManagementContext mgmt) { // form is: // brooklyn.external. : fully.qualified.ClassName // brooklyn.external.. :
(brooklyn-server) branch master updated: expose ability for workflow policy to be invoked
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new b9febc09db expose ability for workflow policy to be invoked b9febc09db is described below commit b9febc09dbcec2f4bad2824616a6ab910a7e20ed Author: Alex Heneveld AuthorDate: Mon Apr 29 12:51:34 2024 +0100 expose ability for workflow policy to be invoked --- .../org/apache/brooklyn/core/workflow/WorkflowPolicy.java | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java index 2baefe05e1..1d2c9db914 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowPolicy.java @@ -29,6 +29,8 @@ import org.apache.brooklyn.core.feed.PollHandler; import org.apache.brooklyn.core.feed.Poller; import org.apache.brooklyn.core.policy.AbstractPolicy; import org.apache.brooklyn.core.sensor.AbstractAddTriggerableSensor; +import org.apache.brooklyn.core.workflow.WorkflowExecutionContext.WorkflowContextType; +import org.apache.brooklyn.core.workflow.WorkflowSensor.WorkflowPollCallable; import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.core.predicates.DslPredicates; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -62,6 +64,7 @@ public class WorkflowPolicy extends AbstractPolicy implements WorkflowCommonC public static final ConfigKey UNIQUE_TAG_DASH = WorkflowSensor.UNIQUE_TAG_DASH; protected transient Poller poller; +protected transient WorkflowPollCallable pollCallable; // ? - do we need to have an option not to run when added? @@ -143,8 +146,8 @@ public class WorkflowPolicy extends AbstractPolicy implements WorkflowCommonC .condition(new ConditionSupplierFromAdjunct()); Set pollConfigs = MutableSet.of(pc); -poller.schedulePoll(this, pollConfigs, new WorkflowSensor.WorkflowPollCallable(WorkflowExecutionContext.WorkflowContextType.POLICY, -getDisplayName() + " (policy)", config().getBag(), this), new PolicyNoOpPollHandler()); +pollCallable = new WorkflowPollCallable(WorkflowContextType.POLICY, getDisplayName() + " (policy)", config().getBag(), this); +poller.schedulePoll(this, pollConfigs, pollCallable, new PolicyNoOpPollHandler()); if (!isSuspended()) resume(); } @@ -163,5 +166,13 @@ public class WorkflowPolicy extends AbstractPolicy implements WorkflowCommonC if (needsStarting) poller.start(); } +// we could add an API for this, so arbitrary policies can be re-run from the UI +public Object runOnceNow() { +try { +return pollCallable.call(); +} catch (Exception e) { +throw Exceptions.propagate(e); +} +} }
(brooklyn-server) branch master updated: tidy utility methods, support floor/ceil
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 3deb69f856 tidy utility methods, support floor/ceil 3deb69f856 is described below commit 3deb69f856696c17f7df97d7a47118e1b31ba3e3 Author: Alex Heneveld AuthorDate: Fri Apr 19 16:57:47 2024 +0100 tidy utility methods, support floor/ceil --- .../src/main/java/org/apache/brooklyn/util/math/NumberMath.java | 4 .../common/src/main/java/org/apache/brooklyn/util/text/Strings.java | 5 - utils/common/src/main/java/org/apache/brooklyn/util/time/Time.java | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/math/NumberMath.java b/utils/common/src/main/java/org/apache/brooklyn/util/math/NumberMath.java index eb2b2f2d97..374885bcdd 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/math/NumberMath.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/math/NumberMath.java @@ -165,6 +165,10 @@ public class NumberMath { } public T abs() { return attemptUnary(x -> x<0 ? -x : x, x -> x<0 ? -x : x, BigInteger::abs, BigDecimal::abs); } +public T round() { return attemptUnary(x -> x, d -> (double) Math.round(d), x -> x, x -> x.setScale(0, BigDecimal.ROUND_DOWN)); } +public T ceil() { return attemptUnary(x -> x, d -> Math.ceil(d), x -> x, x -> x.setScale(0, BigDecimal.ROUND_CEILING)); } +public T floor() { return attemptUnary(x -> x, d -> Math.floor(d), x -> x, x -> x.setScale(0, BigDecimal.ROUND_FLOOR)); } +public T frac() { return attemptUnary(x -> 0L, d -> d - Math.floor(d), x -> BigInteger.ZERO, x -> x.subtract(x.setScale(0, BigDecimal.ROUND_FLOOR))); } public T negate() { return attemptUnary(x -> -x, x -> -x, BigInteger::negate, BigDecimal::negate); } public T add(T rhs) { return attemptBinary(rhs, (x,y) -> x+y, (x,y) -> x+y, BigInteger::add, BigDecimal::add); } diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/text/Strings.java b/utils/common/src/main/java/org/apache/brooklyn/util/text/Strings.java index d3af722ac4..f48f1f4302 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/text/Strings.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/text/Strings.java @@ -1057,8 +1057,11 @@ public class Strings { /** prefixes every line in `body` (second argument) by the given string (first argument) */ public static String prefixAddedToEachLine(String prefix, String body) { +return prefixAddedToEachLine(prefix, body, false); +} +public static String prefixAddedToEachLine(String prefix, String body, boolean includeTrailingEmptyLines) { if (body==null) return null; -return Arrays.stream(body.split("\n")).map(s -> prefix + s).collect(Collectors.joining("\n")); +return Arrays.stream(body.split("\n", includeTrailingEmptyLines ? -1 : 0)).map(s -> prefix + s).collect(Collectors.joining("\n")); } public static boolean containsLiteralAsWord(String context, String word) { diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/time/Time.java b/utils/common/src/main/java/org/apache/brooklyn/util/time/Time.java index fd1083e5f5..7b996bdac1 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/time/Time.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/time/Time.java @@ -75,7 +75,7 @@ public class Time { return makeDateString(System.currentTimeMillis()); } -/** as {@link #makeDateString(Date)} for long millis since UTC epock */ +/** as {@link #makeDateString(Date)} for long millis since UTC epoch */ public static String makeDateString(long date) { return makeDateString(new Date(date), DATE_FORMAT_PREFERRED); }
(brooklyn-server) branch master updated: reconstruct search path when set without catalog item id
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 95d3ec329c reconstruct search path when set without catalog item id 95d3ec329c is described below commit 95d3ec329c03abd8f5812256fa00286f149d1989 Author: Alex Heneveld AuthorDate: Fri Apr 12 20:10:10 2024 +0100 reconstruct search path when set without catalog item id --- .../apache/brooklyn/core/mgmt/rebind/RebindIteration.java | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java index a7c06cd2e4..75bab6133b 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java @@ -927,15 +927,14 @@ public abstract class RebindIteration { protected CatalogItemIdAndSearchPath findCatalogItemIds(ClassLoader cl, Map entityIdToManifest, EntityMementoManifest entityManifest) { +List searchPath = MutableList.copyOf(entityManifest.getCatalogItemIdSearchPath()); if (entityManifest.getCatalogItemId() != null) { -return new CatalogItemIdAndSearchPath(entityManifest.getCatalogItemId(), -entityManifest.getCatalogItemIdSearchPath()); +return new CatalogItemIdAndSearchPath(entityManifest.getCatalogItemId(), searchPath); } if (BrooklynFeatureEnablement.isEnabled(FEATURE_BACKWARDS_COMPATIBILITY_INFER_CATALOG_ITEM_ON_REBIND)) { String typeId = null; -List searchPath = MutableList.of(); //First check if any of the parent entities has a catalogItemId set. EntityMementoManifest ptr = entityManifest; while (ptr != null) { @@ -975,7 +974,7 @@ public abstract class RebindIteration { RegisteredType t = types.get(ptr.getType(), BrooklynCatalog.DEFAULT_VERSION); if (t != null) { LOG.debug("Inferred catalog item ID " + t.getId() + " for " + entityManifest + " from ancestor " + ptr); -return new CatalogItemIdAndSearchPath(t.getId(), ImmutableList.of()); +return new CatalogItemIdAndSearchPath(t.getId(), entityManifest.getCatalogItemIdSearchPath()); } if (ptr.getParent() != null) { ptr = entityIdToManifest.get(ptr.getParent()); @@ -987,7 +986,7 @@ public abstract class RebindIteration { //As a last resort go through all catalog items trying to load the type and use the first that succeeds. //But first check if can be loaded from the default classpath if (JavaBrooklynClassLoadingContext.create(managementContext).tryLoadClass(entityManifest.getType()).isPresent()) { -return new CatalogItemIdAndSearchPath(null, ImmutableList.of()); +return new CatalogItemIdAndSearchPath(null, searchPath); } // TODO get to the point when we can deprecate this behaviour!: @@ -997,11 +996,11 @@ public abstract class RebindIteration { if (canLoadClass) { LOG.warn("Missing catalog item for " + entityManifest.getId() + " (" + entityManifest.getType() + "), inferring as " + item.getId() + " because that is able to load the item"); -return new CatalogItemIdAndSearchPath(item.getId(), ImmutableList.of()); +return new CatalogItemIdAndSearchPath(item.getId(), searchPath); } } } -return new CatalogItemIdAndSearchPath(null, ImmutableList.of()); +return new CatalogItemIdAndSearchPath(null, searchPath); } protected static class LoadedClass {
(brooklyn-server) branch master updated: remove unnecessary template model wrapping
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 351e1d0639 remove unnecessary template model wrapping 351e1d0639 is described below commit 351e1d06390cb5c7ac211ed55a6740f5ea180587 Author: Alex Heneveld AuthorDate: Thu Apr 11 10:52:19 2024 +0100 remove unnecessary template model wrapping as it confuses some unwrapping, causing surprising lookups and errors --- .../brooklyn/util/core/text/TemplateProcessor.java | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/util/core/text/TemplateProcessor.java b/core/src/main/java/org/apache/brooklyn/util/core/text/TemplateProcessor.java index 3777c322f4..b620ca11ef 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/text/TemplateProcessor.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/text/TemplateProcessor.java @@ -99,6 +99,7 @@ public class TemplateProcessor { static CrossTaskThreadLocalStack IS_FOR_WORKFLOW = new CrossTaskThreadLocalStack<>(); public interface UnwrappableTemplateModel { +// could make sense to distinguish 'unwrappable as result' from 'unwrappable for alternative lookup' Maybe unwrap(); } @@ -441,7 +442,7 @@ public class TemplateProcessor { * Freemarker will only do this when in inside bracket notation in an outer map, as in ${outer['a.b.']}; * as a result this is intended only for use by {@link EntityAndMapTemplateModel} where * a caller has used bracked notation, as in ${mgmt['key.subkey']}. */ -protected static final class EntityConfigTemplateModel implements TemplateHashModel, UnwrappableTemplateModel { +protected static final class EntityConfigTemplateModel implements TemplateHashModel { protected final EntityInternal entity; protected final ManagementContext mgmt; @@ -450,11 +451,6 @@ public class TemplateProcessor { this.mgmt = entity.getManagementContext(); } -@Override -public Maybe unwrap() { -return Maybe.of(entity); -} - @Override public boolean isEmpty() { return false; } @@ -524,7 +520,7 @@ public class TemplateProcessor { * Freemarker will only do this when in inside bracket notation in an outer map, as in ${outer['a.b.']}; * as a result this is intended only for use by {@link LocationAndMapTemplateModel} where * a caller has used bracked notation, as in ${mgmt['key.subkey']}. */ -protected static final class LocationConfigTemplateModel implements TemplateHashModel, UnwrappableTemplateModel { +protected static final class LocationConfigTemplateModel implements TemplateHashModel { protected final LocationInternal location; protected final ManagementContext mgmt; @@ -533,11 +529,6 @@ public class TemplateProcessor { this.mgmt = location.getManagementContext(); } -@Override -public Maybe unwrap() { -return Maybe.of(location); -} - @Override public boolean isEmpty() { return false; } @@ -597,15 +588,10 @@ public class TemplateProcessor { throw new TemplateModelException(msg+": "+Exceptions.collapseText(cause), cause); } -protected final static class EntityAttributeTemplateModel implements TemplateHashModel, UnwrappableTemplateModel { +protected final static class EntityAttributeTemplateModel implements TemplateHashModel { protected final EntityInternal entity; private final SensorResolutionMode mode; -@Override -public Maybe unwrap() { -return Maybe.of(entity); -} - enum SensorResolutionMode { SENSOR_DEFINITION, ATTRIBUTE_VALUE, ATTRIBUTE_WHEN_READY_FOR_TEMPLATES,
(brooklyn-server) branch master updated: allow prefixes to filter on exceptions to be modified
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 83300f5b6a allow prefixes to filter on exceptions to be modified 83300f5b6a is described below commit 83300f5b6a8fd88de091fbc4fa1804642c3e5957 Author: Alex Heneveld AuthorDate: Wed Apr 10 22:21:22 2024 +0100 allow prefixes to filter on exceptions to be modified --- .../src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java index 464d97131e..34c9030dc4 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java @@ -77,11 +77,11 @@ public class Exceptions { } }; -private static List> BORING_PREFIX_THROWABLE_EXACT_TYPES = ImmutableList.>of( +public static final Set> BORING_PREFIX_THROWABLE_EXACT_TYPES = MutableSet.>of( RuntimeException.class, Exception.class, Throwable.class, IllegalStateException.class, IllegalArgumentException.class); -private static List> BORING_PREFIX_THROWABLE_SUPERTYPES = ImmutableList.>of( +public static final Set> BORING_PREFIX_THROWABLE_SUPERTYPES = MutableSet.>of( ClassCastException.class, CompoundRuntimeException.class, PropagatedRuntimeException.class); /** Returns whether the prefix is throwable either known to be boring or to have an unhelpful type name (prefix)
(brooklyn-server) branch master updated: allow checking call stacks across tasks
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git The following commit(s) were added to refs/heads/master by this push: new 2327001553 allow checking call stacks across tasks 2327001553 is described below commit 2327001553fef6e61a5c3a2243d106bb50a08820 Author: Alex Heneveld AuthorDate: Wed Apr 10 16:03:29 2024 +0100 allow checking call stacks across tasks so recursive checks between threads are found. and improve error messages. --- .../workflow/WorkflowExpressionResolution.java | 8 +-- .../util/core/task/BasicExecutionContext.java | 4 +- .../util/core/task/CrossTaskThreadLocalStack.java | 71 ++ .../brooklyn/util/core/task/ValueResolver.java | 2 +- .../brooklyn/util/core/text/TemplateProcessor.java | 3 +- .../util/collections/ThreadLocalStack.java | 56 ++--- 6 files changed, 116 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java index 658aeb1b4d..9831f2dccb 100644 --- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java +++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExpressionResolution.java @@ -48,10 +48,10 @@ import org.apache.brooklyn.core.typereg.RegisteredTypes; import org.apache.brooklyn.util.collections.Jsonya; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; -import org.apache.brooklyn.util.collections.ThreadLocalStack; import org.apache.brooklyn.util.core.flags.TypeCoercions; import org.apache.brooklyn.util.core.predicates.ResolutionFailureTreatedAsAbsent; import org.apache.brooklyn.util.core.task.DeferredSupplier; +import org.apache.brooklyn.util.core.task.CrossTaskThreadLocalStack; import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.core.text.TemplateProcessor; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -530,7 +530,7 @@ public class WorkflowExpressionResolution { callable); } -static ThreadLocalStack RESOLVE_STACK = new ThreadLocalStack<>(false); +static CrossTaskThreadLocalStack RESOLVE_STACK = new CrossTaskThreadLocalStack<>(false); T inResolveStackEntry(String callPointUid, Object expression, Supplier code) { return inResolveStackEntry(WorkflowResolutionStackEntry.of(this, callPointUid, expression), null, code); @@ -587,11 +587,11 @@ public class WorkflowExpressionResolution { public Object processTemplateExpression(Object expression, AllowBrooklynDslMode allowBrooklynDsl) { return inResolveStackEntry(WorkflowResolutionStackEntry.of(this, "process-template-expression", expression), () -> { -throw new WorkflowVariableRecursiveReference("Recursive reference: " + RESOLVE_STACK.getAll(false).stream().map(p -> "" + p.expression).collect(Collectors.joining("->"))); +throw new WorkflowVariableRecursiveReference("Recursive reference: " + RESOLVE_STACK.stream().map(p -> "" + p.expression).collect(Collectors.joining("->"))); }, () -> { try { if (RESOLVE_STACK.size() > 100) { -throw new WorkflowVariableRecursiveReference("Reference exceeded max depth 100: " + RESOLVE_STACK.getAll(false).stream().map(p -> "" + p.expression).collect(Collectors.joining("->"))); +throw new WorkflowVariableRecursiveReference("Reference exceeded max depth 100: " + RESOLVE_STACK.stream().map(p -> "" + p.expression).collect(Collectors.joining("->"))); } Object result; diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java index b0757bacc8..fcbaf627ab 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java @@ -36,6 +36,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; import com.google.common.annotations.Beta; import com.google.common.base.Function; @@ -45,6 +46,7 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.mgmt.ExecutionContext; import org.apache.brooklyn.api.mgmt.ExecutionManager; import org.apache.brooklyn.api.mgmt.
(brooklyn-library) branch master updated (5afd815a1 -> 61381901b)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-library.git from 5afd815a1 Change version to 1.2.0-SNAPSHOT new 8b756e03b suppress geo in testing new 5dc539199 update docker container used for building (and maven) new 61381901b Merge branch 'master' of github.com:apache/brooklyn-library The 3 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. Summary of changes: Dockerfile | 7 +++ .../brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java | 1 + 2 files changed, 4 insertions(+), 4 deletions(-)
(brooklyn-library) 02/03: update docker container used for building (and maven)
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-library.git commit 5dc5391994fba6f32c21d71cd509392792ce63fc Author: Alex Heneveld AuthorDate: Wed Apr 10 12:18:16 2024 +0100 update docker container used for building (and maven) --- Dockerfile | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75fca6276..5fd1e30d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,10 @@ # specific language governing permissions and limitations # under the License. -FROM maven:3.5.4-jdk-8-alpine +FROM maven:3.5.2-jdk-8-alpine -# Install necessary binaries to build brooklyn-library -RUN apk add --no-cache git procps +# Install necessary binaries to build brooklyn-server +RUN apk add --no-cache git RUN mkdir -p /var/maven/.m2/ && chmod -R 777 /var/maven/ ENV MAVEN_CONFIG=/var/maven/.m2 -
(brooklyn-library) 01/03: suppress geo in testing
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-library.git commit 8b756e03be01b9af9a57786264de08674b318e39 Author: Alex Heneveld AuthorDate: Wed Apr 10 12:18:03 2024 +0100 suppress geo in testing --- .../apache/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java index 74960bdce..278f0aa4d 100644 --- a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java +++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java @@ -203,6 +203,7 @@ public class GeoscalingIntegrationTest extends BrooklynAppUnitTestSupport { @Override public HostGeoInfo getHostGeoInfo(InetAddress address) throws Exception { +if (isHostGeoLookupGloballyDisabled()) return null; // Saw strange test failure on jenkins: hence paranoid logging, just in case exception is swallowed somehow. try { HostGeoInfo result;
(brooklyn-library) 03/03: Merge branch 'master' of github.com:apache/brooklyn-library
This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-library.git commit 61381901be0334dcea6e1fe1367bd0941a3f775b Merge: 5dc539199 5afd815a1 Author: Alex Heneveld AuthorDate: Wed Apr 10 12:18:35 2024 +0100 Merge branch 'master' of github.com:apache/brooklyn-library DEPENDENCIES | 433 - catalog-aliases/pom.xml| 2 +- catalog-aliases/src/main/resources/catalog.bom | 2 +- examples/pom.xml | 2 +- examples/simple-web-cluster/pom.xml| 2 +- .../src/main/resources/catalog.bom | 2 +- examples/webapps/hello-world-sql/pom.xml | 2 +- examples/webapps/hello-world-webapp/pom.xml| 2 +- examples/webapps/pom.xml | 2 +- karaf/catalog/pom.xml | 2 +- karaf/catalog/src/main/resources/catalog.bom | 24 +- karaf/features/pom.xml | 2 +- karaf/pom.xml | 2 +- pom.xml| 2 +- qa/pom.xml | 2 +- .../test/projects/downstream-parent-test/pom.xml | 6 +- .../src/main/resources/catalog.bom | 2 +- .../resources/java-web-app-and-db-with-policy.bom | 2 +- qa/start-monitor.sh| 2 +- qa/start-webcluster.sh | 2 +- sandbox/cassandra-multicloud-snitch/pom.xml| 2 +- sandbox/database/pom.xml | 2 +- sandbox/extra/pom.xml | 2 +- sandbox/mobile-app/pom.xml | 2 +- sandbox/monitoring/pom.xml | 2 +- sandbox/monitoring/src/main/resources/catalog.bom | 2 +- sandbox/nosql/pom.xml | 2 +- software/cm/ansible/pom.xml| 2 +- software/cm/ansible/src/main/resources/catalog.bom | 2 +- software/cm/chef/pom.xml | 2 +- software/cm/chef/src/main/resources/catalog.bom| 2 +- software/cm/pom.xml| 4 +- software/cm/salt/pom.xml | 2 +- software/cm/salt/src/main/resources/catalog.bom| 2 +- software/database/pom.xml | 2 +- software/database/src/main/resources/catalog.bom | 2 +- software/messaging/pom.xml | 2 +- software/messaging/src/main/resources/catalog.bom | 4 +- software/monitoring/pom.xml| 2 +- software/monitoring/src/main/resources/catalog.bom | 2 +- software/network/pom.xml | 2 +- software/network/src/main/resources/catalog.bom| 2 +- software/nosql/pom.xml | 2 +- software/nosql/src/main/resources/catalog.bom | 2 +- software/osgi/pom.xml | 2 +- software/osgi/src/main/resources/catalog.bom | 2 +- software/webapp/pom.xml| 4 +- software/webapp/src/main/resources/catalog.bom | 2 +- 48 files changed, 390 insertions(+), 169 deletions(-)