Package: ws-copy-policy
[!Warning]This repository has been deprecated. We will not be making any changes or enhancements to this repository. If you are actively using this utility. Please contact your Customer Success Manager to get in touch with a Mend Professional Services Engineer to discuss possible alternative solutions.Mend copy policy toolThe script allows copying policies automatically, from the template project/product to the newly created projects/products, and update existing projects with the template policy.
It should run periodically, in order to make sure that all the policies under the required projects/products are up to date.How to use the scriptCreate an empty project/product or few with the required template policy.Tag an empty project/product with the following project tag:key=Policy.Template.Source,  value=<yourUniqueTemplateName>.For a new project/product creation that requires the template policy, add the following project/product tag:key=Policy.Template.Destination, value=<yourUniqueTemplateName>. It can be added via the UI or as part of the Unified Agent run.The template policy will be updated for the required projects/products.Note:Make sure that the tagPolicy.Template.Sourcevalue is unique and is presented only in one project/product.What does the script do?For each project/product in the system, the script extracts the Tag key called:Policy.Template.Source, and the tag key calledPolicy.Template.Destination.
In the event, the tag value of the project/product withPolicy.Template.Sourcetag key equals the tag value of the project/product withPolicy.Template.Destinationtag key, the script will do the following:Delete the existing policies from the project/product withPolicy.Template.Destinationtag key.Copy the project/product policies of the project/product withPolicy.Template.Sourcetag key to the project/product withPolicy.Template.Destinationtag key.Supported Operating SystemsLinux (Bash):CentOS, Debian, Ubuntu, RedHatWindows (PowerShell):10, 2012, 2016PrerequisitesPython 3.9 or aboveInstallation and Execution by pulling package from PyPi:Executepip install ws-copy-policyNote:  If installing packages as a non-root be sure to include the path to the executables within the Operating System paths.Run report:ws-copy-policy --wssURL <URL> --userKey <USER_KEY> --apiKey <ORG_TOKEN> --scope <COPY_SCOPE> --thread <THREAD_NUMBER>orws-copy-policy <CONFIG_FILE_PATH>Note:  If installing packages as a non-root be sure to include the path to the executables within the Operating System paths.Configuration Parameters===============================================================================================================
| Group         | Parameter            | Description                                                          |
===============================================================================================================
| DEFAULT       | wssUrl                | Mend server URL. Can be found under the 'Integrate' tab in          |   
|               |                      | your Mend organization under Server URL:                             |
|               |                      | https://<domain>.whitesourcesoftware.com                             |
---------------------------------------------------------------------------------------------------------------
| DEFAULT       | userKey              | Mend User Key. Can be found under the 'Profile' section in           |
|               |                      | your Mend organization.                                              |
---------------------------------------------------------------------------------------------------------------
| DEFAULT       | apiKey               | Mend API Key. Can be found under the 'Integrate' tab in your         |
|               |                      | your Mend organization.                                              |
---------------------------------------------------------------------------------------------------------------
| DEFAULT       | scope                | The scope where the copying policies should be performed on.         |
|               |                      | Possible values: project/product.                                    |
---------------------------------------------------------------------------------------------------------------
| DEFAULT       | thread               | Multi-threading - speeds up the copying, but it depends              |
|               |                      | on your environment capabilities (default: 5).                       |
===============================================================================================================AuthorMend.io ©