uss_delete

This building block deletes artifacts from a z/OS® UNIX System Services directory.

It is run on the artifacts that are listed under the step that it implements in The deployment plan.

To trigger the execution of this building block, you can enter the following code in the deployment method from which the deployment plan is generated. See How to trigger the execution of a building block. The following code is an example.
actions:
    - name: DELETE ARTIFACTS FROM A USS DIRECTORY
      short_name: DELETE_FROM_USS
      steps:
      - name: TEST STEP FOR USS_DELETE
        short_name: TEST_USS_DELETE
        properties:
        - key: template
          value: uss_delete

types:
  - name: 'BIN'
  - name: 'TXT'
  - name: 'SH'
is_artifact: True

This building block is related to the following artifact types: UNIX or LINUX shell executable file, binary file, and text file in this example. However, it can be any type of artifact that you want to manage. The names that you give to these artifact types correspond to the extensions of these artifacts in the package file. You can freely choose these extension names.

To run correctly, this building block requires environment variables. Indicate them in a .yml file. Indicate The generic environment variables for the Ansible and Python building blocks and adapt their values to your target z/OS environment. Indicate also the variables that are specific to this building block.

The Ansible variables

To run this building block, indicate the following specific variables in an Ansible environment variables file:
uss_root_folder: '/tmp/wd_uss'

default_types: 'types'

types:
  - type: 'bin'
    uss: 
      dest: "{{ uss_root_folder }}/bin/"
      backup_dest: "{{ uss_root_folder }}/bin/back/"
      dest_mode: '0777'
      artifact_mode: '0755'
    is_binary: True
  - type: 'txt'
    uss: 
      dest: "{{ uss_root_folder }}/txt/"
      backup_dest: "{{ uss_root_folder }}/txt/back/"
      dest_mode: '0777'
      artifact_mode: '0755'
  - type: 'sh'
    uss: 
      dest: "{{ uss_root_folder }}/sh/"
      backup_dest: "{{ uss_root_folder }}/sh/back/"
      dest_mode: '0777'
      artifact_mode: '0755'

As you can see in this sample code, you must declare the variables related to the artifact type.

Enter the name of the root that lists the types and characteristics of the artifacts to be deployed, if the building block applies to artifacts. By default, the root name is types but you can enter any other name if you define a var_type property in the deployment method step that is implemented by the building block. See The types variable.

Under this root, create a type variable for each artifact type that relates to this building block in the generated deployment plan. The value of each artifact type comes from the deployment method, where it is freely chosen.

Enter the following variables for each type variable:

  • A uss variable with an embedded dest variable. In this dest variable, enter the whole path to the z/OS UNIX System Services directory to be deleted.
  • A rename_subs variable if you want to rename some artifacts for the deployment. Then, the building block will process these artifacts under names that are different from the names in the application package.
    In the following example, pattern and replace are regular expressions.
    - type: 'JCL'
      copy_by_folder: '{{default_copy_by_folder}}'
      pds:
        name: '{{ hlq }}.JCL'
        spec: "{{common_pds_text_spec}}"
        backup: '{{ hlq }}.BACK.JCL'
      encoding:
        from: UTF-8
        to: IBM-1047
      rename_subs:
      - pattern: "CDRD(.*)"
        replace: "CDRP\1"

The Python variables

To run this building block, indicate the following specific variables in a Python environment variables file. The whole path to this file is indicated in the --envFile argument of The Python deployment command.

uss_root: '/tmp/uss_root'
types:
  - pattern: .*.BIN$
    directory: "{{ uss_root }}/bin/"
    directory_backup: "{{ uss_root }}/bin/back/"
    dest_mode: 0777
    artifact_mode: 0755
    is_binary: True
  - pattern: .*.SH$
    directory: "{{ uss_root }}/sh/"
    directory_backup: "{{ uss_root }}/sh/back/"
    dest_mode: 0777
    artifact_mode: 0755
  - pattern: .*.TXT$
    directory: "{{ uss_root }}/txt/"
    directory_backup: "{{ uss_root }}/txt/back/"
    encoding:
      from: UTF-8
      to: IBM-1047
    dest_mode: 0777
    artifact_mode: 0755 
As you can see in this sample code, you must declare the variables related to the artifact type.

Enter the name of the root that lists the types and characteristics of the artifacts to be deployed, if the building block applies to artifacts. By default, the root name is types but you can enter any other name if you define a var_type property in the deployment method step that is implemented by the building block. See The types variable.

Under this root, create a pattern variable for each artifact type that relates to this building block in the deployment plan. The value of each artifact type comes from the deployment method, where it is freely chosen. A pattern is a regular expression that selects the artifacts from their path in The application manifest file.

Under each pattern variable, enter the following variables:
  • A directory variable with the whole path to the z/OS UNIX System Services directory to be deleted.
  • A rename_subs variable if you want to rename some artifacts for the deployment. Then, the building block will process these artifacts under names that are different from the names in the application package.
    In the following example, pattern and replace are regular expressions.
      - pattern: .\*.JCL$
        dataset: "{{ hlq }}.JCL"
        dataset_backup: "{{ hlq }}.BACK.JCL"
        spec: "{{ common_pds_txt_spec }}"
        encoding:
          from: UTF-8
          to: IBM-1047
        rename_subs:
        - pattern: "CDRD(.*)"
          replace: "CDRP\1"

Return values

The result of each building block task is displayed in the evidence file, in The results level that is embedded in step_result.