11# openshift-python-wrapper
22Pypi: [ openshift-python-wrapper] ( https://pypi.org/project/openshift-python-wrapper )
33A python wrapper for [ openshift-restclient-python] ( https://github.com/openshift/openshift-restclient-python ) with support for RedHat Container Virtualization. ([ Openshift Virtualization] ( https://www.openshift.com/learn/topics/virtualization ) )
4+ Docs: [ openshift-python-wrapper docs] ( https://openshift-python-wrapper.readthedocs.io/en/latest/ )
45
56## Installation
67From source:
@@ -14,22 +15,38 @@ From pypi:
1415pip install openshift-python-wrapper --user
1516```
1617
17- ## Bump a version number
18- * Create a PR
19- * Update setup.cfg:
20- Update version (for example: 1.5 -> 1.6) and
21- download_url (for example: https://github.com/RedHatQE/openshift-python-wrapper/archive/refs/tags/v1.6.tar.gz )
22- * Merge the PR
23- * Bump the version via [ Github] ( https://github.com/RedHatQE/openshift-python-wrapper/releases )
24- * Create a PR for changelog
25- * Generate CHANGELOG.md [ how-to] ( #changelog )
26- * Merge the PR
18+ ## Release new version
19+ ### requirements:
20+ * Export GitHub token
21+ ``` bash
22+ export GITHUB_TOKEN=< your_github_token>
23+ ```
24+ * [ release-it] ( https://github.com/release-it/release-it )
25+ ``` bash
26+ sudo npm install --global release-it
27+ npm install --save-dev @j-ulrich/release-it-regex-bumper
28+ rm -f package.json package-lock.json
29+ ```
30+ ### usage:
31+ * Create a release, run from the relevant branch.
32+ To create a 4.10 release, run:
33+ ``` bash
34+ git checkout v4.10
35+ release-it # Follow the instructions
36+ ```
2737
38+ ## docs
39+ Hosted on readthedocs.io [ openshift-python-wrapper] ( https://openshift-python-wrapper.readthedocs.io/en/latest/ )
40+
41+ ## PR dependency
42+ For PR dependency we use [ dpulls] ( https://www.dpulls.com/ )
43+ To make PR depends on other PR add ` depends on #<PR NUMBER> ` in the PR description.
44+
45+ ## Logging configuration
46+ To change log level export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL:
2847
29- ## changelog
30- Changelog is generated using [ github-changelog-generator] ( https://github.com/github-changelog-generator/github-changelog-generator )
3148``` bash
32- github_changelog_generator -u RedHatQE -p openshift-python-wrapper -t < TOKEN >
49+ export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL= < LOG_LEVEL > # can be: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
3350```
3451
3552## Examples
@@ -119,6 +136,21 @@ command_output = test_vmi.virt_launcher_pod.execute(command="command-example")
119136```
120137If no Pod was found, will raise `` ResourceNotFoundError `` .
121138
139+ ### NNCP Capture Syntax
140+ Using capture syntax to switch ipv4 config between interfaces
141+ ``` python
142+ with NodeNetworkConfigurationPolicy(
143+ name = " capture_nncp" ,
144+ capture = {' first-nic' : ' interfaces.name=="ens8"' ,
145+ ' second-nic' : ' interfaces.name=="ens9"' },
146+ teardown = False , # Capture doesn't support reverting config on teardown
147+ ...
148+ ) as nncp:
149+ nncp.add_interface(name = " {{ capture.first-nic.interfaces.0.name }} " , set_ipv4 = " {{ capture.second-nic.interfaces.0.ipv4 }} " )
150+ nncp.add_interface(name = " {{ capture.second-nic.interfaces.0.name }} " , set_ipv4 = " {{ capture.first-nic.interfaces.0.ipv4 }} " )
151+ yield nncp
152+ ```
153+
122154## Code check
123155We use pre-commit for code check.
124156``` bash
0 commit comments