[GitHub] brooklyn-ui pull request #107: Use checkboxes for blueprint type in save mod...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-ui/pull/107 Use checkboxes for blueprint type in save modal Updates the advanced section of the save to catalog modal dialog to use checkboxes instead, with more helpful text labels You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-ui update/save-library-checkboxes Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-ui/pull/107.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #107 commit a8c0075de1017858f1bc764cdc452fb00e88a203 Author: Andrew Donald Kennedy Date: 2018-11-07T13:53:11Z Use checkboxes for blueprint type in save modal Signed-off-by: Andrew Donald Kennedy ---
[GitHub] brooklyn-ui pull request #106: Update save to catalog action
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/106#discussion_r232236211 --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js --- @@ -64,8 +64,44 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co $scope.buttonText = $scope.config.label || ($scope.config.itemType ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog'); $scope.activateModal = () => { -// Override callback to update catalog configuration data in other applications -$scope.config = (composerOverrides.updateCatalogConfig || (($scope, $element) => $scope.config))($scope, $element); +function injectorGet(reference) { return $element.injector().get(reference); } +let blueprintService = injectorGet('blueprintService'); + +let entity = blueprintService.get(); +let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : { }; --- End diff -- Sometimes `version` or `iconUrl` are only available in the metadata, depending on the source of the blueprint ---
[GitHub] brooklyn-ui pull request #106: Update save to catalog action
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-ui/pull/106 Update save to catalog action Sets some default values from the blueprint and moves some items to an advanced section You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-ui update/save-to-catalog-action Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-ui/pull/106.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #106 commit 474de9e24478a971d2d6a757dd4fd54e8e63eb74 Author: Andrew Donald Kennedy Date: 2018-10-24T13:51:44Z Configure various catalog properties based on current blueprint Signed-off-by: Andrew Donald Kennedy commit b66923215180412954333957ddd20eb87c427117 Author: Andrew Donald Kennedy Date: 2018-11-07T13:27:53Z Adds optional advanced section to catalog save modal Signed-off-by: Andrew Donald Kennedy ---
[GitHub] brooklyn-server issue #1013: Partial Fix for Windows Build
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1013 Note that _some_ Windows installs do have bash available and SSH listening on port 22! However, since this is not the default Windows config, I'm fine with the way the annotation works just now. It might be useful to make it operate conditionally somehow, but that's extra complexity for not much gain so not very important just now... ---
[GitHub] brooklyn-ui pull request #89: spec editor hook
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/89#discussion_r227783485 --- Diff: ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js --- @@ -130,7 +130,13 @@ export function specEditorDirective($rootScope, $templateCache, $injector, $sani open: false } }; - +// allow downstream to configure this controller and/or scope +(composerOverrides.configureSpecEditor || function() {})(this, $scope, $element); +var headerTemplate = angular.element($templateCache.get('spec-editor/header.html')); --- End diff -- Can we move this to the callback instead ---
[GitHub] brooklyn-ui pull request #91: Add callback for customising catalog save conf...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-ui/pull/91 Add callback for customising catalog save configuration Does not include any specific changes for the configuration here, these can be added in future pull requests You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-ui custom-save-action Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-ui/pull/91.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #91 commit 39d3fbb3c7f1ba541eda014706767bb50823155d Author: Andrew Donald Kennedy Date: 2018-10-15T12:38:57Z Add callback for customising catalog save configuration ---
[GitHub] brooklyn-server issue #1005: [TEST] Update README.md
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1005 Closing, testing successful. Thanks @aledsage ---
[GitHub] brooklyn-server pull request #1005: [TEST] Update README.md
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/1005 ---
[GitHub] brooklyn-server issue #1006: Update IPTables save method
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1006 Closing, as #1003 seems to be building OK now... ---
[GitHub] brooklyn-server pull request #1006: Update IPTables save method
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/1006 ---
[GitHub] brooklyn-server pull request #1009: Add ow2 bundles not included in Karaf
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/1009 Add ow2 bundles not included in Karaf Fixes the following Karaf startup exception: ``` ERROR 82 o.a.a.b.c.BlueprintContainerImpl [tures-3-thread-1] Unable to start blueprint container for bundle org.apache.brooklyn.karaf-init/1.0.0.SNAPSHOT org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.NoClassDefFoundError: org/objectweb/asm/commons/AdviceAdapter at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:141) ~[?:?] at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:81) ~[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?] at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:90) ~[?:?] at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:810) ~[?:?] at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:784) ~[?:?] at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:765) ~[?:?] at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:699) ~[?:?] at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[?:?] at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:81) ~[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?] ... ``` Based on adding the following list of bundles: - org.ow2.asm/asm-commons - org.ow2.asm/asm-tree - org.ow2.asm/asm-analysis - org.ow2.asm/asm-util You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server fix/karaf-startup-issue Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/1009.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1009 commit ba0aad95985c31942d2f5030cef2331aa119da5e Author: Andrew Donald Kennedy Date: 2018-10-12T15:33:16Z Add ow2 bundles not included in Karaf Signed-off-by: Andrew Donald Kennedy ---
[GitHub] brooklyn-server pull request #1006: Update IPTables save method
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/1006 Update IPTables save method Service iptables save doesn't work with Centos 7, or rather doesn't work with the CentOS 7 AMI we use on EC2, which has a cut-down service command only supporting the standard start, stop, restart and status command verbs. Generates a better bash command string that should work on all CentOS variants. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server frogfather_amend_iptables_save Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/1006.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1006 commit 77b50be911148c7414dbb1b30364b495b4c8f363 Author: frogfather Date: 2018-10-01T13:23:15Z Update IPTables save method commit c474231af219212336b647f3cc138d6ff58a8f47 Author: frogfather Date: 2018-10-02T13:42:23Z review comments and add test ---
[GitHub] brooklyn-server pull request #1005: [TEST] Update README.md
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/1005 [TEST] Update README.md Extra line for PR to test Jenkins builds. DO NOT MERGE! You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server patch-1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/1005.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1005 commit d7b7d4c8db116e78324e3133c27aeeb519b95383 Author: Andrew Donald Kennedy Date: 2018-10-03T00:10:45Z [TEST] Update README.md Extra line for PR to test Jenkins builds ---
[GitHub] brooklyn-server issue #1003: Update IPTables save method
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1003 I think Jenkins is failing due to permissions, maybe on the ASF side? ---
[GitHub] brooklyn-server issue #1003: Update IPTables save method
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1003 Thanks @frogfather LGTM, will merge assuming tests pass ---
[GitHub] brooklyn-server issue #1003: Update IPTables save method
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/1003 > Service iptables save doesn't work with Centos7 That is, doesn't work with the CentOS 7 AMI we use on EC2, which has a cut-down `service` command only supporting the standard _start_, _stop_, _restart_ and _status_ command verbs. ---
[GitHub] brooklyn-server pull request #1003: Update IPTables save method
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/1003#discussion_r221687382 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/ssh/IptablesCommands.java --- @@ -130,8 +130,8 @@ public static String firewalldServiceIsActive() { * */ public static String saveIptablesRules() { -return alternatives(sudo("service iptables save"), -chain(installPackage("iptables-persistent"), sudo("/etc/init.d/iptables-persistent save"))); +return alternatives("if [ ${UID} -eq 0 ] ; then iptablesâsave > /etc/sysconfig/iptables ; else sudo iptables-save | sudo tee /etc/sysconfig/iptables ; fi", --- End diff -- Maybe surround this with `BashCommands.ifExecutableElse1("iptables-save", ...)` to ensure the command exists ---
[GitHub] brooklyn-ui issue #69: Fix a couple issues with composer spec/config editor
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-ui/pull/69 Looks good so far. Will test with a custom widget I have been developing to check that it still works... ---
[GitHub] brooklyn-ui pull request #64: Fix configuration for npm plugin on Windows
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-ui/pull/64 Fix configuration for npm plugin on Windows Sets the goals explicitly in profile configuration, to match plugin configurations. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-ui fix/windows-npm-plugin-config Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-ui/pull/64.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #64 commit 5e9ee588c73e2749fa02e30749146fb438ab9af7 Author: Andrew Donald Kennedy Date: 2018-08-21T15:04:24Z Fix configuration for npm plugin on Windows Signed-off-by: Andrew Donald Kennedy ---
[GitHub] brooklyn-ui issue #57: apply POM change to fix issue with npm install on win...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-ui/pull/57 LGTM, good to merge. ---
[GitHub] brooklyn-server pull request #833: Fix PeriodicEffectorPolicy
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/833#discussion_r139935880 --- Diff: policy/src/test/java/org/apache/brooklyn/policy/action/AbstractEffectorPolicyTest.java --- @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.policy.action; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.util.List; + +import org.apache.brooklyn.api.objs.Configurable; +import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.test.Asserts; +import org.apache.brooklyn.util.time.Duration; + +import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; + +public class AbstractEffectorPolicyTest extends BrooklynAppUnitTestSupport { --- End diff -- I think this looks better, I should probably have done the same and lifted shared parts up out of the tests. ---
[GitHub] brooklyn-server pull request #833: Fix PeriodicEffectorPolicy
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/833#discussion_r139935476 --- Diff: policy/src/main/java/org/apache/brooklyn/policy/action/AbstractScheduledEffectorPolicy.java --- @@ -233,8 +269,8 @@ public synchronized void run() { Object result = entity.invoke(effector, resolved).getUnchecked(); LOG.debug("{}: Effector {} returned {}", new Object[] { this, effector.getName(), result }); } catch (RuntimeInterruptedException rie) { -Thread.interrupted(); -// TODO sometimes this seems to hang the executor? +// Gracefully stop +Thread.currentThread().interrupt(); --- End diff -- Thanks, I couldn't remember the right way to handle this. ---
[GitHub] brooklyn-server pull request #833: Fix PeriodicEffectorPolicy
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/833#discussion_r139935768 --- Diff: policy/src/main/java/org/apache/brooklyn/policy/action/AbstractScheduledEffectorPolicy.java --- @@ -210,16 +227,35 @@ protected Duration getWaitUntil(String time) { } } +protected Date parseTime(String time) throws ParseException { +boolean formatted = time.contains(":"); // FIXME deprecated TimeDuration coercion +if (formatted) { +synchronized (FORMATTER) { +// DateFormat is not thread-safe; docs say to use one-per-thread, or to synchronize externally +return FORMATTER.parse(time); --- End diff -- Good catch ---
[GitHub] brooklyn-server pull request #833: Fix PeriodicEffectorPolicy
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/833#discussion_r139935372 --- Diff: policy/src/main/java/org/apache/brooklyn/policy/action/ScheduledEffectorPolicy.java --- @@ -59,8 +60,8 @@ public ScheduledEffectorPolicy() { public void setEntity(final EntityLocal entity) { super.setEntity(entity); -subscriptions().subscribe(entity, INVOKE_IMMEDIATELY, this); -subscriptions().subscribe(entity, INVOKE_AT, this); +subscriptions().subscribe(ImmutableMap.of("notifyOfInitialValue", true), entity, INVOKE_IMMEDIATELY, this); --- End diff -- This makes sense, good idea ---
[GitHub] brooklyn-server pull request #827: Rebind test for scheduled policies
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/827 Rebind test for scheduled policies This should have been included in #822 to test `rebind()`, also includes minor tidying. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server fix/time-policies Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/827.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #827 commit bc6bb1aabc68217a57bc14465893d9f1c6ea63a7 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-09-18T08:48:42Z Rebind test for scheduled policies ---
[GitHub] brooklyn-server issue #822: New periodic and scheduled effector policies
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/822 @ahgittin I will do some testing of how this interacts with #818 but it will be in a separate PR so that this can get into the 0.12 RC ---
[GitHub] brooklyn-docs issue #213: Add docs for Scheduled and PeriodicEffectorPolicy
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-docs/pull/213 LGTM @drigodwin ---
[GitHub] brooklyn-docs pull request #213: Add docs for Scheduled and PeriodicEffector...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-docs/pull/213#discussion_r138936560 --- Diff: guide/blueprints/policies.md --- @@ -100,6 +100,39 @@ The ConnectionFailureDetector is an HA policy for monitoring an http connection, ### Optimization Policies + PeriodicEffector Policy + +- org.apache.brooklyn.policy.action.PeriodicEffectorPolicy + +The `PeriodicEffectorPolicy` calls an effector with a set of arguments at a specified time and date. The following example +calls a `resize` effector to resize a cluster up to 10 members at 8am and then down to 1 member at 6pm. --- End diff -- add this text: > The policy monitors the sensor configured as `start.sensor` and will only start when this is set to `true`. The default sensor checked is `service.isUp`, so that the policy will not execute the effector until the entity is started. ---
[GitHub] brooklyn-server pull request #818: More on adjunct highlights
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/818#discussion_r138919622 --- Diff: core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java --- @@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) { return highlightsToReturn; } +/** Records a named highlight against this object, for persistence and API access. + * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} and + * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}. + * Also see convenience methods eg {@link #highlightOngoing(String, String)} and {@link #highlight(String, String, Task)} + * and {@link HighlightTuple}. + */ +protected void setHighlight(String name, HighlightTuple tuple) { +highlights.put(name, tuple); +} + +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item which is intended to be ongoing. */ +protected void highlightOngoing(String name, String description) { +highlights.put(name, new HighlightTuple(description, 0, null)); +} +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item with the current time. */ +protected void highlightNow(String name, String description) { +highlights.put(name, new HighlightTuple(description, System.currentTimeMillis(), null)); +} +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item with the current time and given task. */ +protected void highlight(String name, String description, @Nullable Task t) { +highlights.put(name, new HighlightTuple(description, System.currentTimeMillis(), t!=null ? t.getId() : null)); +} + +/** As {@link #setHighlight(String, HighlightTuple)} for {@link #HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */ +protected void highlightTriggers(String description) { +highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description); +} +protected void highlightTriggers(Sensor s, Object source) { +highlightTriggers(Collections.singleton(s), Collections.singleton(source)); +} +protected void highlightTriggers(Iterable> s, Object source) { +highlightTriggers(s, (Iterable) (source instanceof Iterable ? (Iterable)source : Collections.singleton(source))); +} +protected void highlightTriggers(Sensor s, Iterable sources) { +highlightTriggers(Collections.singleton(s), sources); +} +protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) { +StringBuilder msg = new StringBuilder("Listening for "); +boolean firstWord = true; +if (sensors!=null) for (Object s: sensors) { +if (s==null) continue; +if (!firstWord) { msg.append(", "); } else { firstWord = false; } +// s is normally a sensor but forgive other things if caller cheated generics +msg.append(s instanceof Sensor ? ((Sensor)s).getName() : s.toString()); +} +if (firstWord) msg.append(""); + +firstWord = true; --- End diff -- Looks nice @ahgittin - it's taken me a while to get used to operating in this style with Java as well, but it does makes things both concise and still readable... ---
[GitHub] brooklyn-server pull request #818: More on adjunct highlights
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/818#discussion_r138690532 --- Diff: core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java --- @@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) { return highlightsToReturn; } +/** Records a named highlight against this object, for persistence and API access. + * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} and + * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}. + * Also see convenience methods eg {@link #highlightOngoing(String, String)} and {@link #highlight(String, String, Task)} + * and {@link HighlightTuple}. + */ +protected void setHighlight(String name, HighlightTuple tuple) { +highlights.put(name, tuple); +} + +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item which is intended to be ongoing. */ +protected void highlightOngoing(String name, String description) { +highlights.put(name, new HighlightTuple(description, 0, null)); +} +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item with the current time. */ +protected void highlightNow(String name, String description) { +highlights.put(name, new HighlightTuple(description, System.currentTimeMillis(), null)); +} +/** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item with the current time and given task. */ +protected void highlight(String name, String description, @Nullable Task t) { +highlights.put(name, new HighlightTuple(description, System.currentTimeMillis(), t!=null ? t.getId() : null)); +} + +/** As {@link #setHighlight(String, HighlightTuple)} for {@link #HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */ +protected void highlightTriggers(String description) { +highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description); +} +protected void highlightTriggers(Sensor s, Object source) { +highlightTriggers(Collections.singleton(s), Collections.singleton(source)); +} +protected void highlightTriggers(Iterable> s, Object source) { +highlightTriggers(s, (Iterable) (source instanceof Iterable ? (Iterable)source : Collections.singleton(source))); +} +protected void highlightTriggers(Sensor s, Iterable sources) { +highlightTriggers(Collections.singleton(s), sources); +} +protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) { +StringBuilder msg = new StringBuilder("Listening for "); +boolean firstWord = true; +if (sensors!=null) for (Object s: sensors) { +if (s==null) continue; +if (!firstWord) { msg.append(", "); } else { firstWord = false; } +// s is normally a sensor but forgive other things if caller cheated generics +msg.append(s instanceof Sensor ? ((Sensor)s).getName() : s.toString()); +} +if (firstWord) msg.append(""); + +firstWord = true; --- End diff -- Interesting @Graeme-Miller - Not sure that you need the second clause in your `if`, as the body handles the `self` output the same as the original code. I'd prefer the `Collectors.joining(", ")` collector, to get a `String` out directly... Also, I'm not sure you should try and chest the lambda type inference like that, just go `s -> { /* stuff */ }` and it'll be fine. Redoing the whole method with lambdas gave me this, which is almost exactly the same length ;) ``` protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) { StringBuilder msg = new StringBuilder("Listening for "); if (Iterables.isEmpty(sensors)) { msg.append(""); } else { String sensorsText = StreamSupport.stream(sensors.spliterator(), false) .filter(s -> s != null) .map(s -> { if (s instanceof Sensor) { return ((Sensor) s).getName(); } else { return s.toString(); } }) .collect(Collectors.joining(", ")); msg.append(sensorsText); } if (!Iterables.isEmpty(sources)) { String sourcesText = StreamSupport.stream(sources.spliterator(), false) .filter(s -> s != null) .map
[GitHub] brooklyn-server pull request #822: New periodic and scheduled effector polic...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/822 New periodic and scheduled effector policies You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/time-policies Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/822.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #822 commit 060d7d114cd89050bdcbdecb3129e1425f944f61 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-09-13T17:03:56Z New periodic and scedukled effector policies ---
[GitHub] brooklyn-server issue #750: Adds a policy to create locations from an entity
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/750 Thanks for the review @aledsage, I will update appropriately. The use case is for blueprints like Kubernetes, which would be able to add a new `KubernetesLocation` or similar. ---
[GitHub] brooklyn-server pull request #769: Fix feature install bundle version issue
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/769 Fix feature install bundle version issue Fixes issue with installing bundles, causing the following error: ``` karaf@brooklyn()> feature:install -r jclouds-api-route53 Error executing command: Unable to build resource for brooklyn:fo9y9ghsab: Unsupported 'Bundle-ManifestVersion' value: 1 ``` Sets `Bundle-ManifestVersion` to 2 for Brooklyn generated bundles. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server fix/feature-install Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/769.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #769 commit 28096d3c4af18b5055d84e81b420e111d941a62b Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-07-20T12:57:04Z Fix feature install bundle version issue --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #750: Adds a policy to create locations from an entity
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/750 Yes, that's probably useful - I'll put something together --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/750 Adds a policy to create locations from an entity Adds `CreateLocationPolicy`which configures a location using sensor data from an entity, once the entity is running. The location is added to the catalog for use by other blueprints. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/entity-location-policy Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/750.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #750 commit aee164ab290a5b197a0b1772ac2f123e34382bc0 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-06T23:25:55Z Add policy to create location dynamically from entity commit b9bf8da36ceda0239af7abb2cb2f706518ce922d Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-07T13:31:50Z Tidy up and add logging commit f58239db85391af96661b919516fe501ba0d1bf3 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-13T15:43:53Z Add call to super.setEntity in create location policy commit e18fd55e7f264c447bbf5d7c6bc3a2e5e49fa405 Author: Andrea Turli <andrea.tu...@gmail.com> Date: 2017-06-15T09:58:42Z use Catalog instead of LocationRegistry - add example to javadoc commit 1aae33136281a29e613a7bbb46ebd5dd1f7c8406 Author: Andrea Turli <andrea.tu...@gmail.com> Date: 2017-06-15T10:06:36Z mark as Beta commit 143b9d5cda1c13122c44c049403a442d37eae9f4 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-18T16:58:56Z Update location YAML with tags and check return status --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #749: Allow Kubernetes location configuration u...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/749 Allow Kubernetes location configuration using kubeconfig Adds a config key to the `KubernetesLocation` that accepts a `.kube/config` file location, and uses the contents to configure the location. Makes using provisioned Kubernetes clusters from providers like Bluemix or GKE easier. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/kubeconfig Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/749.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #749 commit ba905048204828b669c09fef0f8458241f2a1ad0 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-05-15T14:25:43Z Added client configuration for location via kubeconfig file commit ff9e87b236fea1e65c33346727f2782644a22b55 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-01T13:13:22Z Add configuration to set current context for kubeconfig commit 8b916084cefbf66e18827bb5c4230f6749dfbb4a Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-05T16:05:56Z Updated oauth token to also accept from auth provider section --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-dist pull request #95: Add the container service dependencies to th...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-dist/pull/95#discussion_r124230430 --- Diff: all/pom.xml --- @@ -117,6 +117,26 @@ ${project.version} + + +org.apache.brooklyn +brooklyn-locations-container +${project.version} + + +${jclouds.groupId}.api +jclouds-docker + + + io.fabric8 + kubernetes-client --- End diff -- Oops. Will fix --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-dist pull request #95: Add the container service dependencies to th...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-dist/pull/95 Add the container service dependencies to the main distribution Updates the `brooklyn-all` POM to include the new `brooklyn-container-service` code added by https://github.com/apache/brooklyn-server/pull/732 You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-dist feature/container-service Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-dist/pull/95.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #95 commit bcaca7d14f56a913f6c73b5ca36ce6678633c60c Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-06-16T12:45:15Z Add the container service dependencies to the main distribution --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #732: Adds brooklyn-container-service code
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/732 @neykov I didn't move things like that, but remember there is no shared history for the commits, which is why things look like this. It's the best we can do... --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #732: Adds brooklyn-container-service code
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/732 Adds brooklyn-container-service code See [IP clearance details](http://incubator.apache.org/ip-clearance/brooklyn-container-service.html) for further details. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/container-service Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/732.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #732 commit 103ab7a24b41118e38751c0da7ecace450acc659 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-06-19T18:50:15Z Set no internal networking config key for Riak commit 21fbf45c1f35f87c69f374620e6d576c96c5124d Author: Geoff Macartney <geoff.macart...@cloudsoftcorp.com> Date: 2016-06-20T15:08:41Z Avoid transmitting private key over the network. Previously the private key of a docker node was fetched over the web interface to the ca-server, which is not encrypted. This changes the shape of the handshake so that the docker node generates its own key and a certificate signing request (CSR) which it then sends to the ca-server, obtaining its signed certificate in the response to the REST request. This also adds some sensors, the idea having been that we would do away with the web server entirely and use sensors to expose data and an effector to sign the CSR. It turns out that the effector call will need a bit more work in brooklyn, so for now we retain the web server interaction to transmit the certificate. This also adds a script as a convenience for developers to get certificates from the ca-server, getcert.sh. See the script for comments on usage. commit b68d199a4b280f645505572262cbb81842bba45f Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com> Date: 2016-06-27T12:41:37Z Add swarm+etcd-tls test commit a50bd7c7931ef4854a5b92abfa5ab7ddacea0747 Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com> Date: 2016-06-28T10:04:54Z docker-engine doesn't open open tcp port commit 07e0b0be17097bc2114d0afd0ed78c1f25d47a3a Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com> Date: 2016-06-28T14:15:16Z Package BOMs in a jar commit e2dfc87493a836e9fd43ec106f0d16b36dc53099 Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com> Date: 2016-06-29T13:03:26Z Restart swarm containers and Docker VM wrapper container * Adds "--restart=unless-stopped" to swarm nodes and manager * Adds user supplied --restart policy (defaults to unless-stopped) for docker vm wrapper entity * Adds additional options configuration for the docker vm wrapper entity commit 104ffc3e490c94e6214481d09556885a9e77 Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com> Date: 2016-06-30T12:29:14Z Replace failed swarm nodes commit b04030c03269651b1d15bfe203ad0a7410dae005 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-07-05T05:19:18Z Update the brooklynetcd version to 2.1.0 commit ae5659aa3600887e5445fc480e183a45f51687f9 Author: Geoff Macartney <geoff.macart...@cloudsoftcorp.com> Date: 2016-07-05T14:03:25Z Fix etcd connection failure for different external and subnet networks. Builds on https://github.com/cloudsoft/container-service/pull/55, do not merge until after that. Adds subnet address as as subjectAltName as well as host address. This is because on Softlayer or other clouds where the public address is on a different network from the subnet address, swarm fails to connect to the etcd discovery mechanism. The problem is that the public host address is configured in the certificate but the etcd config is using the subnet address for the client and peer urls. When swarm nodes connect on the subnet address the certificate presented does not match the IP address requested and the connection fails. By adding the subnet address as another alternative name it is possible to connect using either address. commit e622129827c491c9e6d8a196eaee2573e17e49ba Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-07-05T18:15:38Z Add replication for Swarm masters commit 8ce66fe173b48bf10bf0606ded1ea8f4fcfc5769 Author: Geoff Macartney <geoff.macart...@cloudsoftcorp.com> Date: 2016-07-06T08:40:08Z Updates for running on Karaf. Add required libraries. commit d8cda90e5fb977f82ed084fc30f169277e3f24a8 Author: Duncan Grant <duncan.gr...@cloudsoftcorp.com> Date: 2016-07-07T15:16:13Z Add a Doc
[GitHub] brooklyn-server issue #605: Add series of meta effectors for composite opera...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/605 @Graeme-Miller I think once the tests are added it should be OK, as the individual effectors are all reliant on a single parent abstract class, so they fit together. I will work with @robertgmoss on getting this done and reviewed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #628: Allow setting random number generator see...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/628 Allow setting random number generator seed for identifiers Define `brooklyn.experimental.feature.random_seed` with the value of the seed for the random number generator. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/random-seed Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/628.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #628 commit b7244740fc6b75bdf3be4191a3ed99965eaab9bc Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-04-09T16:50:36Z Allow setting random number generator seed for identifiers --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #300: Location DSL Updates
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/300 I am going to close this, as the `DslComponent` code has moved too much to merge, and I think @neykov's idea of a `DslLocation` might bea better way of handling this concept. Will revisit later. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #300: Location DSL Updates
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/300 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #168: [WIP] Configure JcloudsLocationCustomizer as an ...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/168 Closing as replaced by #429 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #168: [WIP] Configure JcloudsLocationCustomizer...
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/168 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #605: Add series of meta effectors for composit...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/605#discussion_r108466870 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/composite/AbstractCompositeEffector.java --- @@ -0,0 +1,184 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.core.effector.composite; + +import java.util.Map; +import java.util.Set; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntityLocal; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.util.collections.CollectionFunctionals; +import org.apache.brooklyn.util.core.config.ConfigBag; +import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.text.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.Beta; +import com.google.common.collect.Iterables; + +@Beta +public abstract class AbstractCompositeEffector extends AddEffector { + +private static final Logger LOG = LoggerFactory.getLogger(AbstractCompositeEffector.class); + +public AbstractCompositeEffector(Effector effector) { +super(effector); +} + +@Override +public void apply(EntityLocal entity) { +Maybe<Effector> effectorMaybe = entity.getEntityType().getEffectorByName(effector.getName()); +if (!effectorMaybe.isAbsentOrNull()) { +//Effector original = Effectors.effector(effectorMaybe.get()).name(ORIGINAL_PREFIX + effector.getName()).build(); +//((EntityInternal) entity).getMutableEntityType().addEffector(original); +} +super.apply(entity); +} + +protected static abstract class Body extends EffectorBody { +protected final Effector effector; +protected final ConfigBag params; + +public Body(Effector eff, ConfigBag params) { +this.effector = eff; +this.params = params; +} + +@Override +public abstract T call(final ConfigBag params); + +protected String getEffectorName(Object effectorDetails) { +String effectorName = null; +if (effectorDetails instanceof String) { +effectorName = (String) effectorDetails; +} else if (effectorDetails instanceof Map) { +Map<String,Object> effectorMap = (Map) effectorDetails; +Set keys = effectorMap.keySet(); +if (keys.size() != 1) { +throw new IllegalArgumentException("Effector parameter cannot be parsed: " + effectorDetails); +} +effectorName = Iterables.getOnlyElement(keys); +} else { --- End diff -- But why would they do that? They would be creating a list of lists, as in the third option below, and if someone does that, then I'm happy for things to just break... ```YAML compose: - name1 # string - name2: # map key: value - [ whyWouldYouDoThis ] # list ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #546: Sequencer entity
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/546 @mikezaccardo is this still useful, e.g. for HLF blueprints? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #153: [WIP] Add support for JSR-223 scripting of effec...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/153 Closing this, as much of the desired functionality can be obtained through use of the meta effectors in #605 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #322: Adds a TargetServerEntity for improved co...
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/322 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #322: Adds a TargetServerEntity for improved command s...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/322 This can actually be implemented by adding a child to an entity with a latch that prevents startup until some other entity is available, so closing --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #605: Add series of meta effectors for composit...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/605#discussion_r107892815 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/composite/ComposeEffector.java --- @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.core.effector.composite; + +import java.util.List; +import java.util.Map; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder; +import org.apache.brooklyn.core.entity.EntityInitializers; +import org.apache.brooklyn.util.core.config.ConfigBag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.Beta; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.reflect.TypeToken; + +@Beta +public class ComposeEffector extends AbstractCompositeEffector { + +private static final Logger LOG = LoggerFactory.getLogger(ComposeEffector.class); + +public static final ConfigKey<List> COMPOSE = ConfigKeys.newConfigKey( +new TypeToken<List>() { }, +"compose", +"Effector details list for the compose effector", +ImmutableList.of()); + +public ComposeEffector(ConfigBag params) { +super(newEffectorBuilder(params).build()); +} + +public ComposeEffector(Map params) { +this(ConfigBag.newInstance(params)); +} + +public static EffectorBuilder newEffectorBuilder(ConfigBag params) { +EffectorBuilder eff = AddEffector.newEffectorBuilder(Object.class, params); +EffectorBody body = new Body(eff.buildAbstract(), params); +eff.impl(body); +return eff; +} + +protected static class Body extends AbstractCompositeEffector.Body { + +public Body(Effector eff, ConfigBag params) { +super(eff, params); + Preconditions.checkNotNull(params.getAllConfigRaw().get(COMPOSE.getName()), "Effector names must be supplied when defining this effector"); --- End diff -- Yes, I'll fix all of these to have better error messages. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #605: Add series of meta effectors for composit...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/605#discussion_r107892742 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/composite/AbstractCompositeEffector.java --- @@ -0,0 +1,184 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.core.effector.composite; + +import java.util.Map; +import java.util.Set; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntityLocal; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.util.collections.CollectionFunctionals; +import org.apache.brooklyn.util.core.config.ConfigBag; +import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.text.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.Beta; +import com.google.common.collect.Iterables; + +@Beta +public abstract class AbstractCompositeEffector extends AddEffector { + +private static final Logger LOG = LoggerFactory.getLogger(AbstractCompositeEffector.class); + +public AbstractCompositeEffector(Effector effector) { +super(effector); +} + +@Override +public void apply(EntityLocal entity) { +Maybe<Effector> effectorMaybe = entity.getEntityType().getEffectorByName(effector.getName()); +if (!effectorMaybe.isAbsentOrNull()) { +//Effector original = Effectors.effector(effectorMaybe.get()).name(ORIGINAL_PREFIX + effector.getName()).build(); +//((EntityInternal) entity).getMutableEntityType().addEffector(original); +} +super.apply(entity); +} + +protected static abstract class Body extends EffectorBody { +protected final Effector effector; +protected final ConfigBag params; + +public Body(Effector eff, ConfigBag params) { +this.effector = eff; +this.params = params; +} + +@Override +public abstract T call(final ConfigBag params); + +protected String getEffectorName(Object effectorDetails) { +String effectorName = null; +if (effectorDetails instanceof String) { +effectorName = (String) effectorDetails; +} else if (effectorDetails instanceof Map) { +Map<String,Object> effectorMap = (Map) effectorDetails; +Set keys = effectorMap.keySet(); +if (keys.size() != 1) { +throw new IllegalArgumentException("Effector parameter cannot be parsed: " + effectorDetails); +} +effectorName = Iterables.getOnlyElement(keys); +} else { --- End diff -- This is the individual effector elements of the list of effectors, they can only be a `String` or a `Map` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #605: Add series of meta effectors for composit...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/605 Add series of meta effectors for composite operations Adds `ComposeEffector`, `SequenceEffector`, `TransformEffector` and `LoopEffector` for orchestrating effector calls in blueprints. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/composite-effectors Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/605.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #605 commit 6f65287911308ccc0fa0260c47b30a4d4e748fa1 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-03-22T13:54:18Z Add series of meta effectors for composite operations --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #155: [WIP] Add DSL support for calling effectors in Y...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/155 @drigodwin I had to pull in https://github.com/grkvlt/brooklyn-server/pull/2 manually but it is there in 70d9aca so could you have a look please? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #555: Add DurationPredicates
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/555 @mikezaccardo remember we need tests for these too! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #555: Add DurationPredicates
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/555#discussion_r100346521 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/time/DurationPredicates.java --- @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.util.time; + +import com.google.common.base.Predicate; +import com.google.common.base.Stopwatch; + +public class DurationPredicates { + +/** + * @return A {@link Predicate} that checks if the {@link Duration} supplied + * to {@link Predicate#apply(Object)} is positive. + */ +public static Predicate isPositive() { +return new Predicate() { +@Override +public boolean apply(Duration duration) { +return duration != null && duration.isPositive(); +} +}; +} + +/** + * @return A {@link Predicate} that checks if the {@link Duration} supplied + * to {@link Predicate#apply(Object)} is negative. + */ +public static Predicate isNegative() { +return new Predicate() { +@Override +public boolean apply(Duration duration) { +return duration != null && duration.isNegative(); +} +}; +} + +/** + * @param duration + *The {@link Duration} that will be the basis for comparison in + *the returned {@link Predicate}. + * @return A {@link Predicate} that checks if the {@link Duration} that was + * supplied to this method is longer than any {@link Duration} + * supplied to to the returned {@link Predicate#apply(Object)}. + */ +public static Predicate isLongerThanDuration(final Duration duration) { +return new Predicate() { +@Override +public boolean apply(Duration other) { +return duration != null && other != null && duration.isLongerThan(other); +} +}; +} + +/** + * @param duration + *The {@link Duration} that will be the basis for comparison in + *the returned {@link Predicate}. + * @return A {@link Predicate} that checks if the {@link Duration} that was + * supplied to this method is longer than any {@link Stopwatch} + * supplied to the returned {@link Predicate#apply(Object)}. + */ +public static Predicate isLongerThanStopwatch(final Duration duration) { +return new Predicate() { +@Override +public boolean apply(Stopwatch other) { +return duration != null && other != null && duration.isLongerThan(other); +} +}; +} + +/** + * @param duration + *The {@link Duration} that will be the basis for comparison in + *the returned {@link Predicate}. + * @return A {@link Predicate} that checks if the {@link Duration} that was + * supplied to this method is shorter than any {@link Duration} + * supplied to to the returned {@link Predicate#apply(Object)}. + */ +public static Predicate isShorterThanDuration(final Duration duration) { +return new Predicate() { +@Override +public boolean apply(Duration other) { +return duration != null && other != null && duration.isShorterThan(other); --- End diff -- Again, the `Duration` the predicate speaks about here is the one called `other`, the `duration` is constant over the life of the predicate. --- If your project is set up for it, you can reply to this email and have your reply appear
[GitHub] brooklyn-server issue #546: Sequencer entity
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/546 @aledsage the use case in mind was to sequentially number across multiple clusters (i.e a fabric spread around several locations) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #493: Make the Repeater class use a threads to execute...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/493 @neykov have a look now, I updated the comments to be more explicit too --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #493: Make the Repeater class use a threads to ...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/493#discussion_r98700487 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java --- @@ -301,89 +332,96 @@ public Repeater limitTimeTo(Duration duration) { public boolean run() { return runKeepingError().getWithoutError(); } - + public void runRequiringTrue() { Stopwatch timer = Stopwatch.createStarted(); ReferenceWithError result = runKeepingError(); result.checkNoError(); -if (!result.get()) +if (!result.get()) { throw new IllegalStateException(description+" unsatisfied after "+Duration.of(timer)); +} } - + public ReferenceWithError runKeepingError() { -Preconditions.checkState(body != null, "repeat() method has not been called to set the body"); --- End diff -- Should have been changed to a `checkNotNull()` call --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #493: Make the Repeater class use a threads to ...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/493#discussion_r98700110 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java --- @@ -301,89 +332,96 @@ public Repeater limitTimeTo(Duration duration) { public boolean run() { return runKeepingError().getWithoutError(); } - + public void runRequiringTrue() { Stopwatch timer = Stopwatch.createStarted(); ReferenceWithError result = runKeepingError(); result.checkNoError(); -if (!result.get()) +if (!result.get()) { throw new IllegalStateException(description+" unsatisfied after "+Duration.of(timer)); +} } - + public ReferenceWithError runKeepingError() { -Preconditions.checkState(body != null, "repeat() method has not been called to set the body"); -Preconditions.checkState(exitCondition != null, "until() method has not been called to set the exit condition"); -Preconditions.checkState(delayOnIteration != null, "every() method (or other delaySupplier() / backoff() method) has not been called to set the loop delay"); +Preconditions.checkNotNull(exitCondition, "until() method has not been called to set the exit condition"); +Preconditions.checkNotNull(delayOnIteration, "every() method (or other delaySupplier() / backoff() method) has not been called to set the loop delay"); boolean hasLoggedTransientException = false; Throwable lastError = null; int iterations = 0; CountdownTimer timer = timeLimit!=null ? CountdownTimer.newInstanceStarted(timeLimit) : CountdownTimer.newInstancePaused(Duration.PRACTICALLY_FOREVER); -while (true) { -Duration delayThisIteration = delayOnIteration.apply(iterations); -iterations++; - -try { -body.call(); -} catch (Throwable e) { -log.warn(description, e); -if (rethrowImmediatelyCondition.apply(e)) throw Exceptions.propagate(e); -} - -boolean done = false; -try { -lastError = null; -done = exitCondition.call(); -hasLoggedTransientException = false; -} catch (Throwable e) { -if (hasLoggedTransientException) { -if (log.isDebugEnabled()) log.debug(description + " (repeated failure; excluding stacktrace): " + e); -} else { -if (log.isDebugEnabled()) log.debug(description, e); -hasLoggedTransientException = true; +try { +while (true) { +Duration delayThisIteration = delayOnIteration.apply(iterations); +iterations++; + +Future call = executor.submit(body); +try { +call.get(delayThisIteration.toMilliseconds(), TimeUnit.MILLISECONDS); +} catch (Throwable e) { +log.warn(description, e); +if (rethrowImmediatelyCondition.apply(e)) throw Exceptions.propagate(e); +} finally { +call.cancel(true); } -lastError = e; -if (rethrowImmediatelyCondition.apply(e)) throw Exceptions.propagate(e); -} -if (done) { -if (log.isDebugEnabled()) log.debug("{}: condition satisfied", description); -return ReferenceWithError.newInstanceWithoutError(true); -} else { -if (log.isDebugEnabled()) { -String msg = String.format("%s: unsatisfied during iteration %s %s", description, iterations, -(iterationLimit > 0 ? "(max "+iterationLimit+" attempts)" : "") + -(timer.isNotPaused() ? "("+Time.makeTimeStringRounded(timer.getDurationRemaining())+" remaining)" : "")); -if (iterations == 1) { -log.debug(msg); + +boolean done = false; +try { +lastError = null; +done = exitCondition.call(); +hasLoggedTransientException = false; +} catch (Throwable e) { +if (hasLoggedTransientException) { +l
[GitHub] brooklyn-server pull request #546: Sequencer entity
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/546 Sequencer entity An entity and a group that manage sequential sensor values You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server feature/sequencer-entity Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/546.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #546 commit 3a67126163db53e392f8523ecd400c71c2c7f3da Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-01-31T09:32:29Z An entity that emits a sequence of integers commit 196bb26cd6c685913c6b5957e5ac013cb23eab87 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2017-01-31T10:27:27Z A group that sets a sequence of values as sensors on members --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #493: Make the Repeater class use a threads to execute...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/493 @neykov @aledsage @geomacy thanks for the feedback, I'll make this configurable and add some tests --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #494: Simplify BitUtils methods
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/494#discussion_r95134861 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/math/BitUtils.java --- @@ -18,25 +18,22 @@ */ package org.apache.brooklyn.util.math; +import com.google.common.primitives.Bytes; +import com.google.common.primitives.Ints; + public class BitUtils { /** reverses the bits in a byte, i.e. 128 = 0b100 = bit list {0,0,0,0,0,0,0,1}, * reversed yields 1 = 0b0001 = bit list {1,0,0,0,0,0,0,0} */ public static byte reverseBitSignificance(byte b) { -int result = 0; -for (int i=0; i<8; i++) { -result <<= 1; -if ((b&1)==1) result++; -b >>= 1; -} -return (byte)result; +return (byte) (Integer.reverse(b) >> 24); --- End diff -- No. The following tests should convince you: ``` Assert.assertEquals(BitUtils.reverseBitSignificanceInByte(0b0001), (byte)0b1000); Assert.assertEquals(BitUtils.reverseBitSignificanceInByte(0x0f), (byte)0xf0); ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #494: Simplify BitUtils methods
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/494 Simplify BitUtils methods Couldn't help it. All tests still pass. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server fix/bit-utils Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/494.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #494 commit 1f1fea152e7b73afaa86533c1664b9243a8585c9 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-12-15T17:19:53Z Simplify BitUtils methods --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #493: Make the Repeater class use a threads to ...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/493 Make the Repeater class use a threads to execute the checks The Future returned by the Executor can be cancelled if it does not return a value after the required timeout. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server enhancement/threaded-repeater Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/493.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #493 commit beed8c1c0644f0965dac800633768da5fd615899 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-12-15T16:18:51Z Make the Repeater class use a threads to execute the checks The Future returned by the Executor can be cancelled if it does not return a value after the required timeout. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #473: Test framework: avoid repeated stacktrace...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/473#discussion_r90473445 --- Diff: test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java --- @@ -332,6 +343,56 @@ public void testFailFastIfNoSensor() throws Exception { assertStartFails(app, NullPointerException.class, Asserts.DEFAULT_LONG_TIMEOUT); } +@Test +public void testDoesNotLogStacktraceRepeatedly() throws Exception { +final long time = System.currentTimeMillis(); +final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), time, Identifiers.makeRandomId(8)); + +// Test case will repeatedly fail until we have finished our logging assertions. +// Then we'll let it complete by setting the sensor. +TestSensor testCase = app.createAndManageChild(EntitySpec.create(TestSensor.class) +.configure(TestSensor.TIMEOUT, Asserts.DEFAULT_LONG_TIMEOUT) +.configure(TestSensor.TARGET_ENTITY, app) +.configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) +.configure(TestSensor.ASSERTIONS, newListAssertion("matches", String.format(".*%s.*", time; + +String loggerName = Repeater.class.getName(); +ch.qos.logback.classic.Level logLevel = ch.qos.logback.classic.Level.DEBUG; +Predicate repeatedFailureMsgMatcher = EventPredicates.containsMessage("repeated failure; excluding stacktrace"); +Predicate stacktraceMatcher = EventPredicates.containsExceptionStackLine(TestFrameworkAssertions.class, "checkActualAgainstAssertions"); +Predicate filter = Predicates.or(repeatedFailureMsgMatcher, stacktraceMatcher); +LogWatcher watcher = new LogWatcher(loggerName, logLevel, filter); + +Task task; --- End diff -- Why is this declared outside the `try`/`catch` block? It doesn't seem to be used anywhere else? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #473: Test framework: avoid repeated stacktrace...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/473#discussion_r90475367 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java --- @@ -334,8 +335,14 @@ public void runRequiringTrue() { try { lastError = null; done = exitCondition.call(); +hasLoggedTransientException = false; } catch (Throwable e) { -if (log.isDebugEnabled()) log.debug(description, e); +if (hasLoggedTransientException) { +if (log.isDebugEnabled()) log.debug(description + " (repeated failure; excluding stacktrace): " + e); --- End diff -- Do not need to check `log.isDebugEnabled()` for simple logging like this --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #473: Test framework: avoid repeated stacktrace...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/473#discussion_r90474345 --- Diff: test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java --- @@ -332,6 +343,56 @@ public void testFailFastIfNoSensor() throws Exception { assertStartFails(app, NullPointerException.class, Asserts.DEFAULT_LONG_TIMEOUT); } +@Test +public void testDoesNotLogStacktraceRepeatedly() throws Exception { +final long time = System.currentTimeMillis(); +final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), time, Identifiers.makeRandomId(8)); + +// Test case will repeatedly fail until we have finished our logging assertions. +// Then we'll let it complete by setting the sensor. +TestSensor testCase = app.createAndManageChild(EntitySpec.create(TestSensor.class) +.configure(TestSensor.TIMEOUT, Asserts.DEFAULT_LONG_TIMEOUT) +.configure(TestSensor.TARGET_ENTITY, app) +.configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) +.configure(TestSensor.ASSERTIONS, newListAssertion("matches", String.format(".*%s.*", time; + +String loggerName = Repeater.class.getName(); +ch.qos.logback.classic.Level logLevel = ch.qos.logback.classic.Level.DEBUG; +Predicate repeatedFailureMsgMatcher = EventPredicates.containsMessage("repeated failure; excluding stacktrace"); +Predicate stacktraceMatcher = EventPredicates.containsExceptionStackLine(TestFrameworkAssertions.class, "checkActualAgainstAssertions"); +Predicate filter = Predicates.or(repeatedFailureMsgMatcher, stacktraceMatcher); +LogWatcher watcher = new LogWatcher(loggerName, logLevel, filter); + +Task task; +watcher.start(); +try { +// Invoke async; will let it complete after we see the log messages we expect +task = Entities.invokeEffector(app, app, Startable.START, ImmutableMap.of("locations", locs)); --- End diff -- Define variable here as `Task task = Entities...` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #473: Test framework: avoid repeated stacktrace...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/473#discussion_r90474128 --- Diff: test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java --- @@ -332,6 +343,56 @@ public void testFailFastIfNoSensor() throws Exception { assertStartFails(app, NullPointerException.class, Asserts.DEFAULT_LONG_TIMEOUT); } +@Test +public void testDoesNotLogStacktraceRepeatedly() throws Exception { +final long time = System.currentTimeMillis(); +final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), time, Identifiers.makeRandomId(8)); + +// Test case will repeatedly fail until we have finished our logging assertions. +// Then we'll let it complete by setting the sensor. +TestSensor testCase = app.createAndManageChild(EntitySpec.create(TestSensor.class) +.configure(TestSensor.TIMEOUT, Asserts.DEFAULT_LONG_TIMEOUT) +.configure(TestSensor.TARGET_ENTITY, app) +.configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) +.configure(TestSensor.ASSERTIONS, newListAssertion("matches", String.format(".*%s.*", time; + +String loggerName = Repeater.class.getName(); +ch.qos.logback.classic.Level logLevel = ch.qos.logback.classic.Level.DEBUG; +Predicate repeatedFailureMsgMatcher = EventPredicates.containsMessage("repeated failure; excluding stacktrace"); +Predicate stacktraceMatcher = EventPredicates.containsExceptionStackLine(TestFrameworkAssertions.class, "checkActualAgainstAssertions"); +Predicate filter = Predicates.or(repeatedFailureMsgMatcher, stacktraceMatcher); +LogWatcher watcher = new LogWatcher(loggerName, logLevel, filter); + +Task task; +watcher.start(); +try { --- End diff -- Since `LogWartcher` is `Closeable` can do this in the `try` block and it will be closed automatically. ```Java try (LogWatcher watcher = new LogWatcher(loggerName, logLevel, filter)) { // stuff } ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #475: BROOKLYN-405: ssh doesn't log password en...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/475#discussion_r90471366 --- Diff: core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationIntegrationTest.java --- @@ -19,53 +19,206 @@ package org.apache.brooklyn.location.ssh; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.OutputStream; +import java.net.InetAddress; import java.security.KeyPair; import java.util.Arrays; import java.util.Map; +import java.util.concurrent.Callable; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.LocationSpec; -import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.core.entity.Entities; -import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.core.test.entity.TestApplication; +import org.apache.brooklyn.api.location.MachineDetails; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation; +import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.crypto.SecureKeys; +import org.apache.brooklyn.util.core.file.ArchiveUtils; +import org.apache.brooklyn.util.core.internal.ssh.SshException; import org.apache.brooklyn.util.core.internal.ssh.SshTool; import org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool; import org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.SshjToolBuilder; +import org.apache.brooklyn.util.core.task.BasicExecutionContext; +import org.apache.brooklyn.util.core.task.BasicExecutionManager; import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.net.Networking; +import org.apache.brooklyn.util.net.Urls; +import org.apache.brooklyn.util.os.Os; +import org.apache.brooklyn.util.stream.Streams; +import org.apache.brooklyn.util.time.Duration; +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.Charsets; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.io.Files; -public class SshMachineLocationIntegrationTest { +public class SshMachineLocationIntegrationTest extends SshMachineLocationTest { -protected TestApplication app; -protected ManagementContext mgmt; +private static final Logger LOG = LoggerFactory.getLogger(AbstractEntity.class); -@BeforeMethod(alwaysRun=true) -public void setup() throws Exception { -mgmt = LocalManagementContextForTests.builder(true) -.useDefaultProperties() -.build(); -app = TestApplication.Factory.newManagedInstanceForTests(mgmt); +@Override +protected BrooklynProperties getBrooklynProperties() { +// Requires location named "localhost-passphrase", which it expects to find in local +// brooklyn.properties (or brooklyn.cfg in karaf). +return BrooklynProperties.Factory.newDefault(); +} + +@Override +protected SshMachineLocation newHost() { +return mgmt.getLocationManager().createLocation(LocationSpec.create(SshMachineLocation.class) +.configure("address", Networking.getLocalHost())); } -@AfterMethod(alwaysRun=true) -public void tearDown() throws Exception { -if (mgmt != null) Entities.destroyAll(mgmt); -mgmt = null; +// Overridden just to make it integration (because `newHost()` returns a real ssh'ing host) +@Test(groups="Integration") +@Override +public void testSshExecScript() throws Exception { +super.testSshExecScript(); +} + +// Overridden just to make it integration (because `newHost()` returns a real ssh'ing host) +@Test(groups="Integration") +@Override +public void testSshExecCommands() throws Exception { +super.testSshExecCommands(); +} + +// Overridden just to make it integration (because `newHost()` returns a
[GitHub] brooklyn-server issue #445: Use subnet IP on machine locations that dont imp...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/445 @aledsage I updated `testFindSubnetHostnameFromLocation` and some other tests to use the private addresses --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #445: Use subnet IP on machine locations that d...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/445 Use subnet IP on machine locations that dont implement HasSubnetHostname The `SshMachineLocation` interface does *NOT* implement `HasSubnetHostname` but it does include the method `getPrivateAddresses()` which means that when something creates a machine and sets the config key `SshMachineLocation.PRIVATE_ADDRESSES` with the private IP then the `machines.getSubnetHostname(Location)` helper method (called during entity startup) will happily set the `SUBNET_HOSTNAME` attribute to the public IP (via `location.getAddress().getHostAddress()` You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server subnet-hostname-private-addresses Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/445.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #445 commit eb03f6276ffe36abc91fac07d317e9896ce9abd5 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-11-18T17:18:43Z Use subnet IP on machine locations that dont implement HasSubnetHostname --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #428: Adding new LocationEntity for creating lo...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/428 Adding new LocationEntity for creating location specific entities A new type that allows configuring different entities depending on the location being deployed to. Uses configuration like this: ```YAML - type: org.apache.brooklyn.entity.stock.LocationEntity brooklyn.config: location.entity.spec.default: $brooklyn:entitySpec: type: traefik-load-balancer location.entity.spec.aws-ec2: $brooklyn:entitySpec: type: elastic-load-balancer location.entity.spec.gce: $brooklyn:entitySpec: type: google-load-balancer ``` The map entries can also be class names like `JcloudsLocation` or ISO 3166 country codes like `UK`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server location-entity Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/428.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #428 commit 9943655ea24e29d25fd219bd899d2669b6ea88b9 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-11-11T00:45:58Z Adding new LocationEntity for creating location specific entities --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #408: Use actual config key if available in DSL
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/408 @aledsage your #410 looks good, so I will close this. I had not thought about the semantics of `get()` vs. `getImmediately()` and `getRaw()` etc. but the rationale for just checking for `Maybe.absent()` seems sound. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #408: Use actual config key if available in DSL
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/408 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #408: [TMP] Use actual config key if available ...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/408 [TMP] Use actual config key if available in DSL Attempting to fix issue where config defined in `brooklyn.parameters` is resolved as `null` instead of using the default value, when used inside a transformer. This appears to be a race condition or related to use of `getImmediately()` since the issue disappears when investigated with a debugger. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server transformer-config-nulls Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/408.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #408 commit 3d8c3d064a3bacb2fcada70799d86a2ca42cd7a0 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-11-06T01:40:38Z Use actual config key if available in DSL --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #279: Allow provisioning.properties to referenc...
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/279 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #282: Added attribute to DSL for immediate return of s...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/282 @ahgittin @aledsage closing this, based on feedback from mailing list --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #337: Add config inheritance to customizers key
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/337 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #337: Add config inheritance to customizers key
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/337 @ahgittin understood; i will work on the change you suggest instead. closing this for now --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #282: Added attribute to DSL for immediate retu...
Github user grkvlt closed the pull request at: https://github.com/apache/brooklyn-server/pull/282 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #279: Allow provisioning.properties to referenc...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/279#discussion_r79716634 --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java --- @@ -49,6 +50,68 @@ import javax.annotation.Nullable; import javax.xml.ws.WebServiceException; +import org.apache.commons.lang3.ArrayUtils; --- End diff -- BTW, my ordering was to keep the `org.apache.brooklyn` and `io.brooklyn` and `brooklyn` imports at the bottom, with more generic imports above. But, whatever, am happy to use the standard, have changed my IDE config. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #337: Add config inheritance to customizers key
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/337 Add config inheritance to customizers key Enables merging of customizsers for locations. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server customizers-inheritance Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/337.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #337 commit 00ccf22c655033602b47ff2564e1a54e0f0fffca Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-09-20T21:23:24Z Add config inheritance to customizers key --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #279: Allow provisioning.properties to referenc...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/279#discussion_r79714457 --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java --- @@ -49,6 +50,68 @@ import javax.annotation.Nullable; import javax.xml.ws.WebServiceException; +import org.apache.commons.lang3.ArrayUtils; --- End diff -- I have done this for all my Brooklyn projects now, thanks for the pointer, @ahgittin --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #281: Prevent VanillaSoftwareProcess commands from bei...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/281 @aledsage @ahgittin I'm not sure if your proposal will still allow the behaviour now relied on by Kubernetes, for example, where children of a `VanillaSoftwareProcess` do *not* want to see the parent's config. Is this still going to work? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #321: Added configuration for template substitution va...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/321 Yes, I used it like `${config['template.substitutions]['key1']}` which is equivalent, I think. But if you add in the map explicitly, then you could just say `${key1}` in the template file, which is _much_ neater. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/317 @Graeme-Miller happy to merge once you cherry-pick https://github.com/neykov/brooklyn-server/commit/62613c05c2ba08c3ad9055d1fa3006f100a58b38 into this PR as well --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #322: Adds a TargetServerEntity for improved co...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/322 Adds a TargetServerEntity for improved command sequencing in YAML Circumstances often arise where a controlling server must start up, then some clients or slaves elsewhere that connect to it, finally some process on the main server should be executed that relies on the availability of the client machines. This cannot be done using only `pre.launch.command` and `post.launch.command` or setting latches, since all commands will execute before `service.isUp` is set. This enables another entity to be created, that will execute its own lifecycle and commands, but using the same location (i.e. machine) as some other entity. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server target-server-entity Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/322.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #322 commit b47d828aaf1e52084b21de8300dad4d901c44921 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-09-06T23:54:52Z Adds a TargetServerEntity for improved command sequencing in YAML --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #321: Added configuration for template substitu...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/321 Added configuration for template substitution variable map Adds a new `ConfigKey<Map>` to allow setting further template variable substitutions in YAML. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server add-template-substitutions-config Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/321.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #321 commit 064f578d7b379e1e367a16b4fef9893d588a71e0 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-09-06T23:53:00Z Added configuration for template substitution variable map --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #313: Adds deprecated decorate method to preser...
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/313 Adds deprecated decorate method to preserve backwards compatibility Adds `#decorate(EntitySpec, ConfigBag)` as an overloaded deprecated method in `BrooklynEntityDecorationResolver` interface, for backwards compatibility. See https://github.com/cloudsoft/brooklyn-tosca/pull/113 You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server add-deprecated-decorate-method Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/313.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #313 commit 886538cfe97fe3534d754714f7127724787ee6ee Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-08-31T00:25:09Z Adds deprecated decorate method to preserve backwards compatibility with BrooklynEntityDecorationResolver --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #280: Add special flag decoration to parameters to ena...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/280 @aledsage @neykov I'm going to merge this now, as the tests have been added as requested and are passing --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #280: Add special flag decoration to parameters...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/280#discussion_r76539720 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -180,20 +182,23 @@ protected void addDecorationFromJsonMap(Map decorationJson, List> { +private Function<Object, Object> transformer; + protected SpecParameterResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { super(instantiator); } @Override protected String getDecorationKind() { return "Spec Parameter initializer"; } @Override -public void decorate(EntitySpec entitySpec, ConfigBag attrs) { +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +transformer = new BrooklynComponentTemplateResolver.SpecialFlagsTransformer(instantiator.loader, encounteredRegisteredTypeIds); --- End diff -- Unfortunately not, it would involve essentially duplicating the code in `parseParameter` which I don't think we should do. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #281: Prevent VanillaSoftwareProcess commands from bei...
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-server/pull/281 @aledsage I added the tests you suggested, and updated the failing test pointed out by @sjcorbett so I think this should be able to be merged now --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #310: Child entity customizer
GitHub user grkvlt opened a pull request: https://github.com/apache/brooklyn-server/pull/310 Child entity customizer Extends the jclouds location customizer to be a `BasicConfigurableObject` allowing better configuration etc. when created using `$brooklyn:object` in the DSL, and add a new `ChildEntityCustomizer` that creates a child entity before the main entity has started up, allowing more flexible configuration. You can merge this pull request into a Git repository by running: $ git pull https://github.com/grkvlt/brooklyn-server child-entity-customizer Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/310.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #310 commit de8f69612eb90e7d9593170663cd21014fc0c274 Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-08-13T20:25:41Z Update BasicJcloudsLocationCustomizer to be configurable and remove deprecated methods commit 0fcacedfe17456dd7274be8aed3ee5bc926b0f0a Author: Andrew Donald Kennedy <andrew.kenn...@cloudsoftcorp.com> Date: 2016-08-13T20:26:12Z Add new location customizer that creates child entities early --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-library issue #62: BIND DNS improvements
Github user grkvlt commented on the issue: https://github.com/apache/brooklyn-library/pull/62 LGTM, can be merged once the `listen-on port` lines are fixed --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-library pull request #62: BIND DNS improvements
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-library/pull/62#discussion_r76402034 --- Diff: software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java --- @@ -222,17 +227,35 @@ public void update() { Multimap<String, String> aRecordToCnames = MultimapBuilder.hashKeys().hashSetValues().build(); Multimap<String, String> ipToAllNames = MultimapBuilder.hashKeys().hashSetValues().build(); -for (Map.Entry<String, Entity> e : hostnameToEntity.entries()) { -String domainName = e.getKey(); -Maybe location = Machines.findUniqueMachineLocation(e.getValue().getLocations(), SshMachineLocation.class); -if (!location.isPresent()) { -LOG.debug("Member {} of {} does not have an SSH location so will not be configured", e.getValue(), this); -continue; -} else if (ipToARecord.inverse().containsKey(domainName)) { +for (Map.Entry<String, Entity> entry : hostnameToEntity.entries()) { +String domainName = entry.getKey(); +Entity entity = entry.getValue(); + +String address = null; + +AttributeSensor addressSensor = getConfig(ADDRESS_SENSOR); +if (addressSensor!=null) { +address = entity.getAttribute(addressSensor); + --- End diff -- Remove blank line --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-library pull request #62: BIND DNS improvements
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-library/pull/62#discussion_r76401931 --- Diff: software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.conf --- @@ -20,14 +20,15 @@ // Generated by Brooklyn on ${.now?string.short} // options { -listen-on port ${entity.dnsPort} { 127.0.0.1; ${driver.address}; }; +// listen-on default is all interfaces +// listen-on port ${entity.dnsPort} { 127.0.0.1; ${driver.address}; ${driver.subnetAddress}; }; --- End diff -- would prefer `listen-on port ${entity.dnsPort} { any; };` to be explicit, and allow changing port number, then. same for IPV6 as `listen-on-v6 port ${entity.dnsPort} { any; };` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #308: Invoke on sensor and ssh to multiple
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/308#discussion_r76399739 --- Diff: core/src/main/java/org/apache/brooklyn/entity/group/SshCommandMembershipTrackingPolicy.java --- @@ -61,11 +64,16 @@ * executed. This can be one of: the {@link ExecutionTarget#ENTITY owing entity}; * the {@link ExecutionTarget#MEMBER member} that was updated; or * {@link ExecutionTarget#ALL_MEMBERS all members} of the group. + * + * @deprecated introduced and removed in 0.10.0-snapshot; use a combination of + * InvokeEffectorOnSensorChange and SshCommandEffector instead + * (much simpler semantics as you normally will want to listen to a local sensor + * (which in turn is aggregated over members) instead of children sensors directly). + * If there is a need for {@link #EVENT_TYPE} or {@link #MEMBER_ID} then we'll want + * InvokeEffectorOnSensorChange to be able to subscribe to members/children etc as well, + * and pass parameters based on source.entityId and source.sensor. */ -// TODO might make sense to split up behaviour into two classes, -// an InvokeEffectorMembershipTrackingPolicy and an SshMultiEntityCommandEffector -- -// where the latter has the configurable target introduced here -@Beta +@Deprecated --- End diff -- Actually, this could be safely removed, since the only usage of it has been updated to use the new policy defined here. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #304: Adds a target configuration to the SSH co...
Github user grkvlt commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/304#discussion_r75693969 --- Diff: core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java --- @@ -196,7 +196,11 @@ "entity.group.added", "Group dynamically added to entity"); public static final BasicNotificationSensor GROUP_REMOVED = new BasicNotificationSensor(Group.class, "entity.group.removed", "Group dynamically removed from entity"); - + +public static final AttributeSensor ENTITY_ID = Attributes.ENTITY_ID; +public static final AttributeSensor APPLICATION_ID = Attributes.APPLICATION_ID; +public static final AttributeSensor CATALOG_ID = Attributes.CATALOG_ID; --- End diff -- Probably a nice idea to have a default key, though - will add that. But can just set it as `ENTITY_ID` I guess? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---