Commit Graph

282 Commits

Author SHA1 Message Date
Jeremy Stanley 1cee24ce0b Support Pillow v10
Pillow 9.5 deprecated the getsize method for fonts in favor of its
new getbbox, and then getsize was removed in Pillow 10.. Adjust the
call we use for captcha generation so it will continue working, and
declare a requirement for the earliest forward-compatible release.

Change-Id: Ib35eea077d7f8c428493ef8e4cfe00e05e580a6f
2024-02-20 21:49:07 +00:00
Clark Boylan 376c2ba0d0 Update lodgeit container image to Python3.11 on Bookworm
We update the upper bound in testing from python3.10 to python3.11 to
match. This will allow the opendev team to clean up old bullseye images
and look ahead to python3.12.

Change-Id: I5321b2e75b4cf50f9342efa13fd4ef37cf87e1e0
2023-10-09 13:40:43 -07:00
Clark Boylan fd508a8c19 Replace inspect.getargspec with inspect.signature
Python 3.11 removed the long deprecated inspect.getargspec. Update
lodgeit to use inspect.signature instead. The signature api appears to
be the modern thing that is expected to work into the future.

Change-Id: Ic5603f848c0fffd15d9ce07cd7450638552c82c7
2023-10-09 13:40:10 -07:00
Clark Boylan ac772da1f6 Put regex multiline specifier at beginning of regex string
Python 3.11 appears to want global regex options to be set at the
beginning of the regex string. Setting them elsewhere results in:

  re.error: global flags not at the start of the expression at position foo

A followup change will switch lodgeit over to python3.11 making this
necessary cleanup beforehand.

Change-Id: Idc21e39f7f4e3a9a3bcdc657f0fd6b352a20d617
2023-10-09 11:51:46 -07:00
Clark Boylan 5f6c89b500 Revert "Move lodgeit image publication to quay.io"
This reverts commit 305d665492.
This reverts commit e0aef11145.

OpenDev is moving back to docker.io to preserve speculative container
image testing.

Change-Id: I3f0962790f48a33edc5f6414ab875a2a38cfdc91
2023-05-24 14:00:30 -07:00
Clark Boylan e0aef11145 Fix quay publishing
The repository metadata needs to be fully qualified to push to quay.io
properly. Otherwise it pushes to docker hub and fails with invalid
credentials.

Change-Id: I43f3330f98aaf806c0c05e78c9908948f22c2193
2023-05-10 14:12:06 -07:00
Clark Boylan 305d665492 Move lodgeit image publication to quay.io
We are moving all of our images to quay.io. Move lodgeit too. This also
updates the source location for the python base images which have
already moved to quay.io.

Change-Id: I8fc391018463fc8df81bdf2bc81a05b4fb330d63
2023-05-08 09:26:45 -07:00
Clark Boylan 95fc241bc0 Pin SQLAlchemy less than 2.0.0
SQLAlchemy 2.0 is a very large non backward compatible update. We should
probably take the time to update lodgeit to work with SQLAlchemy 2.0,
but for now lets just make the software buildable and pin the dep.

Change-Id: Ie4fcc6e8aae92b54adb30ac6028907217613165f
2023-05-08 09:26:45 -07:00
Clark Boylan cc2728f1a3 Drop python 3.6 testing
Python 3.6 is sufficiently old at this point that we don't need to keep
testing on it. This will reduce the number of things we need to tend and
care for with this application and service.

Change-Id: Iadea5270f54631ef72a68a37073fd8d337bc4c5c
2022-11-10 10:30:17 -08:00
Clark Boylan b4e0cae3a3 Update uwsgi image to python 3.10
OpenDev has stopped building python3.8 images at this point. This means
we need to update our Dockerfile to use a newer python version. In this
case python3.10 is chosen as it is newer but still easy to test on
Ubuntu. This will also update the version of uwsgi we are using.

Change-Id: I3eb4c580d854ebe0437114701d1b3f9c721e530e
2022-11-10 10:30:17 -08:00
Clark Boylan 9e2d54bb5a Modernize test suite
This modernizes the lodgeit testsuite to use stestr instead of nose. The
primary reason for this is nose is not python3.10 compatible and we
would like to use newer python with lodgeit.

Change-Id: I8ae480d22bbef0258afc9d6ffd6cd820993430a1
2022-11-10 10:30:15 -08:00
Ian Wienand bc2678dc73 new paste: check input length
Check the input length, if it's over 64k then this will put up an
error page that says "Could not submit your paste because ..."

Change-Id: I0ba3efbb33050272543b2f76a1cf0f49df26185c
2022-04-20 08:07:44 +10:00
Ian Wienand e22ae1230b new paste: add maxlength to input box
This goes into a mysql "text" type field which is 65,535 characters
long.  Set maxlength just under this to avoid interactive use sending
too much data, which fails with a 502 error currently.

Change-Id: Ieedef0fd956a5d31e682a4c808fb1197b55121b6
2022-04-19 10:27:57 +10:00
Ian Wienand 50d45eddc8 Default to private pastes
This avoids having predictable paste ids by default

Change-Id: Iac86129e6cf9936eb5844b1d3b7b69ee89df8a0e
2022-02-08 11:25:04 +11:00
Clark Boylan f94a664386 Rebuild the lodgeit docker image
This is a Dockerfile update to force a rebuild of the lodgeit image. The
depends-on is the reason we want a rebuild. Long story short our
uwsgi-base bullseye image isn't actually bullseye due to a bug. The
depends on should fix this and we can rebuild onto bullseye.

Depends-On: https://review.opendev.org/c/opendev/system-config/+/821339
Change-Id: I85119c85457ef6b6b0cc95e4fdb2e1c92637949e
2021-12-09 15:49:00 -08:00
Zuul af563e445b Merge "Update docker image to bullseye and python 3.8" 2021-11-23 14:42:15 +00:00
Zuul ccf32c0122 Merge "Drop Python 2.7 support" 2021-11-23 14:37:07 +00:00
Clark Boylan fa74a9d161 Update docker image to bullseye and python 3.8
Just keeping up with the newer images so that we don't fall behind.

Change-Id: I446a56c48be2a9a44e9fa36fd6edd7243eed697a
2021-11-19 08:30:57 -08:00
Jeremy Stanley 197a98a120 Properly handle paste exceptions
With Python 3, it doesn't work to decode type str. The str() recast
is still necessary however, since the exception data type is not
directly serializable in this way.

Change-Id: I3925cbb0d0ff594407c7b93b0d982f2cad386ad6
2021-08-13 17:07:34 +00:00
Ian Wienand 8057480ced diff parser : update next variable
In Python 3 this is a keyword, rename to nextline to avoid confusion

Change-Id: I46ebdeed3529587b21b3d17383331877e98c8d82
2021-08-04 11:34:31 +10:00
Ian Wienand 0a52b74bba diff parser: update calls to next()
The .next() syntax is broken and replaced with next() in Python3.
Update the calls in this file.

Change-Id: I026ed1888c54e3d71882940250c0532a60b40035
2021-08-04 11:26:06 +10:00
Ian Wienand 04da41ceda Drop Python 2.7 support
Drop the 2.7 tox job and add some Python 3 classifiers to setup.cfg

Change-Id: I83fcdd39cbfffada7b26ab784f7a907aeea0b5cd
2021-07-01 17:08:06 +10:00
Zuul ce0c909125 Merge "Allow for overriding title" 2021-06-30 06:54:23 +00:00
Ian Wienand 9bf92ae9af Use opendev-buildset registry
Change-Id: If3db52bb05cc4eebd6490f3b7e4db038bf24b7ba
2021-06-30 11:17:56 +10:00
Ian Wienand a1e1667a36 Allow for overriding title
This simply adds a global template variable taken from
LODGEIT_TITLE_OVERRIDE that allows setting the site title for some
minimal customisation.

Previously, the opendev puppet would copy a custom layout.html over
the shipped version.  This allows us to simply set a variable and not
have duplicate copies of templates in config managment.

Change-Id: If25dcece0ecd2b7dfc0178c6886559ac2507b28f
2021-06-29 19:24:27 +10:00
Dmitriy Rabotyagov 2b0ca071f9 Add py3.8 support
Change-Id: I3d97ec43f84d00f8403a4ecf355a6d9b7c75d57e
2021-06-29 17:43:26 +10:00
Ian Wienand b5aa49e602 Use bionic for Python 3.6
Change-Id: I05cb8ee91405648cde135081ac622ee9e531afb7
2021-06-29 17:40:24 +10:00
Daniel Pawlik 7eb34a9d4f Fix issue related to new Pillow lib; change hash string encode
The captcha system may raise an error, when calculations were
float; added box argument for calling Pillow paste method.
This commit is also changing string encode in calculate_hash
function due "TypeError" exception.

Change-Id: Ibe175b78a8c446a7552c82732ec0ae25ef47c536
2021-04-28 16:39:01 +02:00
Zuul c6c6db6ca0 Merge "Add lodgeit-db script" 2021-02-01 21:58:28 +00:00
Zuul 97d0650334 Merge "Tuning pool_recycle to avoid MySQL server gone away" 2021-02-01 21:57:04 +00:00
Zuul b26470ba4a Merge "docker: switch to using uwsgi-base" 2021-02-01 21:54:01 +00:00
Jeremy Stanley 69ec973e39 Skip deprecated lexers (Pygments 2.7.3 and later)
Work around the way Pygments maintainers have decided to list
"deprecated" lexers, but just skipping them if attempting to add
raises an IndexError because they look like JSONBareObject here:

https: //github.com/pygments/pygments/commit/5ee1754
Change-Id: Ia7b896263b4118ec369c5ce130addef3295a91a5
2021-02-01 20:14:51 +00:00
Jeremy Stanley 1970b75415 Use less ambiguous line iteration variable name
In diff.py the line iteration inline function relied on an iterable
named "l" (lower-case L) which is easily confused with the number 1
in some poorly-designed fonts. Because this is the only occurrence
for which newer pycodestyle is objecting, just go ahead and adjust
it rather than altering our style checks.

Also temporarily pin Pygments to deal which a regression which
arises in 2.7.3 and later.

Change-Id: I29cc8e5680d3fed3645b26f8b03d2ca299d974b0
2021-02-01 20:14:15 +00:00
Mohammed Naser 7bca3dd30d docker: switch to using uwsgi-base
This changes switches the Docker image to use the uwsgi-base image which
have no changes in the consumption of the image.

Depends-On: https://review.opendev.org/713953
Change-Id: Ia04425ca7bf22f0e9cc2dbe35daefa466c92dd56
2020-04-22 17:56:08 -04:00
Dmitriy Rabotyagov 5df6180484 Add lodgeit-db script
Adds script that makes operations (like pastes removal)
that are not secure to do via API without auth. It connects to DB and
interacts directly with DB.

Change-Id: I8ef65feda92387bf4dc548b8876fc9fb82dadc64
2020-03-30 17:31:33 +03:00
Monty Taylor d66b0e82fb Be explicit about python base image version
We have versioned base images now, use them.

Change-Id: Ia5da9327d4cc1e26293550202a9ae0a9951a77aa
2020-03-26 10:10:15 -05:00
Monty Taylor 94fe4ad8e3 Add libc6-dev to bindep and pin Pygments for 2.7
The python-builder base image was updated to no longer install
recommends. This is inline with the other Infra images and keeps
image sizes smaller. gcc recommended libc6-dev - but it turns out
we need that for stdio.h for one of our depends. Add it to fix
our image builds.

Pygments released a python3-only release. Pin back to before
that for python2.

Change-Id: I18a808748979b7167361d2e5ebce04bc8eaf1347
2020-03-26 10:10:08 -05:00
Igor Shishkin f53434f935 Tuning pool_recycle to avoid MySQL server gone away
Some time after lodgeit application have no load
SQLalchemy connection expires and application dies
with 5xx error and MySQL Server gone away exception.

By using a shorter default pool_recycle of 3600s which
can also be tweaked using environment variables, it allows
you to avoid dealing with this issue.

Change-Id: I79eb823458c604b2faff9bb1e9531c45fc1ed3cb
2020-03-18 08:27:14 -04:00
Zuul afb0d7f736 Merge "Fix sort comparison function" 2020-03-17 23:20:12 +00:00
Mohammed Naser 54727daa85 Upload container images
This is an initial go at building this Python package and uploading
an image for it.  This will be followed up with some changes which
will make it easier to execute with an entrypoint and environment
variables later.

Change-Id: Ie2219fc96f32554bde1cac37faa0b961dc53b95e
2020-03-09 08:19:55 -04:00
Zuul 70d9a499d7 Merge "Removes unnecessary utf-8 encoding" 2020-03-06 01:49:51 +00:00
Zuul c37e845331 Merge "Fix python3 compatibility issue" 2020-03-05 20:12:49 +00:00
Clark Boylan 18a2ac5b21 Fix sort comparison function
In python3 you can't use a cmp function and have to use a key function
when sorting. Python2 supports both so we switch to a key function that
takes a single arg in the sort of supported languages in the pasting
script.

Change-Id: Ib49bcb22653bd577078a386750027fc5acee3180
2020-03-05 12:10:05 -08:00
Iswarya_Vakati a1af412914 Removes unnecessary utf-8 encoding
This patches removes unnecessary utf-8 encoding

Change-Id: Ic4c35e70df0a1f3714c9a144c4b7fed9cd893aa2
2020-03-05 11:17:04 +00:00
David Pursehouse 1fa8df3fb2 Update URLs from openstack.org to opendev.org
Change-Id: Iee0f3f88d870a7b93c9d15624537680bbc181502
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
2020-03-05 08:28:44 +09:00
Tristan Cacqueray 9b854e7729 Fix python3 compatibility issue
This change fix python3 compatibility:
* replace except obj, name with except obj as name
* use print function
* replace iteritems by six.iteritems
* replace xrange by range
* convert items() result to list

Change-Id: I70364e47541274d446c4449f820dce3e0b331b27
2020-03-04 13:09:24 -06:00
David Pursehouse 2d4b0ebee6 Fix pep8 errors
- E722 do not use bare 'except'

  Replace bare except clauses with explicit exception types.

- E741 ambiguous variable name 'l'

  Rename 'l' to 'locale'

In addition this patch squashes 684782 to use older
werkzeug version to not face with exceptions.

Generally this patch fixes lodgeit CI.

Also, add tox jobs to in-tree zuul config

These were defined in project-config, but we don't need to manage
that centrally.

Change-Id: Id750715472f88fa5dba0a2414fb1667df4a6dc40
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
2020-03-04 13:09:04 -06:00
OpenDev Sysadmins ab592381b0 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:25:38 +00:00
David Pursehouse af3168e449 Show the currently running version on the about page
The version is derived from the abbreviated sha1 of the current
head of the git repository.

Change-Id: Icc886596e500080cb014f9a17c3585a945516a98
2017-02-25 13:51:52 +09:00
David Pursehouse b19a482d47 Fix PEP-8 errors
There are several instances of the error:

   E305 expected 2 blank lines after class or function definition

Fix them all by adding the necessary blank lines.

Change-Id: I37e2990772f05a100fe303c1512b7bdfb10a660d
2017-02-25 13:47:11 +09:00