This is what we recently updated to in production and 3.11/latest is
known to have extra setup steps we need to sort out. Catch up with
production then we'll sort out what the newer Gerrit version needs.
Change-Id: I5f90637ec947ae4776848f9fb70e352ab210ea62
We've dropped testing for Python 3.9 and earlier. Set a
corresponding python_requires value so that the packages for the
next release won't get installed on too-old Python and they'll stick
with the previous version instead.
Modern deployments of Jeepyb and GerritBot in OpenDev use Debian
Bookworm Python 3.11 images and so should be unaffected, but some
external users may still be pip installing onto older platforms.
Change-Id: Ib03f2109ddc851d95ff344bdd861942678ef6b2c
We have to pin the python docker lib back for compatibility with
docker-compose in the integration job. We also drop python testing for
old pythons (py38 and py39) as we're primarily deploying to py311
now. Due to this was also add py311 testing and a forward looking py312
job.
Depends-On: https://review.opendev.org/c/zuul/zuul-jobs/+/920841
Change-Id: Ibdd85fd9259781c6d33da8eae3935a650310fc4e
Recent tox releases have put us on a config treadmill. Avoid these
issues entirely by using nox. Nox is a tox alternative that uses
standard tools like pip and should be simpler to use for us.
Change-Id: I24277512cf542bac7a8852d50009c6f08db7fa37
New urllib3 and python requests break python docker-compose. Pin
requests back which should use an older urllib3. Hopefully this
fixes docker-compose.
Note this should probably only be used as a temporary workaround. A
more permanent fix should change the way we install docker-compose.
Also stop relying on six since it's no longer available and we
dropped Python 2.7 support quite some time back anyway.
Clean up some things in tox.ini which regressed in Tox v4.
Co-Authored-By: Clark Boylan <cboylan@sapwetik.org>
Change-Id: I69a7ba09f737130a403f0657708877ce986f751c
We deploy gerritlib via jeepyb on our gerrit images which have python39
now. Add testing for that version of python to help cover that setup.
We also drop the python3.5 default in tox.ini as we don't test that
version of python anymore.
Change-Id: I4be713a6fe67b6524eb3a463c9835851bc7f90e5
We need to assign nodesets that can run the requested python versions
when running tox-pyXY jobs. Also remove the Sphinx version cap as old
sphinx cannot install with modern setuptools. We don't run CI that
includes sphinx so this should be fine.
If this breaks docs builds we can sort that out later.
Change-Id: I577d67912fe6feb68ae50ff34c2622f9461dd122
Recent versions of pyca/crytpography, which jeepyb requires, need a
new enough pip to support ABI3 wheels and pyptoject.toml files. The
version on ubuntu-bionic nodes is too old for this, so use
ubuntu-focal for the job.
Also switch to referring to the Gerrit SSH API by IP address
(127.0.0.1) since it listens on 0.0.0.0 (all IPv4 addresses) but
ssh-keygen seems to resolve the name "localhost" to ::1 (the IPv6
loopback).
Change-Id: I9b09943bd6bb283a83497bc42e9ffdc9955eb01d
The HEADER_ format argument has been deprecated for some time, but
now removed from Ansible. Update it.
Change-Id: I80256978f676e58416c939efd78003df0d08dd56
This should have gerritlib log the commands it is running in the logs,
which helps with verification.
Change-Id: Iad3c710d73a95d152689d8a60a7ef4051129b0f9
The previous change assumed that all projects would have their acl file
paths updated via ansible's lineinfile module. But lineinfile only
updates the last match. Since we've got two config lines we want to
match and update we run the lineinfile task twice which should end up
updating both of them.
Change-Id: I714281d86569f248f4ae3d909b019f060fe6c520
In Gerrit 2.14 the -q flag to ls-groups was deprecated in favor of -g.
At some point between 2.14 and 3.2 the -q support was removed entirely.
This change checks the gerrit version then uses the appropriate flag for
querying a group based on that.
We also add more robust testing to check creation of groups with spaces
in their names. We also check that if an acl is updated without group
changes that we don't try to recreate the group and get the group uuid
successfully.
Change-Id: I58c0aa2b496bcd792c8f4bc7db89b08cefa3af3d
When the new Opendev 3.2 Gerrit closes the SSH connection, gerritlib
goes into a hard loop. Either this has never really worked, or our
new version of gerrit closes the SSH connection differently and
triggers this.
Currently the _read() function in this code interprets a 0 read as
data and continues the event loop. This means the _listen() function
never exits. The poll() keeps returning that there is a POLLIN event
and the _read() function keeps reading the empty FD.
Modify this to set the state to DISCONNECTED for a blank read.
Additionally improve the error message if we see invalid data (which
shouldn't happen). Insert a short-circuit in the listen to check if
the state has switched to DISCONNECTED and exit the loop in that case.
Change-Id: I46849bcbfc3a0d409baa654867018994ce717481
Fixed bug which prevented use on newer version of python as we
incorrectly checked event value against the bitmask.
Also improves exception by included value of the event in it.
Change-Id: I49f41d2555f53f2377c32c7626e1350c4f42b8de
Previous code was not allowing use of Gerrit without hardcoded infinite
retries inside Gerrit constructor, meaning that wrong credentials
would create an endless loop which gerritlib consumer could not
prevent.
This allows client to specify number of attempts and delay before
a failure is returned.
Change-Id: I5bd14a14539a2705babb9f9922c800383031c6ac
Avoids conflicts between unit testing and linter and avoids
installing unneeded dependencies on both of them.
Change-Id: Id384a998bea298612ec65eaa329f85a38afee3f6
Clients using gerritlib behind NAT/firewall
can be stuck when the NAT/firewall discard
packets belong to the TCP connection after extended
silent periods thinking the connection is dead.
This change allows clients using gerritlib to set
keep alive interval to a non zero value. This will
enable TCP keep alive packets to be sent in
configured intervals keeping the TCP connections alive.
Change-Id: I588706bb51ce41810cd2243f4969763d193d1d55
This new functiona argument will allow callers to set the default
project branch on repo creation. It takes a list, all branches will be
created with the first being repo HEAD.
Change-Id: Iae5a71662740678e663bcd73d6ac660559db5d9a
Newer versions of flake8 identify these valid violations.
N802 added as skip because the entire library uses camelcase.
Change-Id: Ia687b05bb8d0590eb30a970a710a2639548dbc60
- updates tox.ini, also fixing a typo
- enables new jobs, which would at least test ability to install
package under these versions.
- updates Trove metadata
- replace fake sole-survivor unittest with a bit more practical one
Change-Id: Iae224a19850489ba3563ad5a40d358002dacdb97
Now that we're running manage-projects in a python3 container,
we should switch our integration tests to use python3.
Depends-On: https://review.opendev.org/715527
Change-Id: I33a6daf92906d9087c4a31f11966e5037445cd68
We use filter to filter out entries when listing items like groups. This
returns a list in python2 but an iterable in python3. Return a
consistent list via forced coersion.
Change-Id: Iad84f6f383fb85363f3ef51c4bd1da05b8069e43
We want to call addEvent on the 'gerrit' arg passed to GerritWatcher.
For that to work it needs to be of type Gerrit not GerritConnection.
Update the location of username, port, etc data to the connection
details in the gerrit object.
Change-Id: Ic739ddc970f6761f5587ab8fcba3e619a98a4379
This adds integration testing to gerritlib with jeepyb and gerrit.
Depends-On: https://review.opendev.org/704660
Change-Id: I1815e63693656d52c10a9cb9bf60f999e036dfed
We get back bytestrings from paramiko when it talks to gerrit. Make this
a bit more user friendly for python3 and decode these bytestrings into
utf8 unicode.
Change-Id: I1866de53d0978f805faef0933ef37e68454ff5f3
Old paramiko uses pycrypto which is out of date and insecure. Switch to
new paramiko and cryptography instead.
Change-Id: I651244d549d10a848643d1e3b96438833a5954bd
Allow querying to check if a single group entry exists, which when
combined with 'verbose=True' will return the UUID for a single group.
Change-Id: I851ab29999c0d059c9cb71bd38a821c035ae98f7
Move connection related code to a common object to allow reuse of the
connection setup code. This helps avoiding unnecessary recreation of
the connection where it is being used multiple times within the same
process for multiple calls.
Change-Id: Idf318ce5c36100e550182e773ce55da69fe35063
This is a mechanically generated change to replace openstack.org
git:// URLs with https:// equivalents.
This is in aid of a planned future move of the git hosting
infrastructure to a self-hosted instance of gitea (https://gitea.io),
which does not support the git wire protocol at this stage.
This update should result in no functional change.
For more information see the thread at
http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003825.html
Change-Id: I194eaf19074655822776b2e533519607622738c8
Newer paramiko leaks connections if they are not explicitly closed. Add
a finally handler to always close the ssh connections when we are done
with it to avoid leaking these connections.
Change-Id: Ia2e53998d362683a42bda074d82e3a3a75f380b4