You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2014/06/24 22:52:45 UTC

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

GitHub user ahgittin opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/15

    entity initializers to define SSH sensors and effectors from yaml

    migration of https://github.com/brooklyncentral/brooklyn/pull/1446
    
    to review, start by looking at the documentation and the example therein, then look at the commits individually to see how it is built up

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ahgittin/incubator-brooklyn ssh-command-entity-initializers

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/15.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 #15
    
----
commit 1d2c6f78134493d9cd697d6388dac40e340ea1f2
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-02T13:18:34Z

    ensure effector tasks are always tagged appropriately, fixing bug where some direct invocations did not get tagged correctly and would be GC'd immediately on completion, and adding test

commit 81684acdc16cd3f0a59b310866f108cf725740a5
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-02T18:02:57Z

    env vars for ssh commands on task and in gui

commit 93e978412f4053b9bc388ad680cc6512acaafa8d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-02T18:50:53Z

    add an "only if service up" mode to several sensor feeds (the ones most likely to be configured ahead of time),
    and just-in-time inferene for ssh-feeds with test

commit b4687a5d0621d358447e976b860be5087b95072b
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-02T21:59:57Z

    don't include extra output in SshFeed calls

commit dc7620d69447dffdd80dcb69a19e5c380b15a894
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-02T22:00:30Z

    trim strings before coercing to numbers

commit f1c59ee3eaeacb7569a50eb8886be4d0b3d0765f
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-03T14:16:35Z

    add support for SshFeed to take a dynamic supplier of command and environment so that these can change (eg incorporating parameters server-side or setting shell env vars to latest sensor values), plus test

commit 5802c9dd27c65d0fbb516e4a453b90cb3f250d11
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-03T14:20:10Z

    entity-initializers for ssh commands (sensors and effectors) and framework for others we might want to set up, including parameters and period and env set for sensors

commit 8a0e3bcc33dc34026f241f04233cc04c1d9dc13b
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-03T15:34:59Z

    docs for entity intializers, ssh sensors and effectors, and example with nice integration test

commit 962ac535d82d986c622798d0ed853652a004e9fe
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-06-09T07:23:00Z

    comment tidy and remove some warnings

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#issuecomment-47211094
  
    Looks good. Only one extremely very minor comment, so will merge 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#issuecomment-47030110
  
    migration of PR https://github.com/brooklyncentral/brooklyn/pull/1446 to apache


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#issuecomment-47116404
  
    Thanks - missed that, will look now.
    
    --A


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/15


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#issuecomment-47114667
  
    @ahgittin any comments on the comments in the original https://github.com/brooklyncentral/brooklyn/pull/1446?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#issuecomment-47179677
  
    ready for re-review or merge


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: entity initializers to define SSH...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/15#discussion_r14234085
  
    --- Diff: core/src/test/java/brooklyn/entity/effector/EffectorTaskTest.java ---
    @@ -112,6 +118,72 @@ public void testSyntaxTwoDouble2() throws Exception {
             Assert.assertEquals(app.invoke(DOUBLE_2, MutableMap.of("numberToDouble", 3)).get(), (Integer)6);
         }
     
    +    @Test
    +    public void testEffectorImplTaggedCorrectly() throws Exception {
    +        Task<Integer> t = app.invoke(DOUBLE_2, MutableMap.of("numberToDouble", 3));
    +        t.get();
    +        checkTags(t, app, DOUBLE_2, true);
    +    }
    +
    +    public static final Effector<Integer> DOUBLE_CALL_ABSTRACT = Effectors.effector(Integer.class, "double_call")
    +        .description("doubles the given number")
    +        .parameter(Integer.class, "numberToDouble")
    +        .buildAbstract();
    +    public static final Effector<Integer> DOUBLE_CALL = Effectors.effector(DOUBLE_CALL_ABSTRACT)
    +        .impl(new EffectorBody<Integer>() {
    +            @Override
    +            public Integer call(ConfigBag parameters) {
    +                final Entity parent = entity();
    +                final Entity child = Iterables.getOnlyElement(entity().getChildren());
    +                
    +                final Effector<Integer> DOUBLE_CHECK_ABSTRACT = Effectors.effector(Integer.class, "double_check")
    +                    .description("doubles the given number and checks tags, assuming double exists as an effector here")
    +                    .parameter(Integer.class, "numberToDouble")
    +                    .buildAbstract();
    +                Effector<Integer> DOUBLE_CHECK = Effectors.effector(DOUBLE_CHECK_ABSTRACT)
    +                    .impl(new EffectorBody<Integer>() {
    +                        @Override
    +                        public Integer call(ConfigBag parameters) {
    +                            Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, null, false));
    +                            Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, DOUBLE_CHECK_ABSTRACT, false));
    +                            Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, DOUBLE_1, false));
    +                            Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, null, true));
    +                            Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, null, false));
    +                            Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, DOUBLE_CALL_ABSTRACT, true));
    +                            Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, DOUBLE_1, true));
    +                            
    +                            return entity().invoke(DOUBLE_1, parameters.getAllConfig()).getUnchecked();
    +                        }
    +                    }).build();
    +
    +                return child.invoke(DOUBLE_CHECK, parameters.getAllConfig()).getUnchecked();
    +            }
    +        }).build();
    +
    +
    +    @Test
    +    // also assert it works when the effector is defined on an entity
    --- End diff --
    
    Is this a comments about what the method does (because effector does `child.invoke(DOUBLE_CHECK...)`), or is it a TODO?
    If a comment, then change also "also asserts it works...`, and point folk at the line of `child.invoke`. If a todo, then prepend comment with `TODO `.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---