95 Commits

Author SHA1 Message Date
Arun S A G
40858f3678 Add support for TCP keep alive in gerritlib
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
2020-09-09 17:45:39 -07:00
Clark Boylan
6058d994b8 Add branches arg to createProject
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
0.9.0
2020-07-15 11:11:44 -07:00
Sorin Sbarnea
95e17ddf05 Fixed linting issues
Newer versions of flake8 identify these valid violations.
N802 added as skip because the entire library uses camelcase.

Change-Id: Ia687b05bb8d0590eb30a970a710a2639548dbc60
2020-05-21 17:12:40 +01:00
Sorin Sbarnea
2f666c7b35 Replace testrepository with stestr
Replace outdated testrepository with its newer sibling, which
is maintained.

Change-Id: I9755b82d8a2a82f146e71fdc0f32e3f6002e804d
2020-05-20 20:07:15 +01:00
Sorin Sbarnea
a0a5f260ea Enable py36-py38 testing
- 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
2020-05-20 19:38:05 +01:00
Sorin Sbarnea
c49a8e0e5f Added missing retry_delay instance variable
Found exception at line 179, where self.retry_delay was references
without being assigned.

Change-Id: I6d00fe9478ed3467120e0441bed3c32f68e20bca
2020-05-20 18:13:21 +01:00
vass
ad26169a4d Use ensure-* roles
The install-* roles in zuul-jobs have been renamed to ensure-*, follow
the rename.

Change-Id: Ia5dffd38399142d9f17a1123b3e4a46bdbca7662
2020-04-13 09:36:36 +02:00
Zuul
04537022f9 Merge "Return lists from listing functions" 0.8.4 2020-03-30 17:35:16 +00:00
Monty Taylor
833fce6eba Run gerritlib integration tests with python3
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
2020-03-27 16:22:57 -05:00
Clark Boylan
17380a3e71 Return lists from listing functions
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
2020-03-27 14:18:05 -07:00
Zuul
cfceeb50e0 Merge "Add integration testing with jeepyb and gerrit" 2020-03-22 14:06:04 +00:00
Clark Boylan
fa0a23a751 Pass Gerrit not GerritConnection to GerritWatcher
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
0.8.3
2020-01-28 14:14:20 -08:00
Clark Boylan
2b81068c01 Add integration testing with jeepyb and gerrit
This adds integration testing to gerritlib with jeepyb and gerrit.

Depends-On: https://review.opendev.org/704660
Change-Id: I1815e63693656d52c10a9cb9bf60f999e036dfed
2020-01-28 11:01:01 -08:00
Zuul
d244a41362 Merge "Convert gerrit output to utf8 unicode" 2020-01-28 02:28:47 +00:00
Zuul
0b438471c8 Merge "Use newer paramiko" 0.8.2 2020-01-28 02:00:56 +00:00
Clark Boylan
945d2088a7 Convert gerrit output to utf8 unicode
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
2020-01-27 16:13:13 -08:00
Clark Boylan
c234e11b51 Use newer paramiko
Old paramiko uses pycrypto which is out of date and insecure. Switch to
new paramiko and cryptography instead.

Change-Id: I651244d549d10a848643d1e3b96438833a5954bd
2020-01-27 16:13:11 -08:00
Darragh Bailey
a731676fd1 Support querying for single group info
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
2020-01-23 12:11:34 +00:00
Darragh Bailey
500c8d2cc9 Reuse same paramiko connection recreating on errors
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
2020-01-23 12:01:52 +00:00
OpenDev Sysadmins
609deaf9a5 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:26:01 +00:00
Ian Wienand
1d63855d0d Replace openstack.org git:// URLs with https://
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
2019-03-24 20:33:40 +00:00
Zuul
f7d1832b45 Merge "Updated list of Python versions in tox" 2018-06-28 17:01:33 +00:00
Clark Boylan
2de58d560f Close ssh connections when done with them
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
0.8.1
2018-05-03 13:39:57 -07:00
Sorin Sbarnea
ffbc080f1a Updated list of Python versions in tox
Change-Id: I40118820d7eb0956dc012556aa1d5767f40d652e
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2018-01-27 14:50:51 +00:00
Clark Boylan
01a634014e Add group membership management functions
Add functions to list group members and add and remove users from
groups.

Change-Id: Id5d8915f2c0bf6f6057b414785b8ec1b18e810f2
0.8.0
2017-09-22 10:24:53 -07:00
Clark Boylan
eb6588734c Handle different gerrit versions with create-project
Gerrit < 2.12 used a --name argument on create-project. Newer Gerrit
simply takes the project name as an arg. Check the Gerrit version before
constructing the create-project command.

Change-Id: I59ca051627d54a11ef6524cce9b5a4414fd2193d
0.7.0
2017-09-19 16:25:39 -07:00
Khai Do
d9478fcc08 Remove pyflakes environment
There are no test jobs for flake8 so this is not neeeded.

Change-Id: I63c7ae85510a86d0667b96da6526fa0df5aa621a
2017-06-15 13:26:41 +00:00
Sorin Sbarnea
2c8298394f Removed pbr<2.0.0 to resolve depencency conflicts
Change-Id: Ia96cef693d82b42320561df80eb5a571085cda93
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2017-03-30 21:37:20 +01:00
Khai Do
4527edd4ad Remove deprecated create-project '--name' option
The create-project '--name' option was removed[1] in Gerrit 2.12.
Update gerritlib to match the command for Gerrit-2.12+. This is also
compatible with Gerrit 2.11

[1] https://gerrit-review.googlesource.com/#/c/69738/

Change-Id: Ie70d938501cbf88dbbb0e9ab22abcc921f89ccdc
2016-12-01 15:05:50 -08:00
Khai Do
33feeb837b Allow creating projects with spaces
Gerrit supports creating projects that contain spaces in it.
Quote the project name otherwise the command will fail when user
attempts to create a project with spaces in it.

Change-Id: Ie1db92812355b4d8f7603c3b4b8d20434ca54bb3
2016-12-01 15:04:50 -08:00
Jeremy Stanley
fba7102ae4 Specify testenv command for tox>=2.5
As of the tox 2.5.0 release, failure to specify a default commands
key in the fallback testenv section of tox.ini instantly fails with
"ERROR: Commands not specified. Please update relevant section of
.../tox.ini".

Copy the testenv.commands entry from the openstack/cookiecutter
repo's template. While at it, copy the boilerplate placeholder test
from the cookiecutter templates so that jobs don't freak out when
they discover (and then run) no tests.

Change-Id: Ifb8fcfbb6d76edd8c7dcf814a705ee7eff3a9819
2016-12-01 20:20:59 +00:00
Paul Belanger
11647ed384
Cap paramiko<2.0.0
Until we have a good migration plan for paramika, lets cap at <2.0.0.
Otherwise we need to install libffi-dev and other dependencies for the
version bump.

Change-Id: Iad29f93814c798fc2c4204e08e940011ad1428dc
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
0.6.0
2016-05-25 11:03:42 -04:00
Khai Do
cd183a4f43 Stop specifying requirements.txt in tox.ini
As PBR already injects the contents of requirements.txt into
setup_requires, there is no need for tox to explicitly install them.
http://lists.openstack.org/pipermail/openstack-dev/2015-July/069663.html

Change-Id: I5fc4de208e6c2f6926238f6942bf4ca9804748e4
2015-08-10 15:38:34 -07:00
Monty Taylor
24de1df8df Bump pbr and hacking version
Bumping pbr required a bump to hacking otherwise build will fail
with VersionConflict error.

Change-Id: I3d2a031c175dcd25b309bd3cbf15f5ebad0c4744
2015-08-02 14:00:44 -07:00
Khai Do
58ca447785 Update project docs
This change does the following:
  Update docs with more info
  Add an example usage of this library
  Add pbr versioning to docs
  Updates the requirements
  Rarrange the docs to look better on pypi

Lots of the elements to do above were borrowed from
python-jenkins and jenkins-job-builder projects.

Change-Id: Idc7dfc88cc26e1147b027fd55d41229c4bf3910f
0.5.0
2015-04-20 13:10:34 -07:00
Jenkins
0a3531b432 Merge "Doc generation support" 2015-03-13 02:42:04 +00:00
Antoine Musso
207357ea9e Doc generation support
Based on cookiecutter and slightly tweaked afterward.

* conf.py has autoclass_content = 'both' to generate the __init__
  documentation.
* bumped doc copyright to 2015.
* adds in tox environement 'docs' as a convenience

Change-Id: I69bb4179be343ab7c8a44f6fb80d5a428fe30e17
2015-02-11 10:09:59 +01:00
Jeremy Stanley
60269be836 Workflow documentation is now in infra-manual
Replace URLs for workflow documentation to appropriate parts of the
OpenStack Project Infrastructure Manual.

Change-Id: I25f5dbee234b6d6121beb9ffcf97809dd1a41bb1
2014-12-05 11:51:53 -08:00
Michael Krotscheck
10a9ca52bc Switched documentation to point to storyboard
We've migrated this project to storyboard, I'm updating the documentation links.

Change-Id: I07227f271adc46e21c727c9bbf0ec2dc3b162140
2014-11-11 23:49:13 +00:00
Jenkins
8366b574ed Merge "Add functionality to Gerritlib to set project descriptions" 2014-10-12 17:13:21 +00:00
Andrey Nikitin
7125e80a08 Update listGroups function in gerrit.py
Added ability to view extended information about the groups to obtain information about the uuid.
Function listGroups will be used in jeepyb (in file manage-project.py) for checking
and creating groups in gerrit database if groups does not exist.

Change-Id: Id11e358141d3802026bc7e531146e2d84546463d
2014-09-11 16:51:59 +04:00
Jenkins
a515657196 Merge "Python3 support" 2014-09-07 18:46:47 +00:00
Jenkins
11418147ca Merge "Changed home-page used in setup.cfg" 2014-09-07 18:44:41 +00:00
Chmouel Boudjnah
bedb0439f9 Python3 support
Change-Id: Icf60ab88682aeda1fee73b35cfe9d3ca3f2ca2be
2014-08-11 09:23:40 +02:00
Yolanda Robla
0425620240 Add functionality to Gerritlib to set project descriptions
Enabled functionality into gerritlib for setting descriptions
when creating a project, or have the ability to update
existing projects to update their descriptions.

This will allow jeepyb to create projects into Gerrit
having proper descriptions.

Change-Id: Id7fdef1599e8632edbdd8af5255207c18c9da7e0
Closes-Bug: #1349372
2014-07-28 16:26:07 +02:00
Christian Berendt
15de277da9 Changed home-page used in setup.cfg
I think the home-page should reference the repository instead
of http://ci.openstack.org. I cannot find a reference on gerritlib
on http://ci.openstack.org/ or http://ci.openstack.org/gerrit.html.

Change-Id: I9563e9d97965c3217fd9960255ec1a98ca2ed5c0
2014-07-01 12:38:38 +02:00
StephenSun
60fc983cf2 Update pbr version
Matches Global Requirements. In the gerritlib project pbr version
does not match the global requirements.

Change-Id: I8d598635916ce2f2659139c90ac31330e158740d
2014-06-26 18:39:41 +08:00
Antoine Musso
ee4d151ade Apply cookiecutter defaults
Launchpad points to https://launchpad.net/openstack-ci which I assume is
a catch all.

[setup.cfg]
* skipped files.packages section which is unneeded
* removed obsolete pbr global.setup-hooks

Change-Id: I26bddf6a1bb1ce7a10ea0f8d9f40a916dcba0c90
2014-06-02 18:22:04 +02:00
Jenkins
9809fbe25f Merge "add getVersion and listPlugin commands and update replicate command" 0.4.0 2014-04-03 00:13:29 +00:00
Anita Kuno
ed6a6c2b67 Add empty-commit flag when creating a project with no commits
When creating a new project, if you pass the --empty-commit
flag, a sha is created for the master branch allowing for
cloning and other subsequent actions on the repo. If the project
has no commits and is created without the --empty-commit flag,
the repo is created with no sha for the master branch creating
problems with any subsequent actions on the repo.

Change-Id: Ic233057c2503b7fd9fc234d97d71431520ea70b8
2014-03-27 20:57:20 -04:00