The Python deployment command

To deploy the application artifacts from a z/OS® environment to a target z/OS environment, use the Wazi Deploy Python translator. You run this translator by starting the wazideploy-deploy command.

Installation requirements

Wazi Deploy and its prerequisites must be installed, as it is explained in the installation requirements.

Check before the deployment

The IBM Z Open Automation Utilities (ZOAU) version must be greater than or equal to 1.3.4.0. If this is not the case, the deployment stops.

Configuration check

The correct environment variables for the IBM® Python SDK and ZOAU must be set. You can copy and paste the following lines and adapt them to your z/OS environment.
# ZOAU/Python
export _BPXK_AUTOCVT=ON
# ZOAU
export ZOAU_HOME=/usr/lpp/IBM/zoautil
export PATH=${ZOAU_HOME}/bin:$PATH
export LIBPATH=${ZOAU_HOME}/lib:${LIBPATH}
#Python
export PATH=/usr/lpp/IBM/cyp/v3r11/pyz/bin:$PATH
export LIBPATH=/usr/lpp/IBM/cyp/v3r11/pyz/lib:$LIBPATH
export _CEE_RUNOPTS='FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt

Syntax of the Wazi Deploy Python command

The following code shows the syntax of the command.
usage: wazideploy-deploy [-h] -dp deploymentPlan [-pif packageInputFile] -ef envFile -wf workingFolder [-efn evidencesFileName] [-affn artifactsFilterFileName] [-dr] [-e extraVars [extraVars ...]] [-pt planTags] [-pst planSkipTags] [-d] [-v]

Python Deployer

options:
  -h, --help            show this help message and exit
  -dp deploymentPlan, --deploymentPlan deploymentPlan
                        The deployment plan to use
  -pif packageInputFile, --packageInputFile packageInputFile
                        The package to deploy
  -ef envFile, --envFile envFile
                        The target environment file properties
  -wf workingFolder, --workingFolder workingFolder
                        The path to the working folder
  -efn evidencesFileName, --evidencesFileName evidencesFileName
                        The evidences file name
  -affn artifactsFilterFileName, --artifactsFilterFileName artifactsFilterFileName
                        The artifacts filter file name
  -dr, --dryRun         Dry run
  -e extraVars [extraVars ...], --extraVars extraVars [extraVars ...]
                        Extra variables
  -pt planTags, --planTags planTags
                        Only handle activities, actions and steps in the deployment plan tagged with these values (comma separated list)
  -pst planSkipTags, --planSkipTags planSkipTags
                        "Only handle activities, actions and steps in the deployment plan whose tags do not match these values (comma separated list)
  -d, --debug           Verbose output
  -v, --version         Print product version and exit
The following table describes the arguments of the wazideploy-deploy command. Each argument has a long name and a short name, which are equivalent.
Table 1. Arguments of the command line
Argument long name Argument short name Description Required
--help -h The command line help. No
--deploymentPlan -dp
The path to the generated deployment plan.
Yes
--packageInputFile -pif
The absolute path to the input .tar package file to deploy.

If the deployment corresponds to deletions only, the package file does not exist. In this case, do not specify this argument.

No
--envFile -ef
The absolute path to the Python environment variables file that the Python building blocks use.

The name of the Python environment variables file is calculated.

Yes
--evidencesFileName -efn
The path name to the evidence file that is created by the execution of the Python building blocks.
No
--artifactsFilterFileName -affn
The path to the YAML file that contains deployment filters to exclude or include artifacts in the deployment phase.
No
--workingFolder -wf
The path to the working folder.
Yes
--dryRun -dr
Validation of the deployment requirements before the deployment command runs.

It checks that all the Python building blocks that implement the deployment steps are available and that values are assigned to their variables.

If the dry run detects inconsistencies, the deployment does not start and an error is raised.

No
--extraVars -e Variables to be added to the environment variables file. You can enter more than one --extraVars argument.
For each --extraVars argument, enter the following line:
--extraVars myvar=myvalue

Replace myvar with the variable name and myvalue with the variable value.

These variables are available in the environment variables file in the following format:
 {{ myvar }}

You can enter --extraVars multiple times to add multiple variables.

You can also pass extraVars in a YAML file. To do this, enter the following option:
--extraVars @myvar.yml
No
--planTags -pt
The values that are used to include activities, actions, and steps in the deployment.

These values are specified in the tags of The deployment method. If you specify one or more values in this argument, only the activities, actions, and steps that are tagged with these values in the generated deployment plan are handled in the deployment.

If you specify a list of tag values, you must separate them with commas.

No
--planSkipTags -pst
The values that are used to exclude activities, actions, and steps from the deployment.

These values are specified in the tags of The deployment method. If you specify one or more values in this argument, the activities, actions, and steps that are tagged with these values in the generated deployment plan are excluded from the deployment.

If you specify a list of tag values, you must separate them with commas.

No
--debug -d
Verbose output.
No
--version -v The Wazi Deploy version. No
The following code is a sample of the Wazi Deploy deployment command with the Python translator:
wazideploy-deploy\
   --deploymentPlan inputs/deployment_plan.yml\
   --packageInputFile inputs/package.tar\
   --envFile inputs/environment_zos.yml\
   -efn outputs/evidence.yaml\
   --workingFolder work

Create custom Jinja2 filters

Jinja2 comes with a predefined sets of builtin filters and functions:
You can add your own Jinja2 filters. To do this, set the DEPLOY_FILTERS_PATH environment variable just before the invocation of the wazideploy-deploy command. The DEPLOY_FILTERS_PATH contains the list of comma-separated folders where your own Jinja2 filters reside. Example:
export DEPLOY_FILTERS_PATH=/global/filters
Here is an example of a Jinja2 filter. You can save it to /global/filters/now.py:
from datetime import datetime
def now(*args):
    return datetime.now().strftime(args[0])
You can call it in your Jinja2 template with the following line:
{{ '%Y-%m-%d %H:%M:%S' | now () }}