[Launchpad-reviewers] [Merge] ~lgp171188/launchpad:codehosting-charm-fix-cron-job-whitespace-typo into launchpad:master

2023-11-28 Thread Guruprasad
Guruprasad has proposed merging 
~lgp171188/launchpad:codehosting-charm-fix-cron-job-whitespace-typo into 
launchpad:master.

Commit message:
charm/codehosting: Fix a typo in the supermirror-pull cron job


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/456510
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~lgp171188/launchpad:codehosting-charm-fix-cron-job-whitespace-typo into 
launchpad:master.
diff --git a/charm/launchpad-codehosting/templates/crontab.j2 b/charm/launchpad-codehosting/templates/crontab.j2
index b6ae48d..676d4ec 100644
--- a/charm/launchpad-codehosting/templates/crontab.j2
+++ b/charm/launchpad-codehosting/templates/crontab.j2
@@ -5,7 +5,7 @@ LPCONFIG=launchpad-codehosting
 
 {%- if active %}
 
-* * * * * {% if http_proxy %}http_proxy={{ http_proxy }} https_proxy={{ http_proxy }}{% endif %}{{ code_dir }}/cronscripts/supermirror-pull.py -q --log-file=INFO:{{ logs_dir }}/puller.log
+* * * * * {% if http_proxy %}http_proxy={{ http_proxy }} https_proxy={{ http_proxy }} {% endif %}{{ code_dir }}/cronscripts/supermirror-pull.py -q --log-file=INFO:{{ logs_dir }}/puller.log
 
 # remove from disk, deleted branches
 10 0 * * * {{ code_dir }}/cronscripts/process-job-source.py IReclaimBranchSpaceJobSource -q --log-file=DEBUG:{{ logs_dir }}/process-job-source.IReclaimBranchSpaceJobSource.log
___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


Re: [Launchpad-reviewers] [Merge] ~corey.bryant/lpci:main into lpci:main

2023-11-28 Thread Jürgen Gmach
Hi Corey, no, I think this is on our side.

Thanks for your patience. With sprints, sickness, and some handover handling, 
we ran out of time. Thanks for pinging me again.

You are using both 60 and 600 as values for timeouts, and both are magic 
numbers for me.

Could you please add comments nearby the code which explain why you chose those 
numbers? A constant or in this case if we really need two values, two constants 
at near the top of the file would be perfect.

-- 
https://code.launchpad.net/~corey.bryant/lpci/+git/lpci/+merge/454415
Your team Launchpad code reviewers is requested to review the proposed merge of 
~corey.bryant/lpci:main into lpci:main.


___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


Re: [Launchpad-reviewers] [Merge] ~corey.bryant/lpci:main into lpci:main

2023-11-28 Thread Corey Bryant
H Jurgen, please let me know if this needs anything else. Thanks!
-- 
https://code.launchpad.net/~corey.bryant/lpci/+git/lpci/+merge/454415
Your team Launchpad code reviewers is requested to review the proposed merge of 
~corey.bryant/lpci:main into lpci:main.


___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


[Launchpad-reviewers] [Merge] ~cjwatson/lp-mailman:charm into lp-mailman:master

2023-11-28 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-mailman:charm into 
lp-mailman:master.

Commit message:
Add a basic charm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-mailman/+git/lp-mailman/+merge/456439

This is incomplete.  It has two major known problems:

 * lp-mailman currently wants to write its configuration on startup.  This is 
difficult to disentangle, and it conflicts with the way our charms usually work 
where we deploy code as root and start it as a non-root user.  I made an effort 
to only write configuration if it differs from the current contents, but this 
is fragile and I'm not sure it completely works yet.  It may be worth exploring 
other approaches too.

 * I haven't done anything with email configuration yet.  Both inbound and 
outbound email are of course vital for lp-mailman.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-mailman:charm into lp-mailman:master.
diff --git a/charm/.gitignore b/charm/.gitignore
new file mode 100644
index 000..f795aeb
--- /dev/null
+++ b/charm/.gitignore
@@ -0,0 +1 @@
+*.charm
diff --git a/charm/lp-mailman/README.md b/charm/lp-mailman/README.md
new file mode 100644
index 000..fd1a7bb
--- /dev/null
+++ b/charm/lp-mailman/README.md
@@ -0,0 +1,7 @@
+# Launchpad mailing list manager
+
+This charm runs a service that operates Launchpad mailing lists.
+
+You will need the following relation:
+
+juju relate lp-mailman rabbitmq-server
diff --git a/charm/lp-mailman/charmcraft.yaml b/charm/lp-mailman/charmcraft.yaml
new file mode 100644
index 000..5e4bb85
--- /dev/null
+++ b/charm/lp-mailman/charmcraft.yaml
@@ -0,0 +1,75 @@
+type: charm
+bases:
+  - build-on:
+- name: ubuntu
+  channel: "18.04"
+  architectures: [amd64]
+run-on:
+- name: ubuntu
+  channel: "18.04"
+  architectures: [amd64]
+parts:
+  charm-wheels:
+source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
+source-commit: "7bcd79fa4fca485eaf15ee9e2ee16f3ab902678d"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": charm-wheels/
+stage:
+  - charm-wheels
+  # XXX cjwatson 2023-09-26: This is horrible, and if you can find a
+  # better approach that works then please replace this.  Ubuntu 18.04's
+  # Python is incompatible with newer versions of pip and setuptools,
+  # but the charm build mechanism tries to upgrade pip and setuptools in
+  # a way that causes the old version of pip that we started with to
+  # select an overly-new version and then complain that it's
+  # incompatible.  Removing these wheels ensures that it doesn't try,
+  # though of course this is fragile and may break when we switch this
+  # part to a newer source-commit.
+  - "-charm-wheels/pip-22.0.4-py3-none-any.whl"
+  - "-charm-wheels/setuptools-62.1.0-py3-none-any.whl"
+  - "-charm-wheels/setuptools-65.3.0-py3-none-any.whl"
+prime:
+  - "-charm-wheels"
+  ols-layers:
+source: https://git.launchpad.net/ols-charm-deps
+source-commit: "9c59a9804f1f40e2a74be7dac9bf18a655a7864f"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": layers/
+stage:
+  - layers
+prime:
+  - "-layers"
+  launchpad-layers:
+after:
+  - ols-layers
+source: https://git.launchpad.net/launchpad-layers
+source-commit: "8b7d25a29b8297d491abe6a0c6b69f34e39dddba"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  launchpad-payload: layers/layer/launchpad-payload
+stage:
+  - layers
+prime:
+  - "-layers"
+  charm:
+after:
+  - charm-wheels
+  - launchpad-layers
+source: .
+plugin: reactive
+build-snaps: [charm]
+build-packages: [python3-dev]
+build-environment:
+  - CHARM_LAYERS_DIR: $CRAFT_STAGE/layers/layer
+  - CHARM_INTERFACES_DIR: $CRAFT_STAGE/layers/interface
+  - PIP_NO_INDEX: "true"
+  - PIP_FIND_LINKS: $CRAFT_STAGE/charm-wheels
+reactive-charm-build-arguments: [--binary-wheels-from-source]
diff --git a/charm/lp-mailman/config.yaml b/charm/lp-mailman/config.yaml
new file mode 100644
index 000..e9badd8
--- /dev/null
+++ b/charm/lp-mailman/config.yaml
@@ -0,0 +1,66 @@
+options:
+  active:
+type: boolean
+default: true
+description: If true, run the lp-mailman service.
+  bounce_address:
+type: string
+description: Envelope sender address for outgoing email.
+default: "nore...@launchpad.test"
+  domain:
+type: string
+description: Domain name for this instance.
+default: "launchpad.test"
+  domain_lists:
+type: string
+description: Domain name for this instance's mailing list service.
+default: "lists.launchpad.test"
+  domain_xmlrpc_private:
+type: string
+description: Domain name for this 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:black-py38 into launchpad:master

2023-11-28 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:black-py38 into 
launchpad:master.

Commit message:
Upgrade Black's target Python version to 3.8

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/456431
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:black-py38 into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 99b2a61..0f3f9e0 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -3120,7 +3120,7 @@ class TestUpdateByHash(TestPublisherBase):
 def assertHasSuiteFiles(
 self,
 patterns: Sequence[str],
-*properties: Tuple[str, Optional[int], Optional[int], Optional[int]]
+*properties: Tuple[str, Optional[int], Optional[int], Optional[int]],
 ) -> None:
 """Assert that the database records certain archive files.
 
diff --git a/lib/lp/charms/tests/test_charmhubclient.py b/lib/lp/charms/tests/test_charmhubclient.py
index 1d5c3bf..7ca8734 100644
--- a/lib/lp/charms/tests/test_charmhubclient.py
+++ b/lib/lp/charms/tests/test_charmhubclient.py
@@ -78,7 +78,7 @@ class RequestMatches(MatchesAll):
 auth=None,
 json_data=None,
 file_data=None,
-**kwargs
+**kwargs,
 ):
 matchers = []
 kwargs = dict(kwargs)
diff --git a/lib/lp/charms/tests/test_charmrecipe.py b/lib/lp/charms/tests/test_charmrecipe.py
index 5fad120..df6ba5a 100644
--- a/lib/lp/charms/tests/test_charmrecipe.py
+++ b/lib/lp/charms/tests/test_charmrecipe.py
@@ -273,7 +273,7 @@ class TestCharmRecipe(TestCaseWithFactory):
 processor=None,
 supports_virtualized=True,
 supports_nonvirtualized=True,
-**kwargs
+**kwargs,
 ):
 if architecturetag is None:
 architecturetag = self.factory.getUniqueUnicode("arch")
@@ -1860,7 +1860,7 @@ class TestCharmRecipeWebservice(TestCaseWithFactory):
 git_ref=None,
 private=False,
 webservice=None,
-**kwargs
+**kwargs,
 ):
 if owner is None:
 owner = self.person
@@ -2365,7 +2365,7 @@ class TestCharmRecipeWebservice(TestCaseWithFactory):
 processor=None,
 supports_virtualized=True,
 supports_nonvirtualized=True,
-**kwargs
+**kwargs,
 ):
 if architecturetag is None:
 architecturetag = self.factory.getUniqueUnicode("arch")
diff --git a/lib/lp/code/mail/branch.py b/lib/lp/code/mail/branch.py
index 7eaee76..c880ae5 100644
--- a/lib/lp/code/mail/branch.py
+++ b/lib/lp/code/mail/branch.py
@@ -220,7 +220,7 @@ class BranchMailer(BaseMailer):
 revno=None,
 revision_id=None,
 notification_type=None,
-**kwargs
+**kwargs,
 ):
 super().__init__(
 subject,
diff --git a/lib/lp/code/xmlrpc/tests/test_git.py b/lib/lp/code/xmlrpc/tests/test_git.py
index add6348..d309c5b 100644
--- a/lib/lp/code/xmlrpc/tests/test_git.py
+++ b/lib/lp/code/xmlrpc/tests/test_git.py
@@ -198,7 +198,7 @@ class TestGitAPIMixin:
 path,
 permission="read",
 can_authenticate=False,
-**auth_kwargs
+**auth_kwargs,
 ):
 """Assert that the given path cannot be translated."""
 auth_params = _make_auth_params(
@@ -221,7 +221,7 @@ class TestGitAPIMixin:
 message="Permission denied.",
 permission="read",
 can_authenticate=False,
-**auth_kwargs
+**auth_kwargs,
 ):
 """Assert that looking at the given path returns PermissionDenied."""
 auth_params = _make_auth_params(
@@ -244,7 +244,7 @@ class TestGitAPIMixin:
 message="Authorisation required.",
 permission="read",
 can_authenticate=False,
-**auth_kwargs
+**auth_kwargs,
 ):
 """Assert that looking at the given path returns Unauthorized."""
 auth_params = _make_auth_params(
@@ -356,7 +356,7 @@ class TestGitAPIMixin:
 writable=False,
 trailing="",
 private=False,
-**auth_kwargs
+**auth_kwargs,
 ):
 auth_params = _make_auth_params(
 requester, can_authenticate=can_authenticate, **auth_kwargs
@@ -444,7 +444,7 @@ class TestGitAPIMixin:
 requester,
 git_repository,
 can_authenticate=True,
-**auth_kwargs
+**auth_kwargs,
 ):
 translated_path = git_repository.getInternalPath()
 auth_params = _make_auth_params(
@@ -499,7 +499,7 @@ class TestGitAPIMixin:
 requester,
 git_repository,
 can_authenticate=True,
-**auth_kwargs
+**auth_kwargs,
 ):
 translated_path = git_repository.getInternalPath()
 auth_params = 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:upgrade-type-annotations into launchpad:master

2023-11-28 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:upgrade-type-annotations 
into launchpad:master.

Commit message:
Upgrade variable type annotations to 3.6+ style

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/456419

I haven't quite got as far as upgrading `flake8` since it reports a few other 
issues, but this gets us pretty close.

I had to add `Optional` to a few more places since otherwise `mypy` complained.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:upgrade-type-annotations into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8f1b599..05418f1 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -51,8 +51,6 @@ repos:
 name: isort
 args: [--profile, black]
 -   repo: https://github.com/PyCQA/flake8
-# 6.0.0 drops support for `# type:` comments, which we need until we
-# upgrade to Python >= 3.6.
 rev: 5.0.4
 hooks:
 -   id: flake8
diff --git a/lib/lp/answers/adapters.py b/lib/lp/answers/adapters.py
index 8a3865a..2c19616 100644
--- a/lib/lp/answers/adapters.py
+++ b/lib/lp/answers/adapters.py
@@ -7,7 +7,7 @@ from typing import List
 
 from lp.answers.interfaces.faqtarget import IFAQTarget
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 def question_to_questiontarget(question):
diff --git a/lib/lp/answers/browser/faqcollection.py b/lib/lp/answers/browser/faqcollection.py
index bf05b47..3eb527f 100644
--- a/lib/lp/answers/browser/faqcollection.py
+++ b/lib/lp/answers/browser/faqcollection.py
@@ -31,7 +31,7 @@ from lp.services.webapp.menu import enabled_with_permission
 class FAQCollectionMenu(NavigationMenu):
 """Base menu definition for `IFAQCollection`."""
 
-usedfor = IFAQCollection  # type: Type[Interface]
+usedfor: Type[Interface] = IFAQCollection
 facet = "answers"
 links = ["list_all", "create_faq"]
 
diff --git a/lib/lp/answers/browser/tests/test_question.py b/lib/lp/answers/browser/tests/test_question.py
index c1583aa..a57c08c 100644
--- a/lib/lp/answers/browser/tests/test_question.py
+++ b/lib/lp/answers/browser/tests/test_question.py
@@ -14,7 +14,7 @@ from lp.testing import TestCaseWithFactory, login_person, person_logged_in
 from lp.testing.layers import DatabaseFunctionalLayer
 from lp.testing.views import create_initialized_view
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 class TestQuestionAddView(TestCaseWithFactory):
diff --git a/lib/lp/answers/browser/tests/test_views.py b/lib/lp/answers/browser/tests/test_views.py
index c329907..d08678b 100644
--- a/lib/lp/answers/browser/tests/test_views.py
+++ b/lib/lp/answers/browser/tests/test_views.py
@@ -10,7 +10,7 @@ from lp.testing import BrowserTestCase
 from lp.testing.layers import DatabaseFunctionalLayer
 from lp.testing.systemdocs import LayeredDocFileSuite, setUp, tearDown
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 class TestEmailObfuscated(BrowserTestCase):
diff --git a/lib/lp/answers/mail/__init__.py b/lib/lp/answers/mail/__init__.py
index 11b146c..eb81875 100644
--- a/lib/lp/answers/mail/__init__.py
+++ b/lib/lp/answers/mail/__init__.py
@@ -2,4 +2,4 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 from typing import List
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
diff --git a/lib/lp/answers/security.py b/lib/lp/answers/security.py
index 530b4f8..1ad66c4 100644
--- a/lib/lp/answers/security.py
+++ b/lib/lp/answers/security.py
@@ -17,7 +17,7 @@ from lp.registry.interfaces.distributionsourcepackage import (
 )
 from lp.registry.security import EditByOwnersOrAdmins
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 class AdminQuestion(AuthorizationBase):
diff --git a/lib/lp/answers/tests/test_question_workflow.py b/lib/lp/answers/tests/test_question_workflow.py
index 2569042..28dcdeb 100644
--- a/lib/lp/answers/tests/test_question_workflow.py
+++ b/lib/lp/answers/tests/test_question_workflow.py
@@ -38,7 +38,7 @@ from lp.testing import (
 from lp.testing.fixture import ZopeEventHandlerFixture
 from lp.testing.layers import DatabaseFunctionalLayer
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 class BaseAnswerTrackerWorkflowTestCase(TestCase):
diff --git a/lib/lp/answers/tests/test_questiontarget.py b/lib/lp/answers/tests/test_questiontarget.py
index dcaf579..f2dd83a 100644
--- a/lib/lp/answers/tests/test_questiontarget.py
+++ b/lib/lp/answers/tests/test_questiontarget.py
@@ -17,7 +17,7 @@ from lp.testing import (
 )
 from lp.testing.layers import DatabaseFunctionalLayer
 
-__all__ = []  # type: List[str]
+__all__: List[str] = []
 
 
 class QuestionTargetAnswerContactTestCase(TestCaseWithFactory):
diff --git a/lib/lp/app/__init__.py b/lib/lp/app/__init__.py
index 1df36b8..d847688 100644
--- a/lib/lp/app/__init__.py
+++