You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Andrew Kennedy <an...@cloudsoftcorp.com> on 2016/08/29 16:52:26 UTC

Command Config Inheritance

All,

I've run into an issue with the `SoftwareProcess` entities, where the
default inheritance settings for configuration keys like `install.command`
and so on mean that child entities do not behave as expected. Consider the
following blueprint:

services:
  - type: vanilla-software-process
    brooklyn.config:
      install.command: |
        wget http://example.org/archive.tgz
      customize.command: |
        tar zxf archive.tgz
        cp archive/foo /usr/bin
      launch.command: |
        foo --daemon
    brooklyn.children:
      - type: vanilla-software-process
        brooklyn.config:
          install.command: |
            yum install -y something
          launch.command: |
            bar --whatever

This looks like it will run 'foo' after extracting it from an archive we
download, then in a child entity we install a a package and run 'bar' as
well. However, the child entity will inherit configuration from its parent,
in particular it is going to get the 'customize.command' value set, which
will cause those commands to be executed, and then fail! The same will
happen with the resource and template configuration keys.

- https://github.com/apache/brooklyn-server/pull/281

The above pull request fixes this so that the expected (non-surprising)
behaviour happens instead, and in the child entity the `customize.command`
value will be blank. It does this by setting the config to only inherit
with the entity inheritance hierarchy, not the entity ownership
(parent-child)  hierarchy.

All tests are passing with this change, so I think it is safe to merge, but
would like to know if anyone thinks it will break their blueprints before I
do so.

Thanks,
Andrew.
-- 

Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft

Re: Command Config Inheritance

Posted by Aled Sage <al...@gmail.com>.
+1

Alex has merged this PR.

Aled


> On 29 Aug 2016, at 17:52, Andrew Kennedy <an...@cloudsoftcorp.com> wrote:
> 
> All,
> 
> I've run into an issue with the `SoftwareProcess` entities, where the default inheritance settings for configuration keys like `install.command` and so on mean that child entities do not behave as expected. Consider the following blueprint:
> 
> services:
>   - type: vanilla-software-process
>     brooklyn.config:
>       install.command: |
>         wget http://example.org/archive.tgz
>       customize.command: |
>         tar zxf archive.tgz
>         cp archive/foo /usr/bin
>       launch.command: |
>         foo --daemon
>     brooklyn.children:
>       - type: vanilla-software-process
>         brooklyn.config:
>           install.command: |
>             yum install -y something
>           launch.command: |
>             bar --whatever
> 
> This looks like it will run 'foo' after extracting it from an archive we download, then in a child entity we install a a package and run 'bar' as well. However, the child entity will inherit configuration from its parent, in particular it is going to get the 'customize.command' value set, which will cause those commands to be executed, and then fail! The same will happen with the resource and template configuration keys.
> 
> - https://github.com/apache/brooklyn-server/pull/281
> 
> The above pull request fixes this so that the expected (non-surprising) behaviour happens instead, and in the child entity the `customize.command` value will be blank. It does this by setting the config to only inherit with the entity inheritance hierarchy, not the entity ownership (parent-child)  hierarchy.
> 
> All tests are passing with this change, so I think it is safe to merge, but would like to know if anyone thinks it will break their blueprints before I do so.
> 
> Thanks,
> Andrew.
> -- 
> Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft