CliQr is now part of Cisco Learn More About Cisco

Parameter Substitution

Overview

You need to modify the configuration file (or script) or the property file for your application to include CloudCenter-defined macros so these macros automatically plugin the appropriate values for each parameter inside the configuration file/script. These parameters cover cases where the users may not know settings and value in advance and rely on the underlying infrastructure or environment or system to generate the value once the application is deployed. Different profiles may need different system macros.

Substitute Parameters at Deployment Time

Sometimes, you may have a custom parameter already defined in a particular service that you do not want to set in the application profile. Instead, you want to leave it to your end users to set this parameter when they deploy the application.

The CloudCenter platform allows you to substitute such parameters at deployment time.

To substitute custom parameters at deployment time, follow this process.

  1. Define a custom parameter in the Application Profile.
  2. Verify that this parameter has the same name as the parameter defined in the service of choice.
  3. When end users deploy the application, they can enter the parameter value required for this deployment and override the default value defined in the service.

Substitute Parameters with Macros

To substitute a user-defined parameter with a macro, follow this process:

  1. Add a new custom parameter (provide a parameter name, display name, description, type, and an optional default value for this parameter).
  2. Use the parameter name to reference this parameter inside a script or configuration file as a macro using the CloudCenter platform convention. For example:
    • Parameter name: myParameterName
    • Macro reference for this parameter: %myParameterName%
  3. Reference the macro inside the Application Profile.
  4. If the parameter is editable, the person executing the deployment for this application is queried for the parameter value.

Macro Substitution Examples

Some valid use cases of how the macro is replaced by the value specified in the parameter are provided in the following examples.

See Deployment Lifecycle Scripts for additional details on using scripts.

Pass the Macro

Pass the macro as an Argument in a Specified Script

Insert Macro in Configuration File

Insert the macro (in this case, the %DB_TIER_IP% macro) in a configuration file, if used. Here the private IP address of the database tier is replaced by the parameter value. Refer to a custom tier.

Refer to a Custom Tier from the Script

Refer to a custom tier (DB, in the following example) directly from the script by referencing a parameter (private IP address of the DB tier) that is passed as an environment variable ($CliqrTier_DB_IP) to the cloud during orchestration:

#create config file put in DB IP and change permissions
sudo cp $APP_DIR/openerp/openerp-server.conf /etc/
sudo sed -i "s/DB_IP/$CliqrTier_DB_IP/g" /etc/openerp-server.conf

Next, call the configuration file (with the defined variable) from the Application Profile:

 

Parameter and Marco Usage Examples

The following examples provide use cases of how the CloudCenter-defined parameters replace the value specified in the parameter.

Automate IP Address Configuration

Use the IP address parameters to automate IP address configuration inside configuration files. See Configuration Files for further details.

Automate Job Picking

Use the TASK_INDEX variable to automate the task of picking the right jobs for batch computing tasks. For example:

query%TASK_INDEX%_result.txt

picks the following files for each task execution:

  • query1_result.txt
  • query2_result.txt
  • And so forth

Define Path in Initialization Script

Use the %APP_DIR% macro in the initialization script to define the right path (user-defined or marketplace path) for each application:

sudo %APP_DIR%/openerp/setup-openerp.sh -APP_DIR %APP_DIR%

The runtime application binaries pick the applicable path automatically. See Deployment Lifecycle Scripts > Script Source Details for additional context.

Replace Deployment Environment

Use the %CliqrDepEnvName% macro to replace the deployment environment name during runtime. If you define the path for application binaries, script, or data files to be:

/global/collaborate/%CliqrDepEnvName% 

If the deployment environment is dev, the CloudCenter platform automatically selects the files from the following location at runtime:

/global/collaborate/dev at runtime.

Define Output Path Files

Use the %OUTPUT_DIR%/%DATE%%JOB_NAME% macros to define the path of output files. If you deploy a JMeter application with jmeter_001 job name and launch it on March 23rd, 2014, you can obtain the output/log files at:

/shared/output/20140322/jmeter_001

 

 

  • No labels