Skip to content

Commit dec9d5c

Browse files
andrewhughes101GitHub Enterprise
authored andcommitted
Merge pull request #209 from CICS/python-ansible-versions
Remove support for python < 3.9, Ansible < 2.14
2 parents 02bd1ee + 4652fda commit dec9d5c

15 files changed

+31
-301
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -60,129 +60,4 @@ You must use your real name and email address.
6060

6161
To save you having to type the above for every commit, Git can add the `Signed-off-by` line. When committing, add the `-s` option to your `git commit` command.
6262

63-
If you haven't signed each commit, then the pull request will fail to pass all checks.
64-
65-
# Development Environment Set-Up Instructions
66-
=============================================
67-
68-
This repository contains an Ansible collection, which is tested using `ansible-test`. This combination of development
69-
tooling requires you to clone the repository to a pretty specific path. As an example, clone the repository to:
70-
71-
```
72-
.../ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics
73-
```
74-
75-
`ansible-test` requires your project to exist in a FQCN-compatible folder structure following the Ansible Collections
76-
conventions. For details, see [this issue](https://github.com/ansible/ansible/issues/60215).
77-
78-
### Create a new virtual environment
79-
80-
Create a virtual environment in the checked out repository. The dir `venv3` is gitignored, and the rest of this
81-
documentation assumes you'll be using that as the name for your virtual environment:
82-
83-
```bash
84-
# Create a new venv called venv3
85-
python3 -m venv venv3
86-
87-
# Activate venv3
88-
source venv3/bin/activate
89-
90-
# Install dev-requirements
91-
pip install -r dev-requirements.txt
92-
```
93-
94-
#### Running the unit tests
95-
96-
You can use the `ansible-test` command to run all of the unit tests:
97-
```bash
98-
# Run unit tests
99-
ansible-test units --python=3.8
100-
```
101-
102-
#### Run Integration Tests
103-
104-
You can also use the `ansible-test` command to run all of the integration tests:
105-
106-
```bash
107-
# Run integration tests
108-
ansible-test integration --python=3.8
109-
```
110-
111-
### PyCharm set-up instructions
112-
113-
If you're planning on using a development environment such as PyCharm to develop `ibm_zos_cics`, you will need to
114-
load the bolded folder in the sample checkout path, in order that your development environment is able to resolve
115-
references to FQCN imports:
116-
117-
<code>.../<b>ibm_zos_cics</b>/ansible_collections/ibm/ibm_zos_cics</code>
118-
119-
#### Make your virtual environment the default Python interpreter for the project
120-
121-
Add the virtual environment as an existing Python interpreter:
122-
123-
- `Preferences > Project: cics-ansible > Python Interpreter > Cog menu > Add.. > {project_root}/ansible_collections/ibm/ibm_zos_cics/env/bin/python`
124-
125-
Set the virtual environment as the default Python interpreter:
126-
127-
- `Preferences > Project: cics-ansible > Python Interpreter > Top dropdown box > Select interpreter you just imported > Apply`
128-
129-
#### Python 2 support
130-
131-
The CMCI modules support running on Python 2.7. To ensure we maintain python 2.7 compatibility, you will also want to
132-
configure a Python 2.7 virtualenv:
133-
134-
```bash
135-
# Ensure virtualenv is installed
136-
python2.7 -m pip install virtualenv
137-
138-
# Create a new virtualenv called venv2
139-
python2.7 -m virtualenv venv2
140-
141-
# Activate venv2
142-
source venv2/bin/activate
143-
144-
# Install dev-requirements
145-
pip install -r dev-requirements.txt
146-
```
147-
148-
Note that a slightly different set of dev requirements is installed for python 2.7, as most of the static analysis tools in
149-
the automated build are run in python 3.8, so are not dev requirements for the python 2.7 environment.
150-
151-
#### Running the build, tests and static analysis locally
152-
153-
A bash script is provided to automate running the static analysis, and tests in both python 2.7 and python 3.8
154-
environments. You will need to have set up `venv`s as described above, with the dev-requirements pre-installed. You will
155-
then be able to run the build, passing the locations of the python 2.7 and python 3.8 `venv`s as environment variables:
156-
157-
```bash
158-
CMCI_PYTHON_38=./venv3 CMCI_PYTHON_27=./venv2 ./build.sh
159-
```
160-
161-
If you are running on Windows, you will need to run the automated build in a docker container produced by building the `Dockerfile` in this repository
162-
163-
#### Configure PyCharm to be able to run Ansible collection unit tests
164-
165-
First, add the `ansible_pytest_collections` plugin to `PYTHONPATH` for your python interpreter. This will be in your
166-
venv if you installed the dependencies using the dev requirements file:
167-
168-
- `Preferences > Project: cics-ansible > Python Interpreter > Cog menu > Show all >
169-
Select your interpreter > Show paths for the selected interpreter (at the bottom) > Plus >
170-
add the path to the 'ansible_test' 'pytest' plugin in your python environment`
171-
172-
- For the sample path:
173-
`.../ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/venv3/lib/python3.8/site-packages/ansible_test/_data/pytest/plugins`
174-
175-
Next, you'll need to set some default environment variables for pytest launches, to enable the
176-
`ansible_pytest_collections` plugin, and successfully resolve the `ibm_zos_cics` collection locally.
177-
178-
Go to `Run Config Menu > Edit Configurations... > Templates > Python tests > pytest > Environment variables button`
179-
180-
- Set `PYTEST_PLUGINS` to `ansible_pytest_collections`
181-
182-
- Set `ANSIBLE_COLLECTIONS_PATHS` to your project root, i.e. the directory that contains `ansible_collections`. For the
183-
example configuration, that's set to `.../ibm_zos_cics`.
184-
185-
*(You may need to delete existing test configurations in `Python Tests` as they won't have been created with the new
186-
template)*
187-
188-
You should be able to launch the unit tests in `tests/unit/modules` by clicking the play button.
63+
If you haven't signed each commit, then the pull request will fail to pass all checks.

Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

build.sh

Lines changed: 0 additions & 72 deletions
This file was deleted.

dev-requirements.txt

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
# (c) Copyright IBM Corp. 2020,2023
1+
# (c) Copyright IBM Corp. 2020,2024
22
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
33
-r requirements.txt
4-
# ansible-core==2.13.7; python_version >= '3'
5-
# ansible-core==2.11.12; python_version < '3'
64
junit-xml==1.9 # To get JUnit xml report from ansible-test
75
pytest_mock==2.0.0
86
mock==3.0.5
97
requests_mock==1.8.0
108
pytest-xdist==1.34.0 # Need this to work around a problem running ansible-test
11-
pytest==4.6.11; python_version < '3'
12-
pytest==7.2.0; python_version >= '3'
13-
# Non-test requirements (python 3+ only)
14-
pylint==2.5.3; python_version >= '3'
15-
shellcheck-py==0.9.0.5; python_version >= '3'
16-
rstcheck==6.1.2; python_version >= '3'
17-
yamllint==1.32.0; python_version >= '3'
18-
voluptuous==0.13.1; python_version >= '3'
19-
ansible-lint==6.22.0; python_version >= '3.9'
20-
pycodestyle==2.10.0; python_version >= '3'
21-
bandit==1.7.8; python_version >= '3'
9+
pytest==7.2.0
10+
# Non-test requirements
11+
pylint==2.5.3
12+
shellcheck-py==0.9.0.5
13+
rstcheck==6.1.2
14+
yamllint==1.32.0
15+
voluptuous==0.13.1
16+
ansible-lint==6.22.0
17+
pycodestyle==2.10.0
18+
bandit==1.7.8

doc-requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
33
-r dev-requirements.txt
44

5-
ansible-doc-extractor==0.1.6; python_version >= '3'
6-
Sphinx==3.4.3; python_version >= '3'
7-
sphinx-rtd-theme==0.5.1; python_version >= '3'
5+
ansible-doc-extractor==0.1.11
6+
Sphinx==6.2.1
7+
sphinx-rtd-theme==1.2.2

docs/source/playbooks.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ following:
100100
101101
102102
The value for the property **ansible_host** is the hostname of the managed node;
103-
for example, ``ansible_host: ec33017A.vmec.svl.ibm.com``
103+
for example, ``ansible_host: example.com``
104104

105105
The value for the property **zos_target_username** is the user name to use when
106-
connecting to the host; for example, ``ansible_user: omvsadm``.
106+
connecting to the host; for example, ``ansible_user: ibmuser``.
107107

108108
The value for the property **ansible_python_interpreter** is the target host
109109
Python path. This is useful for systems with more than one Python installation,
110110
or when Python is not installed in the default location **/usr/bin/python**;
111-
for example, ``ansible_python_interpreter: /usr/lpp/rsusr/python36/bin/python``
111+
for example, ``ansible_python_interpreter: /usr/lpp/rsusr/python39/bin/python``
112112

113113
For more information on Python configuration requirements on z/OS, refer to
114114
Ansible `FAQ`_.
@@ -152,11 +152,11 @@ path; for example, ``/usr/lpp/IBM/zoautil/lib/``.
152152
The value for the property **LIBPATH** is both the path to the Python libraries
153153
on the target and the ZOA Utilities Python library path separated by
154154
colons ``:``; for example,
155-
``/usr/lpp/IBM/zoautil/lib/:/usr/lpp/rsusr/python36/lib:/lib:/usr/lib:.``.
155+
``/usr/lpp/IBM/zoautil/lib/:/usr/lpp/rsusr/python39/lib:/lib:/usr/lib:.``.
156156

157157
The value for the property **PATH** is the ZOA utilities BIN path and the Python
158158
interpreter path; for example,
159-
``/usr/lpp/IBM/zoautil/bin:/usr/lpp/rsusr/python36/bin/python:/bin``.
159+
``/usr/lpp/IBM/zoautil/bin:/usr/lpp/rsusr/python39/bin/python:/bin``.
160160

161161
The included sample variables file (zos_host.yml) contains variables specific to
162162
the playbook as well as the following:
@@ -167,8 +167,8 @@ the playbook as well as the following:
167167
_BPXK_AUTOCVT: ON
168168
ZOAU_HOME: '/usr/lpp/IBM/zoautil'
169169
PYTHONPATH: '/usr/lpp/IBM/zoautil/lib'
170-
LIBPATH: '/usr/lpp/IBM/zoautil/lib/:/usr/lpp/rsusr/python36/lib:/usr/lib:/lib:.'
171-
PATH: '/usr/lpp/IBM/zoautil/bin:/usr/lpp/rsusr/python36/bin/python:/bin'
170+
LIBPATH: '/usr/lpp/IBM/zoautil/lib/:/usr/lpp/rsusr/python39/lib:/usr/lib:/lib:.'
171+
PATH: '/usr/lpp/IBM/zoautil/bin:/usr/lpp/rsusr/python39/bin/python:/bin'
172172
173173
.. note::
174174
In ZOAU 1.0.2 and later, the property **ZOAU_ROOT** is no longer supported

docs/source/requirements.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ A control node is any machine with Ansible® installed. You can run commands and
1515

1616
.. note:: The IBM® z/OS® CICS® collection cannot run on a Windows system.
1717

18-
* `Ansible version`_: 2.11 or later
19-
* `Python`_: 2.7 or later
18+
* `Ansible version`_: 2.14 or later
19+
* `Python`_: 3.9 or later
2020

2121

2222
.. _Ansible version:

docs/source/requirements_managed.rst

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.. ...........................................................................
2-
.. © Copyright IBM Corporation 2020,2021 .
2+
.. © Copyright IBM Corporation 2020,2024 .
33
.. ...........................................................................
44
55
Requirements of managed nodes
@@ -21,24 +21,15 @@ The requirements of the managed node are as follows:
2121

2222
* `requests`_
2323
* `xmltodict`_
24-
* `typing`_ (For Python versions < 3.5)
2524

2625
If you delegate the tasks to run on your localhost, the Python module dependencies
2726
need to be installed on your localhost instead.
2827

29-
You can install them from CLI:
28+
You can install them from the CLI by using the following command:
3029

31-
* If your Python version is no less than 3.5:
30+
.. code-block:: sh
3231
33-
.. code-block:: sh
34-
35-
pip install requests xmltodict
36-
37-
* If your Python version < 3.5:
38-
39-
.. code-block:: sh
40-
41-
pip install requests xmltodict typing
32+
pip install requests xmltodict
4233
4334
4435
You can also install them using the playbook. For example, this `CICS
@@ -49,9 +40,6 @@ The requirements of the managed node are as follows:
4940

5041
.. _xmltodict:
5142
https://pypi.org/project/xmltodict/
52-
53-
.. _typing:
54-
https://pypi.org/project/typing/
5543

5644
.. _CICS sample playbook:
5745
https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_subsystems/cics/cmci/reporting

meta/ibm_zos_cics_meta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ name: ibm_zos_cics
33
version: 1.0.6
44
managed_requirements:
55
- name: Python
6-
version: ">=2.7"
6+
version: ">=3.9"
77
- name: CICS TS with CICSplex System Manager
88
version: ">=4.1"

requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# (c) Copyright IBM Corp. 2020,2021
22
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
3-
requests==2.27.1;python_version<'3.7'
4-
requests==2.31.0;python_version>='3.7'
3+
requests==2.31.0
54
xmltodict==0.12.0
6-
typing;python_version<"3.5"
5+
urllib3==1.26.18

0 commit comments

Comments
 (0)