Skip to main content
DevOps icon showing cogs

This post is from the XebiaLabs blog and has not been updated since the original publish date.

Last Updated Jan 12, 2015 — DevOps Expert

Compute Property Values With Rules

DevOps

A quick tip I used to help a customer. They've defined 2 extra properties on their host to help them to compute container's properties (eg home). It works fine for the generic-plugin based middleware (eg tomcat.home="${container.host.envRootPath}/var/wildfly/${container.instanceId}") but not for other plugins based not based on the generic plugin. My first answer was to create a cli script that performs the computation and update the configuration items according to the expected definition but the Ops team needs to switch to another tools. My next answer was to define a control task that can called from the UI but typically the 'repositoryService' is not injected in the script's context: impossible to update the configuration item's values. So I found out the following solution: define a rule that perform the computation using a pre-plan processor and a python script:

<rule name="compute.jboss.home.context" scope="pre-plan">
<planning-script-path>compute/jbosshome.py</planning-script-path>
</rule>
And the python script 'compute/jbosshome.py' is :
def jboss_containers():
    return filter(lambda ci: str(ci.type) == 'jbossdm.StandaloneServer', deployedApplication.environment.members)
for container in jboss_containers():
    if not container.home.startswith('/'):
        print "---- processing %s " % container
        print "processing host %s " % container.host
        home = "%s/var/wildfly/wf-%s" % (container.host.envRootPath, container.host.envCode)
        container.home = home
        repositoryService.update(container.id, container)
The main advantage: no need to think to trigger any extra commands or control tasks: the computation is performed during the planning phase executed when XLDeploy generates the deployment tasks.xl-rules rulez !!!

More from the Blog

View more
Ascension Launch Banner
Apr 26, 2022

Get ready for peak performance with Digital.ai’s newest AI-Powered DevOps Platform Ascension Release

DevOps
Today, Digital.ai is excited to announce our latest AI-Powered DevOps ...
Read More
Jan 24, 2022

Digital.ai Value Stream Delivery for SAFe®: The key to amazing business outcomes

DevOps
The Scaled Agile Framework (SAFe) is the world’s leading framework for ...
Read More
Dec 09, 2021

How SaaS and cloud-based solutions helped the U.S. Department of Veterans Affairs achieve digital transformation

DevOps
Modernizing legacy systems was an ongoing goal for the U.S. Department ...
Read More
Nov 29, 2021

Increase velocity and reduce risk with AI and machine learning

DevOps
Artificial Intelligence (AI) and machine learning (ML) have proven use ...
Read More
Contact Us