You can create a ZIP package that contains the Python script and dependencies used by your vRealize Automation Cloud Assembly extensibility actions.
There are two methods of building the script for your extensibility actions:
- Writing your script directly in the extensibility action editor in vRealize Automation Cloud Assembly.
- Creating your script on your local environment and adding it, with any relevant dependencies, to a ZIP package.
By using a ZIP package, you can create a custom preconfigured template of action scripts and dependencies that you can import to vRealize Automation Cloud Assembly for use in extensibility actions.
Furthermore, you can use a ZIP package in scenarios where modules associated with dependencies in your action script cannot be resolved by the vRealize Automation Cloud Assembly service, such as when your environment lacks Internet access.
You can also use a ZIP package to create extensibility actions that contain multiple Python script files. Using multiple script files can be useful for organizing the structure of your extensibility action code.
If you are using Python 3.3 or earlier, download and configure the PIP package installer. See Python Package Index.
- On your local machine, create a folder for your action script and dependencies.
For example, /home/user1/zip-action.
- Add your main Python action script or scripts to the folder.
For example, /home/user1/zip-action/main.py.
- (Optional) Add any dependencies for your Python script to the folder.
- Create a requirements.txt file that contains your dependencies. See Requirements Files.
- Open a Linux shell.
Note: The runtime of action-based extensibility in vRealize Automation Cloud Assembly is Linux-based. Therefore, any Python dependencies compiled in a Windows environment might make the generated ZIP package unusable for the creation of extensibility actions. Therefore, you must use a Linux shell.
- Install your requirements.txt file in the script folder by running the following command:
pip install -r requirements.txt --target=home/user1/zip-action
- In the assigned folder, select your script elements and, if applicable, your requirements.txt file and compress them to a ZIP package.
Note: Both your script and dependency elements must be stored at the root level of the ZIP package. When creating the ZIP package in a Linux environment, you might encounter a problem where the package content is not stored at the root level. If you encounter this problem, create the package by running the zip -r command in your command-line shell.
cd your_script_and_dependencies_folder zip -r ../your_action_ZIP.zip *