IBM PureApplication System IBM SmartCloud Application Services

Pattern-type (Part 20): Parametrize a plugin

Sometime, you would like to parametrize a plugin for example to add an activation key or other configuration parameters. The configuration will be done via the “System Plug-ins” menu.This will be achieved by the following steps:
1) Create a config_meta.json file.
2) Add the parameter in the config.json
3) Link the parameter with a part.
and as test we will setup the value via the “System Plug-ins” menu and then retrieve the parameter value in the

Create a config_meta.json file:

If you don’t create this file, you will not be able to setup the value via the “Systems Plug-ins” menu. What’s nice is that the PDK provides an editor for this file, so just create a new file called config_meta.json next to the config.json file. The editor opens:SCAWS Config Parm EditorIt is important to prefix the ID with “parms.” otherwise the link between the config_meta definition and the config.json will not work.

Add the parameter in the config.json:

Here we just have to add a “parms” object in the config.json file:

“parms”: {
“myPluginParam1”: “myDefaultValue”

The name of the parameter is the ID provided in the config_meta.json file without the prefix “parms.”.

Link the parameter with a part:

It is in the config.json that the different parts are defined for the plugin, as we want to be able to retrieve this parameter from the, we have to add it as parameter of the related part. So, let’s add the parms object:

“parts”: [
“part”: “parts\/pdktestplugin.scripts.tgz”,
“parms” : {
“MyPluginParam1”: “$myPluginParam1”

“parms”: {
“myPluginParam1”: “myDefaultValue”
The $myPluginParam1 reference the parameter “myPluginParam1” in the parms section.

Update the

In the related part, we will add few lines in the

logger = logging.getLogger("")
myPluginParm1 = maestro.parms['MyPluginParam1'];"MyPluginParam1 value =%s" % myPluginParm1);

Here we retrieve the “MyPluginParam1” which is the name of the part parameter in the config.json and then we log it.


Once you upload your plugin select it from the “System Plug-in” menu and click on the “configure” in the top right corner. A window will pop-up with your parameter and the default value, you can enter a new value.SCAWS Config Param Set ValueNow, launch a pattern which include your plugin, one the deployment is done, check the logs/install file:

[Sat 14 Sep 2013 04:19:55 AM EDT] 139867883955968 pid=9176 INFO MyPluginParam1 value =myNewDefaultValue

Leave a Reply

Your email address will not be published. Required fields are marked *