You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Chamila De Alwis <ch...@wso2.com> on 2015/02/24 08:49:55 UTC

[Discuss] Cartridge Agent Extensions Naming Convention

Hi,

In the cartridge agent (both Java and Python implementations), the
extensions have a unique name that is mentioned in the configuration given
to the agent when starting up (Java - stratos.sh, Python - agent.conf)

# extension file name specified in agent.conf

extension.instance.started            =instance-started.sh
extension.start.servers               =start-servers.sh
extension.instance.activated          =instance-activated.sh
extension.artifacts.updated           =artifacts-updated.sh
extension.clean                       =clean.sh
extension.mount.volumes               =mount_volumes.sh


# agent.conf key name specified in a constants file

INSTANCE_STARTED_SCRIPT = "extension.instance.started"
START_SERVERS_SCRIPT = "extension.start.servers"
INSTANCE_ACTIVATED_SCRIPT = "extension.instance.activated"
ARTIFACTS_UPDATED_SCRIPT = "extension.artifacts.updated"
CLEAN_UP_SCRIPT = "extension.clean"
MOUNT_VOLUMES_SCRIPT = "extension.mount.volumes"


# extension file name queried using the constant

script_name = cartridge_agent_config.read_property(cartridgeagentconstants.INSTANCE_STARTED_SCRIPT,
False)

IMO, this kind of a flexibility is not needed in the case of extension
script names. Especially now that Python cartridge agent is pluggable with
many to many relationship for events and plugins.

If we rename the extensions to match the event names corresponding to them,
it will be both easier and will involve less messy code to execute the
extensions.

Was there a specific reason to implement the extension execution this way
at the time?

Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: [Discuss] Cartridge Agent Extensions Naming Convention

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Udara,

An event name change has to be reflected anyway in the code. The event
handlers also have to be changed accordingly. Furthermore, any change
related to events, additions, removals will also have to be reflected on
extensions themselves. IMO changing the name convention doesn't necessarily
affect this scenario.


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com



On Tue, Feb 24, 2015 at 1:24 PM, Udara Liyanage <ud...@wso2.com> wrote:

> Hi Chamila,
>
> May be the reason that event name can be change in future, if so
> extensions name also have to be changed.
>
> On Tue, Feb 24, 2015 at 1:19 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> Hi,
>>
>> In the cartridge agent (both Java and Python implementations), the
>> extensions have a unique name that is mentioned in the configuration given
>> to the agent when starting up (Java - stratos.sh, Python - agent.conf)
>>
>> # extension file name specified in agent.conf
>>
>> extension.instance.started            =instance-started.sh
>> extension.start.servers               =start-servers.sh
>> extension.instance.activated          =instance-activated.sh
>> extension.artifacts.updated           =artifacts-updated.sh
>> extension.clean                       =clean.sh
>> extension.mount.volumes               =mount_volumes.sh
>>
>>
>> # agent.conf key name specified in a constants file
>>
>> INSTANCE_STARTED_SCRIPT = "extension.instance.started"
>> START_SERVERS_SCRIPT = "extension.start.servers"
>> INSTANCE_ACTIVATED_SCRIPT = "extension.instance.activated"
>> ARTIFACTS_UPDATED_SCRIPT = "extension.artifacts.updated"
>> CLEAN_UP_SCRIPT = "extension.clean"
>> MOUNT_VOLUMES_SCRIPT = "extension.mount.volumes"
>>
>>
>> # extension file name queried using the constant
>>
>> script_name = cartridge_agent_config.read_property(cartridgeagentconstants.INSTANCE_STARTED_SCRIPT, False)
>>
>> IMO, this kind of a flexibility is not needed in the case of extension
>> script names. Especially now that Python cartridge agent is pluggable with
>> many to many relationship for events and plugins.
>>
>> If we rename the extensions to match the event names corresponding to
>> them, it will be both easier and will involve less messy code to execute
>> the extensions.
>>
>> Was there a specific reason to implement the extension execution this way
>> at the time?
>>
>> Regards,
>> Chamila de Alwis
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>

Re: [Discuss] Cartridge Agent Extensions Naming Convention

Posted by Udara Liyanage <ud...@wso2.com>.
Hi Chamila,

May be the reason that event name can be change in future, if so extensions
name also have to be changed.

On Tue, Feb 24, 2015 at 1:19 PM, Chamila De Alwis <ch...@wso2.com> wrote:

> Hi,
>
> In the cartridge agent (both Java and Python implementations), the
> extensions have a unique name that is mentioned in the configuration given
> to the agent when starting up (Java - stratos.sh, Python - agent.conf)
>
> # extension file name specified in agent.conf
>
> extension.instance.started            =instance-started.sh
> extension.start.servers               =start-servers.sh
> extension.instance.activated          =instance-activated.sh
> extension.artifacts.updated           =artifacts-updated.sh
> extension.clean                       =clean.sh
> extension.mount.volumes               =mount_volumes.sh
>
>
> # agent.conf key name specified in a constants file
>
> INSTANCE_STARTED_SCRIPT = "extension.instance.started"
> START_SERVERS_SCRIPT = "extension.start.servers"
> INSTANCE_ACTIVATED_SCRIPT = "extension.instance.activated"
> ARTIFACTS_UPDATED_SCRIPT = "extension.artifacts.updated"
> CLEAN_UP_SCRIPT = "extension.clean"
> MOUNT_VOLUMES_SCRIPT = "extension.mount.volumes"
>
>
> # extension file name queried using the constant
>
> script_name = cartridge_agent_config.read_property(cartridgeagentconstants.INSTANCE_STARTED_SCRIPT, False)
>
> IMO, this kind of a flexibility is not needed in the case of extension
> script names. Especially now that Python cartridge agent is pluggable with
> many to many relationship for events and plugins.
>
> If we rename the extensions to match the event names corresponding to
> them, it will be both easier and will involve less messy code to execute
> the extensions.
>
> Was there a specific reason to implement the extension execution this way
> at the time?
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897