WS Copy Policy
Project description
WhiteSource copy policy tool
The script allows copying policies automatically, from the template project to the newly created projects, 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 are up to date.
How to use the script
- Create an empty project (projects) with the required template policy.
- Tag an empty project with the following project tag:
key=Policy.Template.Source, value=<yourUniqueTemplateName>
. - For a new project creation that requires the template policy, add the following project 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.
Note: Make sure that the tag
Policy.Template.Source
value is unique and is presented only in one project.
What does the script do?
For each project in the system, the script extracts the Tag key called: Policy.Template.Source
, and the tag key called Policy.Template.Destination
.
In the event, the tag value of the project with Policy.Template.Source
tag key equals the tag value of the project with Policy.Template.Destination
tag key, the script will do the following:
- Delete the existing policies from the project with
Policy.Template.Destination
tag key. - Copy the project policies of the project with
Policy.Template.Source
tag key to the project withPolicy.Template.Destination
tag key.
Supported Operating Systems
- Linux (Bash): CentOS, Debian, Ubuntu, RedHat
- Windows (PowerShell): 10, 2012, 2016
Prerequisites
- Python 3.5 or above
Installation
- Download and unzip ws-copy-policy.zip.
- From the command line, navigate to the ws_copy_policy directory and install the package:
pip install -r requirements.txt
. - Edit the params.config file and update the relevant parameters (see the configuration parameters below) or use a cmd line for running.
Execution
From the command line:
python ws-copy-policy.py -u $wsUrl -k $userKey -o $orgToken -s $scope -t $thread
Using a config file:
python ws-copy-policy.py
Note: If more than one version of Python is installed on the target machine, use the appropriate executables
for the installation and the execution (pip3
and python3
respectively)
Configuration Parameters
===============================================================================================================
| Group | Parameter | Description |
===============================================================================================================
| DEFAULT | wsUrl | WhiteSource server URL. Can be found under the 'Integrate' tab in |
| | | your WhiteSource organization. |
---------------------------------------------------------------------------------------------------------------
| DEFAULT | userKey | WhiteSource User Key. Can be found under the 'Profile' section in |
| | | your WhiteSource organization. |
---------------------------------------------------------------------------------------------------------------
| DEFAULT | orgToken | WhiteSource API Key. Can be found under the 'Integrate' tab in your |
| | | your WhiteSource organization. |
---------------------------------------------------------------------------------------------------------------
| DEFAULT | scope | The scope where the copying policies should be performed on. |
| | | Possible values: product/project. |
---------------------------------------------------------------------------------------------------------------
| DEFAULT | thread | Multi-threading - speeds up the copying, but it depends |
| | | on your environment capabilities (default: 5). |
===============================================================================================================
Author
WhiteSource Software ©
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for ws_copy_policy-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e8fe621482a41c7de2a9d92c6545d60d8108b60a7e79b3ab703f640431608c |
|
MD5 | 27651507494c73f8ed082ae3669b785c |
|
BLAKE2b-256 | 6a62b22b0739bd48958ba1b1c47141ed1a82a395ed2f5e05c3a4999de5632171 |