[Launchpad-reviewers] [Merge] ~cjwatson/lp-archive:typos into lp-archive:main

2024-04-10 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-archive:typos into 
lp-archive:main.

Commit message:
Fix a couple of typos in the landing page

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Nice job on the new landing page for snapshot.ubuntu.com!  I noticed a couple 
of typos and thought I might as well fix them while I noticed them.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-archive:typos into lp-archive:main.
diff --git a/lp_archive/templates/index.html b/lp_archive/templates/index.html
index 54f2c32..c3825e3 100644
--- a/lp_archive/templates/index.html
+++ b/lp_archive/templates/index.html
@@ -62,7 +62,7 @@ apt policy hello -S 20231102T030400Z
 apt install hello --snapshot 20231102T030400Z
 Note that the apt update --snapshot [snapshot] command needs to be run immediately before the other apt commands. These commands will also fail if the snapshot format is incorrect or the snapshot does not exist (for example, if you try to use a date before that Ubuntu release existed).
 
-Using a specifig Snapshot ID for all apt commands
+Using a specific Snapshot ID for all apt commands
 Enabling snapshots for the repository will allow you to specify a snapshot when using apt, as shown above. Alternatively, it is possible to set apt to use a particular snapshot for all apt commands. To do this, the specific Snapshot ID (e.g. 20230302T030400Z) can be used in the place of “yes” in the relevant source. If a specific snapshot is configured in this way then it will be used even if a different snapshot ID is given as part of an apt command.
 For example, on Ubuntu 24.04 LTS onwards:
 Types: deb
@@ -72,7 +72,7 @@ Components: main universe
 Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
 Snapshot: 20240301T030400Z
 
-Ubuntu security updates. Aside from URIs and Suites,
+## Ubuntu security updates. Aside from URIs and Suites,
 ## this should mirror your choices in the previous section.
 Types: deb
 URIs: http://security.ubuntu.com/ubuntu
___
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/launchpad:drop-py35 into launchpad:master

2024-03-17 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:drop-py35 into 
launchpad:master.

Commit message:
Drop various bits of code to handle Python <= 3.5

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Hi!  I wanted to do a real-world performance test of my new laptop, so I 
thought of doing a full Launchpad test run on it (about 2h, if you're curious - 
it was usually more like 9h on my old laptop by the time I left Canonical), and 
I used a random half-finished refactoring branch I had lying around.  Since it 
passes, you might as well have the results.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:drop-py35 into launchpad:master.
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index d6b2760..fc1c2fc 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -56,7 +56,6 @@ from lp.registry.interfaces.person import IPerson
 from lp.registry.interfaces.product import IProduct
 from lp.registry.interfaces.projectgroup import IProjectGroup
 from lp.registry.interfaces.socialaccount import SOCIAL_PLATFORM_TYPES_MAP
-from lp.services.compat import tzname
 from lp.services.utils import round_half_up
 from lp.services.webapp.authorization import check_permission
 from lp.services.webapp.canonicalurl import nearest_adapter
@@ -1301,8 +1300,7 @@ class PersonFormatterAPI(ObjectFormatterAPI):
 def local_time(self):
 """Return the local time for this person."""
 time_zone = self._context.time_zone
-dt = datetime.now(tz.gettz(time_zone))
-return "%s %s" % (dt.strftime("%T"), tzname(dt))
+return datetime.now(tz.gettz(time_zone)).strftime("%T %Z")
 
 def url(self, view_name=None, rootsite="mainsite"):
 """See `ObjectFormatterAPI`.
@@ -2390,7 +2388,7 @@ class DateTimeFormatterAPI:
 def time(self):
 if self._datetime.tzinfo:
 value = self._datetime.astimezone(getUtility(ILaunchBag).time_zone)
-return "%s %s" % (value.strftime("%T"), tzname(value))
+return value.strftime("%T %Z")
 else:
 return self._datetime.strftime("%T")
 
diff --git a/lib/lp/app/widgets/date.py b/lib/lp/app/widgets/date.py
index 99d8f3f..885518d 100644
--- a/lib/lp/app/widgets/date.py
+++ b/lib/lp/app/widgets/date.py
@@ -33,7 +33,6 @@ from zope.formlib.textwidgets import TextWidget
 from zope.formlib.widget import DisplayWidget
 
 from lp.app.validators import LaunchpadValidationError
-from lp.services.compat import tzname
 from lp.services.utils import round_half_up
 from lp.services.webapp.escaping import html_escape
 from lp.services.webapp.interfaces import ILaunchBag
@@ -638,6 +637,4 @@ class DatetimeDisplayWidget(DisplayWidget):
 if value == self.context.missing_value:
 return ""
 value = value.astimezone(time_zone)
-return html_escape(
-"%s %s" % (value.strftime("%Y-%m-%d %H:%M:%S", tzname(value)))
-)
+return html_escape(value.strftime("%Y-%m-%d %H:%M:%S %Z"))
diff --git a/lib/lp/blueprints/browser/sprint.py b/lib/lp/blueprints/browser/sprint.py
index a22ebaa..91ee23b 100644
--- a/lib/lp/blueprints/browser/sprint.py
+++ b/lib/lp/blueprints/browser/sprint.py
@@ -61,7 +61,6 @@ from lp.registry.browser.menu import (
 RegistryCollectionActionMenuBase,
 )
 from lp.registry.interfaces.person import IPersonSet
-from lp.services.compat import tzname
 from lp.services.database.bulk import load_referencing
 from lp.services.helpers import shortlist
 from lp.services.propertycache import cachedproperty
@@ -225,35 +224,28 @@ class SprintView(HasSpecificationsView):
 def formatDateTime(self, dt):
 """Format a datetime value according to the sprint's time zone"""
 dt = dt.astimezone(self.tzinfo)
-return "%s %s" % (dt.strftime("%Y-%m-%d %H:%M"), tzname(dt))
+return dt.strftime("%Y-%m-%d %H:%M %Z")
 
 def formatDate(self, dt):
 """Format a date value according to the sprint's time zone"""
 dt = dt.astimezone(self.tzinfo)
 return dt.strftime("%Y-%m-%d")
 
-def _formatLocal(self, dt):
-return "%s %s on %s" % (
-dt.strftime("%H:%M"),
-tzname(dt),
-dt.strftime("%A, %Y-%m-%d"),
-)
+_local_timeformat = "%H:%M %Z on %A, %Y-%m-%d"
 
 @property
 def local_start(self):
 """The sprint start time, in the local time zone, as text."""
-return self._formatLocal(
-self.contex

[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: Doma

[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,

[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
i

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:rework-archive-job-series-check into launchpad:master

2023-11-27 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:rework-archive-job-series-check into launchpad:master.

Commit message:
Rework CI build upload series check to use DistroSeriesParent

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

In https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/448906, 
I had to resort to doing series name comparison because I thought that there 
was no proper database-level link between the build and target series in the 
cases where we're using this at present.  I've since realized that was wrong, 
and the two series are linked via the `DistroSeriesParent` table, so we can do 
this more neatly.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:rework-archive-job-series-check into launchpad:master.
diff --git a/lib/lp/soyuz/model/archivejob.py b/lib/lp/soyuz/model/archivejob.py
index 8c9ff5a..b3beedf 100644
--- a/lib/lp/soyuz/model/archivejob.py
+++ b/lib/lp/soyuz/model/archivejob.py
@@ -797,28 +797,28 @@ class CIBuildUploadJob(ArchiveJobDerived):
 continue
 artifact = scanned_artifact.artifact
 library_file = artifact.library_file
-# XXX cjwatson 2023-08-09: Comparing distroseries names here is
-# a pretty unpleasant hack, but it's necessary because in
-# practice what we're doing is taking the output of build jobs
-# that were run on (e.g.) Ubuntu focal and uploading them to
-# (e.g.)  focal.  Unfortunately the
-# private series doesn't have its parent series set to the
-# corresponding Ubuntu series, so we have no way to make the
-# connection other than comparing names.  We need to figure out
-# something better here, but at least this hack isn't too deep
-# in the core of the system.
-if (
-artifact.report.distro_arch_series is not None
-and artifact.report.distro_arch_series.distroseries.name
-!= self.target_distroseries.name
-):
-logger.info(
-"Skipping %s (built for %s, not %s)",
-library_file.filename,
-artifact.report.distro_arch_series.distroseries.name,
-self.target_distroseries.name,
+if artifact.report.distro_arch_series is not None:
+build_distroseries = (
+artifact.report.distro_arch_series.distroseries
 )
-continue
+# It might seem that we ought to check that the build job's
+# series is equal to the target series, but in practice what
+# we're doing is taking the output of build jobs that were
+# run on (e.g.) Ubuntu focal and uploading them to (e.g.)
+#  focal, so we need to check parent
+# series links as well.
+if (
+build_distroseries != self.target_distroseries
+and build_distroseries
+not in self.target_distroseries.getParentSeries()
+):
+logger.info(
+"Skipping %s (built for %s, not %s)",
+library_file.filename,
+build_distroseries.name,
+self.target_distroseries.name,
+)
+continue
 logger.info(
 "Uploading %s to %s %s (%s)",
 library_file.filename,
diff --git a/lib/lp/soyuz/tests/test_archivejob.py b/lib/lp/soyuz/tests/test_archivejob.py
index 4592b7a..3244e4d 100644
--- a/lib/lp/soyuz/tests/test_archivejob.py
+++ b/lib/lp/soyuz/tests/test_archivejob.py
@@ -1660,8 +1660,7 @@ class TestCIBuildUploadJob(TestCaseWithFactory):
 # series are selected.
 #
 # The build distribution is always Ubuntu for now, but the target
-# distribution may differ.  Unfortunately, this currently requires
-# matching on series names.
+# distribution may differ.
 logger = self.useFixture(FakeLogger())
 target_distribution = self.factory.makeDistribution()
 archive = self.factory.makeArchive(
@@ -1672,13 +1671,16 @@ class TestCIBuildUploadJob(TestCaseWithFactory):
 self.factory.makeUbuntuDistroSeries() for _ in range(2)
 ]
 target_distroserieses = [
-self.factory.makeDistroSeries(
-distribution=target_distribution,
-name=ubuntu_distroseries.name,
-version=ubuntu_distroseries.version,
-)
+self.factory.makeDistroSeries(distribution=target_distribution)
 for ubuntu_distros

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-postgresql-extras-push-backups-primary-only into launchpad:master

2023-11-26 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-postgresql-extras-push-backups-primary-only into 
launchpad:master.

Commit message:
charm: Only run push-backups on primary database units

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We don't want to be pushing backups from more than one unit.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-postgresql-extras-push-backups-primary-only into 
launchpad:master.
diff --git a/charm/launchpad-postgresql-extras/files/push-backups b/charm/launchpad-postgresql-extras/files/push-backups
index 8a48574..9e2989d 100755
--- a/charm/launchpad-postgresql-extras/files/push-backups
+++ b/charm/launchpad-postgresql-extras/files/push-backups
@@ -9,6 +9,18 @@ from argparse import ArgumentParser
 from pathlib import Path
 
 
+def is_primary():
+return (
+subprocess.run(
+["psql", "-At", "-c", "SELECT pg_is_in_recovery();"],
+capture_output=True,
+check=True,
+text=True,
+).stdout.strip()
+== "f"
+)
+
+
 def find_latest_dumps(backups_path, database, count):
 yield from sorted(backups_path.glob(f"{glob.escape(database)}.*.dump"))[
 -count:
@@ -49,6 +61,9 @@ def main():
 parser.add_argument("databases", metavar="database", nargs="+")
 args = parser.parse_args()
 
+if not is_primary():
+return
+
 command = ["rsync"]
 if args.bwlimit is not None:
 command.append(f"--bwlimit={args.bwlimit}")
___
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/launchpad:simplify-git-branch-handling into launchpad:master

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:simplify-git-branch-handling into launchpad:master.

Commit message:
Revert "Restore compatibility with xenial's git"

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This reverts commit 2e6a49ed728bd461999fdc5bba7ef63a86e83882, since we now 
require focal so we might as well.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:simplify-git-branch-handling into launchpad:master.
diff --git a/Makefile b/Makefile
index 7bb06c0..a310604 100644
--- a/Makefile
+++ b/Makefile
@@ -88,10 +88,7 @@ PIP_BIN = \
 
 # Create archives in labelled directories (e.g.
 # /$(PROJECT_NAME).tar.gz)
-# XXX cjwatson 2023-04-11: Should be "git branch --show-current", but
-# xenial's git doesn't support that.  Use the more concise form once we
-# require focal.
-GIT_BRANCH := $(shell if [ -d .git ]; then git rev-parse --abbrev-ref HEAD; fi)
+GIT_BRANCH := $(shell if [ -d .git ]; then git branch --show-current; fi)
 TARBALL_REVISION ?= $(shell if [ -d .git ]; then git rev-parse HEAD; fi)
 ifeq ($(GIT_BRANCH),db-devel)
 TARBALL_SUFFIX := db
___
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/launchpad:preflight-juju-fragile-users into launchpad:master

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:preflight-juju-fragile-users into launchpad:master.

Commit message:
preflight: Add Juju-style user names to FRAGILE_USERS

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The preflight checks got a lot less useful when we switched to Juju 
deployments, because to simplify credentials management we connect as a 
per-charm user and then switch to the real target role after connecting, but 
`pg_stat_activity` only shows the original user name.  For safety, fail 
preflight checks if any of the Juju-style user names associated with publishers 
or upload processors are connected.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:preflight-juju-fragile-users into launchpad:master.
diff --git a/database/schema/preflight.py b/database/schema/preflight.py
index f5c42f6..6bf87be 100755
--- a/database/schema/preflight.py
+++ b/database/schema/preflight.py
@@ -35,6 +35,15 @@ SYSTEM_USERS = {"postgres", "slony", "nagios", "lagmon"}
 # connected, so these systems will need to be shut down manually before
 # a database update.
 FRAGILE_USERS = {
+# With Juju, we switch to the target role after connecting;
+# unfortunately pg_stat_activity only shows us the user as which we
+# originally connected.  Until and unless we can devise a way to find
+# the actual role, we need these more general entries.
+"juju_launchpad-copy-archive-publisher",
+"juju_launchpad-ftpmaster-publisher",
+"juju_launchpad-ftpmaster-uploader",
+"juju_launchpad-ppa-publisher",
+"juju_launchpad-ppa-uploader",
 # process_accepted is fragile, but also fast so we likely shouldn't
 # need to ever manually shut it down.
 "process_accepted",
___
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/launchpad:charm-push-backups-run-one into launchpad:master

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-push-backups-run-one into launchpad:master.

Commit message:
charm: Run postgresql-extras push-backups under run-one

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It's quite plausible for pushing production DB backups to staging to take more 
than the cron job frequency (an hour), so we should ensure that we don't run 
multiple copies of this script at once.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-push-backups-run-one into launchpad:master.
diff --git a/charm/launchpad-postgresql-extras/layer.yaml b/charm/launchpad-postgresql-extras/layer.yaml
index 879d9e6..3b21362 100644
--- a/charm/launchpad-postgresql-extras/layer.yaml
+++ b/charm/launchpad-postgresql-extras/layer.yaml
@@ -8,3 +8,4 @@ options:
 packages:
   - launchpad-database-dependencies
   - pgbouncer
+  - run-one
diff --git a/charm/launchpad-postgresql-extras/templates/crontab.j2 b/charm/launchpad-postgresql-extras/templates/crontab.j2
index d9e4d5e..d061b81 100644
--- a/charm/launchpad-postgresql-extras/templates/crontab.j2
+++ b/charm/launchpad-postgresql-extras/templates/crontab.j2
@@ -4,6 +4,6 @@ MAILTO={{ cron_mailto }}
 {% if push_backups_databases and push_backups_destination -%}
 # The PostgreSQL charm handles backups, but on production we also need to
 # push backups to staging for weekly restores.
-22 * * * * postgres	{{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_destination }} {{ push_backups_databases }}
+22 * * * * postgres	run-one {{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_destination }} {{ push_backups_databases }}
 {% endif %}
 
___
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/launchpad:staging-restore-in-place-again into launchpad:master

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:staging-restore-in-place-again into launchpad:master.

Commit message:
Remove conflicting --dbname options

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

`--dbname` is already set up by `lp.services.scripts.db_options` with a 
suitable default; trying to define it again results in a "conflicting option 
string" error.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:staging-restore-in-place-again into launchpad:master.
diff --git a/database/schema/security.py b/database/schema/security.py
index 0f2af6e..d742577 100755
--- a/database/schema/security.py
+++ b/database/schema/security.py
@@ -760,16 +760,6 @@ if __name__ == "__main__":
 default="postgres",
 help="Owner of PostgreSQL objects",
 )
-parser.add_option(
-"--dbname",
-dest="dbname",
-default=None,
-metavar="DBNAME",
-help=(
-"Connect to DBNAME instead of the database name configured in "
-"LPCONFIG."
-),
-)
 db_options(parser)
 logger_options(parser)
 
diff --git a/database/schema/upgrade.py b/database/schema/upgrade.py
index d42369a..a65a10a 100755
--- a/database/schema/upgrade.py
+++ b/database/schema/upgrade.py
@@ -337,16 +337,6 @@ if __name__ == "__main__":
 action="store_true",
 help="Apply each patch in a separate session",
 )
-parser.add_option(
-"--dbname",
-dest="dbname",
-default=None,
-metavar="DBNAME",
-help=(
-"Connect to DBNAME instead of the database name configured in "
-"LPCONFIG."
-),
-)
 (options, args) = parser.parse_args()
 
 if args:
___
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] ~xnox/launchpad:drop-i18n-index into launchpad:master

2023-11-22 Thread Colin Watson
Review: Approve



Diff comments:

> diff --git a/lib/lp/registry/interfaces/distroseries.py 
> b/lib/lp/registry/interfaces/distroseries.py
> index bcb5a24..d27ac20 100644
> --- a/lib/lp/registry/interfaces/distroseries.py
> +++ b/lib/lp/registry/interfaces/distroseries.py
> @@ -585,6 +585,17 @@ class IDistroSeriesPublic(
>  as_of="devel",
>  )
>  
> +publish_i18n_index = exported(
> +Bool(
> +title=_("Publish I18n index"),
> +required=True,
> +description=_(
> +"""
> +Publish archive i18n/Index file, which is believed to be used."""

Was this meant to say "which is believed to be unused"?

> +),
> +)
> +)
> +
>  inherit_overrides_from_parents = Bool(
>  title=_("Inherit overrides from parents"),
>  readonly=False,


-- 
https://code.launchpad.net/~xnox/launchpad/+git/launchpad/+merge/453586
Your team Launchpad code reviewers is requested to review the proposed merge of 
~xnox/launchpad:drop-i18n-index into launchpad:master.


___
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/launchpad-buildd:doc-qastaging into launchpad-buildd:master

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad-buildd:doc-qastaging into 
launchpad-buildd:master.

Commit message:
doc: Replace dogfood with qastaging

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Launchpad's "dogfood" instance will probably be going away soon, so talk about 
qastaging instead of dogfood.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-buildd:doc-qastaging into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 36aabb9..4849b34 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ launchpad-buildd (236) UNRELEASED; urgency=medium
 https://bugs.launchpad.net/ubuntu/xenial/+source/systemd/+bug/1962332.)
   * Update deployment docs: riscv64 builders are no longer managed
 separately.
+  * Document deployment to qastaging in place of dogfood.
 
  -- Colin Watson   Thu, 16 Nov 2023 16:06:07 +
 
diff --git a/docs/how-to/deployment.rst b/docs/how-to/deployment.rst
index 2497c9b..7365bee 100644
--- a/docs/how-to/deployment.rst
+++ b/docs/how-to/deployment.rst
@@ -7,22 +7,22 @@ rebuild the VM images.
 
 Each environment uses its own PPA and management environment:
 
-+--++
-| Environment  | PPA and management environment |
-+==++
-| `production <https://launchpad.net/builders>`_   | `ppa:launchpad/ubuntu/buildd <https://launchpad.net/~launchpad/+archive/ubuntu/buildd/+packages>`_ |
-|  | ``prod-launchpad-vbuilders@is-bastion-ps5``|
-+--++
-| `dogfood <https://dogfood.paddev.net/builders>`_ | `ppa:launchpad/ubuntu/buildd-staging <https://launchpad.net/~launchpad/+archive/ubuntu/buildd-staging/+packages>`_ |
-|  | ``stg-vbuilder@launchpad-bastion-ps5`` |
-+--++
++-++
+| Environment | PPA and management environment |
++=++
+| `production <https://launchpad.net/builders>`_  | `ppa:launchpad/ubuntu/buildd <https://launchpad.net/~launchpad/+archive/ubuntu/buildd/+packages>`_ |
+| | ``prod-launchpad-vbuilders@is-bastion-ps5``|
++-++
+| `qastaging <https://qastaging.launchpad.net/builders>`_ | `ppa:launchpad/ubuntu/buildd-staging <https://launchpad.net/~launchpad/+archive/ubuntu/buildd-staging/+packages>`_ |
+| | ``stg-vbuilder-qastaging@launchpad-bastion-ps5``   |
++-++
 
 These instructions use various tools from `ubuntu-archive-tools
 <https://git.launchpad.net/ubuntu-archive-tools>`_ (``copy-package`` and
 ``manage-builders``).
 
-Testing on dogfood
---
+Testing on qastaging
+
 
 #. Ensure everything has been merged to master.
 
@@ -36,7 +36,7 @@ Testing on dogfood
--to=ppa:launchpad/ubuntu/buildd-staging -b launchpad-buildd``
(from ``ubuntu-

[Launchpad-reviewers] [Merge] ~cjwatson/lp-archive:doc-qastaging into lp-archive:main

2023-11-22 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-archive:doc-qastaging into 
lp-archive:main.

Commit message:
doc: Explain qastaging deployment

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Launchpad's "dogfood" instance will probably be going away soon, so talk about 
qastaging instead of dogfood.  This does mean that it's much less obvious how 
to set up a full development environment for developers and so the 
documentation in the top-level README has got more awkward, but in practice 
that was mainly a stopgap until we got initial deployments working.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-archive:doc-qastaging into lp-archive:main.
diff --git a/README.rst b/README.rst
index 72753c7..dd1b2e8 100644
--- a/README.rst
+++ b/README.rst
@@ -11,22 +11,21 @@ Development environment
 
 To run tests, use ``tox``.
 
-Running a local development server requires some setup and can only be done
-if you have privileged access to a suitable Launchpad environment.
-Launchpad staff can start by setting up an SSH tunnel to the "dogfood"
-environment, in a separate terminal::
-
-$ ssh -L 8097:xmlrpc.dogfood.lp.internal:8097 labbu.canonical.com
-
-Add ``127.0.0.1 xmlrpc.dogfood.lp.internal`` to ``/etc/hosts`` on your
-development system to fool it into connecting via this tunnel.
+In most cases, running a local development server is likely to be overkill;
+``lp-archive`` is a simple frontend and most interesting changes need to be
+made on the Launchpad backend instead.  If you really need to, then it requires
+some setup and can only be done if you have privileged access to a suitable
+Launchpad environment.  You'll need to deploy Launchpad itself and work out how
+to inject some useful content into it; full details are out of scope for this
+document, but start with the `LP mojo spec
+<https://git.launchpad.net/launchpad-mojo-specs/tree/lp/README.md>`_.
 
 You'll then need a ``config.toml`` file telling ``lp-archive`` what URL
 layout to expose.  For example:
 
 .. code-block:: toml
 
-ARCHIVE_ENDPOINT = "http://xmlrpc.dogfood.lp.internal:8097/archive;
+ARCHIVE_ENDPOINT = "http://xmlrpc.launchpad.test:8087/archive;
 CACHE_TYPE = "SimpleCache"
 
 [[LAYOUTS]]
diff --git a/docs/how-to/deployment.rst b/docs/how-to/deployment.rst
index ae7d608..4c99f73 100644
--- a/docs/how-to/deployment.rst
+++ b/docs/how-to/deployment.rst
@@ -1,19 +1,19 @@
 Deploying lp-archive
 
 
-The dogfood and production instances of ``lp-archive`` are deployed in PS5.
-Each instance has its own management environment:
+The qastaging and production instances of ``lp-archive`` are deployed in
+PS5.  Each instance has its own management environment:
 
-++--+
-| Instance   | Management environment   |
-++==+
-| production | ``prod-launchpad-archive@is-bastion-ps5.internal``   |
-++--+
-| dogfood| ``stg-launchpad-archive@launchpad-bastion-ps5.internal`` |
-++--+
++++
+| Instance   | Management environment |
++++
+| production | ``prod-launchpad-archive@is-bastion-ps5.internal`` |
++++
+| qastaging  | ``stg-launchpad-archive-qastaging@launchpad-bastion-ps5.internal`` |
++++
 
 Both instances are deployed by developers using `Mojo
-<https://mojo.canonical.com/>`_.  The dogfood instance is managed by us
+<https://mojo.canonical.com/>`_.  The qastaging instance is managed by us
 directly, including the ability to ``juju ssh`` to units and inspect them.
 The production instance is managed by IS and we don't have direct access to
 units (since they have business-critical uptime requirements), but we have
@@ -35,8 +35,8 @@ used to track QA.  The `history of the Mojo spec
 <https://git.launchpad.net/launchpad-mojo-specs/log/lp-archive>`_ serves as
 a log of changes.
 
-Deploying to dogfood
-
+Deploying to qastaging
+--
 
 #. Check that the commit you want to deploy has had a deployment artifact
built by the corresponding `build job
@@ -58,16 +58,16 @@ Deploying to dogfood
* If you're only making changes of this form, then you can push them
  dir

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:staging-restore-in-place-again into launchpad:master

2023-11-21 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:staging-restore-in-place-again into launchpad:master.

Commit message:
Revert "Build staging db inplace due to lack of disk space"

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This reverts commit 23d8c45e49f6e3338c8d6c10ce1fb55237738700 in principle, with 
some further changes to work properly in a charmed deployment.  The new staging 
database servers have disk space for two copies of the database with some left 
over, so that should be enough to go back to the switching strategy, meaning 
that staging should no longer need to be down over the weekend.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:staging-restore-in-place-again into launchpad:master.
diff --git a/database/replication/Makefile b/database/replication/Makefile
index 2f69cc0..950c1c4 100644
--- a/database/replication/Makefile
+++ b/database/replication/Makefile
@@ -26,7 +26,6 @@
 ## MULTIPROC=-j 4
 MULTIPROC=
 
-NEW_STAGING_CONFIG=staging-setup # For building the db with a different name.
 STAGING_CONFIG=staging-db # For swapping fresh db into place.
 STAGING_DUMP=launchpad.dump # Dumpfile to build new staging from.
 STAGING_TABLESPACE=pg_default # 'pg_default' for default
@@ -71,24 +70,17 @@ SHHH=
 default:
 	echo Need a target
 
-# Destroy the existing staging db and reload it from dump. We no longer
-# have enough disk space to build it in a holding area and swap it into
-# place.
+# Build _new staging databases from a production dump.
 stagingsetup: DUMPLIST:=$(shell tempfile --suffix=.lst --prefix=lpstag)
 stagingsetup:
-	# List the dump first to make sure it is usable before destroying
-	# anything.
+	# List the dump first to make sure it is usable.
 	pg_restore --list ${STAGING_DUMP} | \
 	grep -v -E 'TRIGGER public [^ ]+ _sl_' > ${DUMPLIST}
 
-	# Deny new connections to the main DBs and kill any leftovers.
-	set -e; for verb in DISABLE KILL RESUME; do \
-		for db in ${STAGING_PGBOUNCER_MAIN}; do \
-			${STAGING_PGBOUNCER} -c "$$verb $$db"; \
-		done; \
-	done
+	# Kill the existing temporary staging database if it exists from an
+	# aborted run.
 	-LPCONFIG=${STAGING_CONFIG} LP_DESTROY_REMOTE_DATABASE=yes \
-		${PGMASSACRE} ${STAGING_DBNAME_MAIN}
+		${PGMASSACRE} ${STAGING_DBNAME_MAIN}_new
 
 	# Quickly clear out the session DB. No need to DISABLE here, as
 	# we bring the DB back quickly.
@@ -98,32 +90,44 @@ stagingsetup:
 
 	# Create the DB with the desired default tablespace.
 	${CREATEDB} ${STAGING_DBOPTS} --tablespace ${STAGING_TABLESPACE} \
-		${STAGING_DBNAME_MAIN}
+		${STAGING_DBNAME_MAIN}_new
 	# Restore the database. We need to restore permissions, despite
 	# later running security.py, to pull in permissions granted on
 	# production to users not maintained by security.py.
 	< ${STAGING_DUMP} ${STAGING_WALBLOCK} \
-	| pg_restore ${STAGING_DBOPTS} --dbname=${STAGING_DBNAME_MAIN} \
+	| pg_restore ${STAGING_DBOPTS} --dbname=${STAGING_DBNAME_MAIN}_new \
 		--no-owner ${EXIT_ON_ERROR} \
 		--use-list=${DUMPLIST} -v
 	rm ${DUMPLIST}
 	# Apply database patches.
 	@echo Running upgrade.py `date`.
 	LPCONFIG=${STAGING_CONFIG} ${SHHH} ../schema/upgrade.py \
-	--log-file=INFO:${STAGING_LOGDIR}/dbupgrade.log
+		--dbname=${STAGING_DBNAME_MAIN}_new \
+		--log-file=INFO:${STAGING_LOGDIR}/dbupgrade.log
 	@echo Running security.py `date`
 	LPCONFIG=${STAGING_CONFIG} ${SHHH} ../schema/security.py \
-	--log-file=INFO:${STAGING_LOGDIR}/dbupgrade.log
+		--dbname=${STAGING_DBNAME_MAIN}_new \
+		--log-file=INFO:${STAGING_LOGDIR}/dbupgrade.log
 	@echo Setting feature flags
-	psql ${STAGING_DBOPTS} -d ${STAGING_DBNAME_MAIN} -c "INSERT INTO featureflag (flag, scope, priority, value) VALUES ('profiling.enabled', 'team:launchpad', 0, 'on') ON CONFLICT DO NOTHING"
-	psql ${STAGING_DBOPTS} -d ${STAGING_DBNAME_MAIN} -c "INSERT INTO featureflag (flag, scope, priority, value) VALUES ('librarian.swift.enabled', 'default', 0, 'on') ON CONFLICT DO NOTHING"
+	psql ${STAGING_DBOPTS} -d ${STAGING_DBNAME_MAIN}_new -c "INSERT INTO featureflag (flag, scope, priority, value) VALUES ('profiling.enabled', 'team:launchpad', 0, 'on') ON CONFLICT DO NOTHING"
+	psql ${STAGING_DBOPTS} -d ${STAGING_DBNAME_MAIN}_new -c "INSERT INTO featureflag (flag, scope, priority, value) VALUES ('librarian.swift.enabled', 'default', 0, 'on') ON CONFLICT DO NOTHING"
+
+stagingswitch:
+	set -e; for verb in DISABLE KILL RESUME; do \
+		for db in ${STAGING_PGBOUNCER_MAIN}; do \
+			${STAGING_PGBOUNCER} -c "$$verb $$db"; \
+		done; \
+	done
+	# Kill the existing staging database if it exists.
+	-LPCONFIG=${STAGING_CONFIG} LP_DESTROY_REMOTE_DATABASE=yes \
+		${PGMASSACRE} lpmain_staging
+	# Rename the newly-built staging databases.
+	psql ${STAGING_DBOPT

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:gpg-eddsa into launchpad:master

2023-11-21 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:gpg-eddsa into 
launchpad:master.

Commit message:
Add support for EdDSA GnuPG keys

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1827369 in Launchpad itself: "Launchpad cannot handle ECC or Ed25519 
OpenPGP keys"
  https://bugs.launchpad.net/launchpad/+bug/1827369

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

These should work now that we're running on focal.

I'm afraid unit testing for this slightly defeated me in the time available, 
but I've at least manually tested that `gpghandler.retrieveKey` now works for 
an EdDSA key, which I think demonstrated the underlying problems on xenial.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:gpg-eddsa into launchpad:master.
diff --git a/lib/lp/registry/model/gpgkey.py b/lib/lp/registry/model/gpgkey.py
index eb34738..f499faf 100644
--- a/lib/lp/registry/model/gpgkey.py
+++ b/lib/lp/registry/model/gpgkey.py
@@ -11,7 +11,11 @@ from lp.registry.interfaces.gpg import IGPGKey, IGPGKeySet
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
-from lp.services.gpg.interfaces import GPGKeyAlgorithm, IGPGHandler
+from lp.services.gpg.interfaces import (
+GPGKeyAlgorithm,
+IGPGHandler,
+gpg_algorithm_letter,
+)
 from lp.services.verification.model.logintoken import LoginToken
 
 
@@ -67,7 +71,7 @@ class GPGKey(StormBase):
 def displayname(self):
 return "%s%s/%s" % (
 self.keysize,
-self.algorithm.title,
+gpg_algorithm_letter(self.algorithm),
 self.fingerprint,
 )
 
diff --git a/lib/lp/registry/templates/person-editpgpkeys.pt b/lib/lp/registry/templates/person-editpgpkeys.pt
index f6dd57b..169c5f0 100644
--- a/lib/lp/registry/templates/person-editpgpkeys.pt
+++ b/lib/lp/registry/templates/person-editpgpkeys.pt
@@ -163,12 +163,6 @@
 fingerprint)
   
 
-  
-At present, only RSA, DSA, and some ECC keys are supported; see
-https://bugs.launchpad.net/launchpad/+bug/1827369;>bug
-1827369 for details on the state of support for other key types.
-  
-
   
 
   
diff --git a/lib/lp/services/gpg/handler.py b/lib/lp/services/gpg/handler.py
index bb354e0..b994f7d 100644
--- a/lib/lp/services/gpg/handler.py
+++ b/lib/lp/services/gpg/handler.py
@@ -48,6 +48,7 @@ from lp.services.gpg.interfaces import (
 get_gpg_home_directory,
 get_gpg_path,
 get_gpgme_context,
+gpg_algorithm_letter,
 valid_fingerprint,
 )
 from lp.services.signing.enums import SigningKeyType
@@ -672,7 +673,7 @@ class PymeKey:
 def displayname(self):
 return "%s%s/%s" % (
 self.keysize,
-self.algorithm.title,
+gpg_algorithm_letter(self.algorithm),
 self.fingerprint,
 )
 
diff --git a/lib/lp/services/gpg/interfaces.py b/lib/lp/services/gpg/interfaces.py
index 6dec53a..1aecb5d 100644
--- a/lib/lp/services/gpg/interfaces.py
+++ b/lib/lp/services/gpg/interfaces.py
@@ -15,6 +15,7 @@ __all__ = [
 "GPGKeyTemporarilyNotFoundError",
 "GPGUploadFailure",
 "GPGVerificationError",
+"gpg_algorithm_letter",
 "IGPGHandler",
 "IPymeKey",
 "IPymeSignature",
@@ -119,75 +120,45 @@ def get_gpgme_context():
 return context
 
 
-# XXX: cprov 2004-10-04:
-# (gpg+dbschema) the data structure should be rearranged to support 4 field
-# needed: keynumber(1,16,17,20), keyalias(R,g,D,G), title and description
 class GPGKeyAlgorithm(DBEnumeratedType):
 """
-GPG Compliant Key Algorithms Types:
-
-1  : "R", # RSA
-16 : "g", # ElGamal
-17 : "D", # DSA
-20 : "G", # ElGamal, compromised
-301: "E", # ECDSA
-302: "e", # ECDH
-
-See `pubkey_letter` in GnuPG for the single-letter codes used here.
-
-FIXME
-Rewrite it according to the experimental API returning also a name
-attribute tested on 'algorithmname' attribute
+GPG Public Key Algorithm
 
+The numbers must match those in `gpgme_hash_algo_t`
+(https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=src/gpgme.h.in).
 """
 
-R = DBItem(
-1,
-"""
-R
-
-RSA""",
-)
-
-LITTLE_G = DBItem(
-16,
-"""
- g
+R = DBItem(1, "RSA")
+LITTLE_G = DBItem(16, "ElGamal")
+D = DBItem(17, "DSA")
+G = DBItem(20, "ElGamal, compromised")
+ECDSA = DBItem(301, "ECDSA")
+ECDH = DBItem(302, "ECDH")
+  

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

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

Commit message:
Run "pyupgrade --py38-plus"

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This drops support for running on xenial.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:pyupgrade-py38 into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 55d7cf5..8f1b599 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -29,7 +29,7 @@ repos:
 rev: v3.15.0
 hooks:
 -   id: pyupgrade
-args: [--keep-percent-format]
+args: [--keep-percent-format, --py38-plus]
 exclude: |
   (?x)^(
 lib/contrib/.*
diff --git a/charm/launchpad-postgresql-extras/files/push-backups b/charm/launchpad-postgresql-extras/files/push-backups
index 8a48574..68c3b46 100755
--- a/charm/launchpad-postgresql-extras/files/push-backups
+++ b/charm/launchpad-postgresql-extras/files/push-backups
@@ -71,7 +71,7 @@ def main():
 command.extend([f"{args.backups_path}/", destination])
 
 if args.dry_run:
-print("Would run:", " ".join(shlex.quote(arg) for arg in command))
+print("Would run:", shlex.join(command))
 else:
 subprocess.run(command, check=True)
 
diff --git a/database/schema/upgrade.py b/database/schema/upgrade.py
index ee21fb1..a265588 100755
--- a/database/schema/upgrade.py
+++ b/database/schema/upgrade.py
@@ -291,12 +291,12 @@ def get_vcs_details():
 branch_nick = subprocess.check_output(
 ["git", "rev-parse", "--abbrev-ref", "HEAD"],
 cwd=SCHEMA_DIR,
-universal_newlines=True,
+text=True,
 ).rstrip("\n")
 revision_id = subprocess.check_output(
 ["git", "rev-parse", "HEAD"],
 cwd=SCHEMA_DIR,
-universal_newlines=True,
+text=True,
 ).rstrip("\n")
 else:
 branch_nick, revision_id = None, None
diff --git a/lib/lp/app/browser/tests/test_stringformatter.py b/lib/lp/app/browser/tests/test_stringformatter.py
index 78a332f..4df6954 100644
--- a/lib/lp/app/browser/tests/test_stringformatter.py
+++ b/lib/lp/app/browser/tests/test_stringformatter.py
@@ -829,7 +829,7 @@ class MarksDownAs(Matcher):
 self.expected_html = expected_html
 
 def __str__(self):
-return "MarksDownAs({!r})".format(self.expected_html)
+return f"MarksDownAs({self.expected_html!r})"
 
 def match(self, input_string):
 return Equals(self.expected_html).match(
diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py
index 529118e..94885ea 100644
--- a/lib/lp/archivepublisher/model/ftparchive.py
+++ b/lib/lp/archivepublisher/model/ftparchive.py
@@ -550,10 +550,10 @@ class FTPArchiveHandler:
 self._config.overrideroot,
 "override.%s.extra.%s" % (suite, component),
 )
-ef_override_new = "{}.new".format(ef_override)
+ef_override_new = f"{ef_override}.new"
 # Create the files as .new and then move into place to prevent
 # race conditions with other processes handling these files
-main_override_new = "{}.new".format(main_override)
+main_override_new = f"{main_override}.new"
 source_override = os.path.join(
 self._config.overrideroot,
 "override.%s.%s.src" % (suite, component),
@@ -632,7 +632,7 @@ class FTPArchiveHandler:
 
 def _outputSimpleOverrides(filename, overrides):
 # Write to a different file, then move into place
-filename_new = "{}.new".format(filename)
+filename_new = f"{filename}.new"
 sf = open(filename_new, "w")
 for tup in overrides:
 sf.write("\t".join(tup))
@@ -850,7 +850,7 @@ class FTPArchiveHandler:
 # Prevent race conditions with other processes handling these
 # files, create as .new and then move into place
 new_path = os.path.join(
-self._config.overrideroot, "{}.new".format(filename)
+self._config.overrideroot, f"{filename}.new"
 )
 final_path = os.path.join(self._config.overrideroot, filename)
 with open(new_path, "w") as f:
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 354ca4a..99b2a61 100644
--- a/lib/lp/archivep

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-push-backups-argument-ordering into launchpad:master

2023-11-21 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-push-backups-argument-ordering into launchpad:master.

Commit message:
charm: Fix argument ordering in postgresql-extras cron job

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The list of database names is defined with `nargs="+"` in the `push-backups` 
script, so it has to come at the end.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-push-backups-argument-ordering into launchpad:master.
diff --git a/charm/launchpad-postgresql-extras/templates/crontab.j2 b/charm/launchpad-postgresql-extras/templates/crontab.j2
index f873f31..d9e4d5e 100644
--- a/charm/launchpad-postgresql-extras/templates/crontab.j2
+++ b/charm/launchpad-postgresql-extras/templates/crontab.j2
@@ -4,6 +4,6 @@ MAILTO={{ cron_mailto }}
 {% if push_backups_databases and push_backups_destination -%}
 # The PostgreSQL charm handles backups, but on production we also need to
 # push backups to staging for weekly restores.
-22 * * * * postgres	{{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_databases }} {{ push_backups_destination }}
+22 * * * * postgres	{{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_destination }} {{ push_backups_databases }}
 {% endif %}
 
___
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/launchpad:fix-swift-db-pruning into launchpad:master

2023-11-21 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:fix-swift-db-pruning into 
launchpad:master.

Commit message:
Fix pruning of DB branch builds from Swift

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It makes no sense to prune DB builds when they're older than what's on staging, 
and I don't know what I was thinking when I wrote that; staging is updated 
frequently, so in practice what this means is that we prune a bunch of builds 
that are newer than production.  What we actually need to do is to prune builds 
that are older than the DB revision deployed to production.

Figuring this out is unfortunately challenging, but I found what seems to be a 
viable approach of fetching the deployment bundle and picking it out from there.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:fix-swift-db-pruning into launchpad:master.
diff --git a/setup.cfg b/setup.cfg
index 51645e8..a08e2f0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,6 +36,7 @@ install_requires =
 gunicorn
 importlib-resources; python_version < "3.7"
 ipython
+Jinja2
 jsautobuild
 kombu
 launchpad-buildd
diff --git a/utilities/publish-to-swift b/utilities/publish-to-swift
index e031dea..566d111 100755
--- a/utilities/publish-to-swift
+++ b/utilities/publish-to-swift
@@ -13,6 +13,8 @@ from argparse import ArgumentParser
 
 import iso8601
 import requests
+import yaml
+from jinja2 import Environment, FunctionLoader
 from swiftclient.service import (
 SwiftService,
 SwiftUploadObject,
@@ -82,19 +84,35 @@ def prune_old_files_from_swift(options, container_name, object_dir, suffix):
 if suffix:
 suffix = "-" + suffix
 if suffix.endswith("-db"):
+# It's difficult for the Launchpad web application to publish the
+# currently-deployed revision of its database branch.  The easiest
+# approach seems to be to pick it out of the Juju bundle we deploy.
 try:
-response = requests.head("https://staging.launchpad.net/;)
+response = requests.get(
+"https://git.launchpad.net/launchpad-mojo-specs/plain/;
+"lp/bundle.yaml"
+)
 response.raise_for_status()
 except requests.RequestException:
-# Staging is routinely down in order to restore its database
-# from a recent production dump, so don't consider this an
-# error; just skip pruning if we can't determine its revision.
-print("staging.launchpad.net is down; not pruning.")
+print("git.launchpad.net is down; not pruning.")
 return
+template_env = Environment(
+loader=FunctionLoader(lambda _: response.text)
+)
+template = template_env.get_template("bundle.yaml")
+bundle = yaml.safe_load(
+template.render(
+{"charm_dir": "fake-charm-dir", "stage_name": "production"}
+)
+)
+db_update = bundle["applications"]["launchpad-db-update"]
+deployed_revision = db_update["options"]["build_label"]
+if deployed_revision.endswith("-db"):
+deployed_revision = deployed_revision[: -len("-db")]
 else:
 response = requests.head("https://launchpad.net/;)
 response.raise_for_status()
-deployed_revision = response.headers["X-VCS-Revision"]
+deployed_revision = response.headers["X-VCS-Revision"]
 
 with SwiftService(options=options) as swift:
 objs = {}
___
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] lp:~ines-almeida/canonical-mojo-specs/remove-old-ppa-units into lp:canonical-mojo-specs

2023-11-21 Thread Colin Watson
This is a duplicate of 
https://code.launchpad.net/~cjwatson/canonical-mojo-specs/lp-remove-old-ppa/+merge/455789.
-- 
https://code.launchpad.net/~ines-almeida/canonical-mojo-specs/remove-old-ppa-units/+merge/455961
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~ines-almeida/canonical-mojo-specs/remove-old-ppa-units into 
lp:canonical-mojo-specs.


___
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/launchpad:mirror-prober-silence-tunnel-errors into launchpad:master

2023-11-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:mirror-prober-silence-tunnel-errors into launchpad:master.

Commit message:
Silence TunnelError OOPSes from the mirror prober

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

These are expected in normal operation (since proxied `CONNECT` requests to 
remote hosts might fail for all sorts of reasons), and they're very noisy in 
OOPS reports.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:mirror-prober-silence-tunnel-errors into launchpad:master.
diff --git a/lib/lp/registry/scripts/distributionmirror_prober.py b/lib/lp/registry/scripts/distributionmirror_prober.py
index f2fa888..9dd2cf2 100644
--- a/lib/lp/registry/scripts/distributionmirror_prober.py
+++ b/lib/lp/registry/scripts/distributionmirror_prober.py
@@ -41,7 +41,7 @@ from lp.registry.interfaces.distributionmirror import (
 )
 from lp.registry.interfaces.distroseries import IDistroSeries
 from lp.services.config import config
-from lp.services.httpproxy.connect_tunneling import TunnelingAgent
+from lp.services.httpproxy.connect_tunneling import TunnelError, TunnelingAgent
 from lp.services.librarian.interfaces import ILibraryFileAliasSet
 from lp.services.timeout import urlfetch
 from lp.services.webapp import canonical_url
@@ -661,6 +661,7 @@ class ArchiveMirrorProberCallbacks(LoggingMixin):
 ConnectionSkipped,
 InvalidHTTPSCertificate,
 InvalidHTTPSCertificateSkipped,
+TunnelError,
 )
 
 def __init__(
@@ -834,6 +835,7 @@ class MirrorCDImageProberCallbacks(LoggingMixin):
 UnknownURLSchemeAfterRedirect,
 InvalidHTTPSCertificate,
 InvalidHTTPSCertificateSkipped,
+TunnelError,
 )
 
 def __init__(self, mirror, distroseries, flavour, log_file):
diff --git a/lib/lp/registry/tests/test_distributionmirror_prober.py b/lib/lp/registry/tests/test_distributionmirror_prober.py
index 244d05c..aed0097 100644
--- a/lib/lp/registry/tests/test_distributionmirror_prober.py
+++ b/lib/lp/registry/tests/test_distributionmirror_prober.py
@@ -77,7 +77,7 @@ from lp.registry.tests.distributionmirror_http_server import (
 from lp.services.config import config
 from lp.services.daemons.tachandler import TacTestSetup
 from lp.services.database.interfaces import IStore
-from lp.services.httpproxy.connect_tunneling import TunnelingAgent
+from lp.services.httpproxy.connect_tunneling import TunnelError, TunnelingAgent
 from lp.services.timeout import default_timeout
 from lp.testing import (
 TestCase,
@@ -985,6 +985,7 @@ class TestMirrorCDImageProberCallbacks(TestCaseWithFactory):
 UnknownURLSchemeAfterRedirect,
 InvalidHTTPSCertificate,
 InvalidHTTPSCertificateSkipped,
+TunnelError,
 },
 )
 exceptions = [
@@ -995,6 +996,7 @@ class TestMirrorCDImageProberCallbacks(TestCaseWithFactory):
 UnknownURLSchemeAfterRedirect("https://localhost;),
 InvalidHTTPSCertificate("localhost", 443),
 InvalidHTTPSCertificateSkipped("https://localhost/xx;),
+TunnelError("Could not open CONNECT tunnel."),
 ]
 for exception in exceptions:
 failure = callbacks.ensureOrDeleteMirrorCDImageSeries(
diff --git a/lib/lp/services/httpproxy/connect_tunneling.py b/lib/lp/services/httpproxy/connect_tunneling.py
index c94548c..c2f945c 100644
--- a/lib/lp/services/httpproxy/connect_tunneling.py
+++ b/lib/lp/services/httpproxy/connect_tunneling.py
@@ -7,6 +7,7 @@ See https://twistedmatrix.com/trac/ticket/8806 (and reference
 implementation at https://github.com/scrapy/scrapy/pull/397/files)."""
 
 __all__ = [
+"TunnelError",
 "TunnelingAgent",
 ]
 
___
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] lp:~cjwatson/lpbuildbot/drop-xenial into lp:lpbuildbot

2023-11-20 Thread Colin Watson
Colin Watson has proposed merging lp:~cjwatson/lpbuildbot/drop-xenial into 
lp:lpbuildbot.

Commit message:
Drop xenial builders.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lpbuildbot/drop-xenial/+merge/455899

We now only test on focal.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~cjwatson/lpbuildbot/drop-xenial into lp:lpbuildbot.
=== modified file 'buildbot-poll.py'
--- buildbot-poll.py	2020-07-27 15:34:03 +
+++ buildbot-poll.py	2023-11-20 16:18:35 +
@@ -64,7 +64,7 @@
 # Command line argument defaults.
 DEFAULTS = {
 'buildbot': 'http://lpbuildbot.canonical.com:8010',
-'builder': 'lp-devel-xenial',
+'builder': 'lp-devel-focal',
 'local_repository': homepath('archives', 'git', 'launchpad'),
 'stable_branch': 'stable',
 'quiet': False,
@@ -72,7 +72,7 @@
 'db_devel_branch': 'db-devel',
 'dry_run': False,
 # these bits are for checking on the db branches
-'db_builder': 'lp-db-devel-xenial',
+'db_builder': 'lp-db-devel-focal',
 'db_stable_branch': 'db-stable',
 }
 

=== modified file 'master.cfg'
--- master.cfg	2023-11-15 14:03:35 +
+++ master.cfg	2023-11-20 16:18:35 +
@@ -58,23 +58,15 @@
 c['schedulers'] = []
 c['schedulers'].append(AggregatingScheduler(
 name="devel",
-builderNames=["lp-devel-xenial"],
+builderNames=["lp-devel-focal"],
 branch='master',
 treeStableTimer=3*60, treeStableCount=3))
 c['schedulers'].append(AggregatingScheduler(
 name="db-devel",
-builderNames=["lp-db-devel-xenial"],
+builderNames=["lp-db-devel-focal"],
 branch='db-devel',
 treeStableTimer=3*60, treeStableCount=3))
 
-from buildbot import scheduler
-c['schedulers'].append(scheduler.Triggerable(
-name='lp-devel-focal',
-builderNames=["lp-devel-focal"]))
-c['schedulers'].append(scheduler.Triggerable(
-name='lp-db-devel-focal',
-builderNames=["lp-db-devel-focal"]))
-
 ### BUILDERS
 
 # the 'builders' list defines the Builders. Each one is configured with a
@@ -178,20 +170,6 @@
 from buildbot.config import BuilderConfig
 c['builders'] = [
 BuilderConfig(
-name='lp-devel-xenial',
-slavenames=[''],
-builddir='lp-devel-xenial',
-factory=launchpad_test_factory_factory(
-'/var/lib/buildbot/slaves/xenial-lxd-worker', 'lptests-xenial'),
-locks=[build_lock.access('counting')]),
-BuilderConfig(
-name='lp-db-devel-xenial',
-slavenames=[''],
-builddir='lp-db-devel-xenial',
-factory=launchpad_test_factory_factory(
-'/var/lib/buildbot/slaves/xenial-lxd-worker', 'lptests-xenial'),
-locks=[build_lock.access('counting')]),
-BuilderConfig(
 name='lp-devel-focal',
 slavenames=[''],
 builddir='lp-devel-focal',
@@ -220,10 +198,6 @@
 http_port=8010, allowForce=False,
 forceableBranchBuilderNames=[
 ('https://git.launchpad.net/launchpad', 'master',
- 'lp-devel-xenial'),
-('https://git.launchpad.net/launchpad', 'db-devel',
- 'lp-db-devel-xenial'),
-('https://git.launchpad.net/launchpad', 'master',
  'lp-devel-focal'),
 ('https://git.launchpad.net/launchpad', 'db-devel',
  'lp-db-devel-focal'),
@@ -235,7 +209,7 @@
 lpbuildbot.mail.MailNotifier(
 fromaddr="noreply+build...@launchpad.net",
 lookup=lpbuildbot.mail.PassThroughLookup(),
-builders=['lp-devel-xenial', 'lp-db-devel-xenial']))
+builders=['lp-devel-focal', 'lp-db-devel-focal']))
 
 # Notify the mattermost channel
 # this is defined in the production config branch

___
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/launchpad:staging-restore-fixes into launchpad:master

2023-11-20 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:staging-restore-fixes 
into launchpad:master.

Commit message:
replication: Fix several issues with remote staging-restore

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I noticed these while trying to kick off a full restore of qastaging recently.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:staging-restore-fixes into launchpad:master.
diff --git a/database/replication/Makefile b/database/replication/Makefile
index a2c1b8e..2f69cc0 100644
--- a/database/replication/Makefile
+++ b/database/replication/Makefile
@@ -30,7 +30,7 @@ NEW_STAGING_CONFIG=staging-setup # For building the db with a different name.
 STAGING_CONFIG=staging-db # For swapping fresh db into place.
 STAGING_DUMP=launchpad.dump # Dumpfile to build new staging from.
 STAGING_TABLESPACE=pg_default # 'pg_default' for default
-STAGING_LOGDIR=/srv/staging.launchpad.net/staging-logs
+STAGING_LOGDIR=/srv/launchpad/logs
 STAGING_POSTGRESQL_VERSION=10
 DOGFOOD_DUMP=launchpad.dump
 
@@ -53,7 +53,7 @@ STAGING_DBNAME_SESSION=session_staging
 DOGFOOD_DBNAME=launchpad_dogfood
 
 # Names in pgbouncer.ini's `[databases]` section.
-STAGING_PGBOUNCER_MAIN=launchpad_staging launchpad_staging_slave
+STAGING_PGBOUNCER_MAIN=launchpad_staging launchpad_staging_standby1
 STAGING_PGBOUNCER_SESSION=session_staging
 
 STAGING_PGBOUNCER=psql -p 6432 -U pgbouncer -d pgbouncer
@@ -87,7 +87,8 @@ stagingsetup:
 			${STAGING_PGBOUNCER} -c "$$verb $$db"; \
 		done; \
 	done
-	-LP_DESTROY_REMOTE_DATABASE=yes ${PGMASSACRE} ${STAGING_DBNAME_MAIN}
+	-LPCONFIG=${STAGING_CONFIG} LP_DESTROY_REMOTE_DATABASE=yes \
+		${PGMASSACRE} ${STAGING_DBNAME_MAIN}
 
 	# Quickly clear out the session DB. No need to DISABLE here, as
 	# we bring the DB back quickly.
@@ -96,12 +97,14 @@ stagingsetup:
 	${STAGING_PGBOUNCER} -c 'RESUME ${STAGING_PGBOUNCER_SESSION}'
 
 	# Create the DB with the desired default tablespace.
-	${CREATEDB} --tablespace ${STAGING_TABLESPACE} ${STAGING_DBNAME_MAIN}
+	${CREATEDB} ${STAGING_DBOPTS} --tablespace ${STAGING_TABLESPACE} \
+		${STAGING_DBNAME_MAIN}
 	# Restore the database. We need to restore permissions, despite
 	# later running security.py, to pull in permissions granted on
 	# production to users not maintained by security.py.
 	< ${STAGING_DUMP} ${STAGING_WALBLOCK} \
-	| pg_restore --dbname=${STAGING_DBNAME_MAIN} --no-owner ${EXIT_ON_ERROR} \
+	| pg_restore ${STAGING_DBOPTS} --dbname=${STAGING_DBNAME_MAIN} \
+		--no-owner ${EXIT_ON_ERROR} \
 		--use-list=${DUMPLIST} -v
 	rm ${DUMPLIST}
 	# Apply database patches.
___
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/launchpad:charm-db-update-postgresql-client into launchpad:master

2023-11-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-db-update-postgresql-client into launchpad:master.

Commit message:
charm: Add postgresql-client to launchpad-db-update

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is useful for the same kind of reason it's useful in the launchpad-admin 
charm, and things like full staging restores need it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-db-update-postgresql-client into launchpad:master.
diff --git a/charm/launchpad-db-update/layer.yaml b/charm/launchpad-db-update/layer.yaml
index ce7034d..5411f81 100644
--- a/charm/launchpad-db-update/layer.yaml
+++ b/charm/launchpad-db-update/layer.yaml
@@ -2,6 +2,9 @@ includes:
   - layer:launchpad-db
 repo: https://git.launchpad.net/launchpad
 options:
+  apt:
+packages:
+  - postgresql-client
   ols-pg:
 databases:
   db:
___
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/launchpad-buildd:doc-riscv64 into launchpad-buildd:master

2023-11-19 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad-buildd:doc-riscv64 into 
launchpad-buildd:master.

Commit message:
doc: riscv64 builders are no longer managed separately

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/455830
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-buildd:doc-riscv64 into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 7fdec1d..36aabb9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ launchpad-buildd (236) UNRELEASED; urgency=medium
 using systemd.unified_cgroup_hierarchy=false until we drop support for
 building xenial; see
 https://bugs.launchpad.net/ubuntu/xenial/+source/systemd/+bug/1962332.)
+  * Update deployment docs: riscv64 builders are no longer managed
+separately.
 
  -- Colin Watson   Thu, 16 Nov 2023 16:06:07 +
 
diff --git a/docs/how-to/deployment.rst b/docs/how-to/deployment.rst
index 8182070..2497c9b 100644
--- a/docs/how-to/deployment.rst
+++ b/docs/how-to/deployment.rst
@@ -95,20 +95,15 @@ Releasing to production
version over time.
 
 #. Wait for the new version to appear for at least one builder in each
-   region and architecture (other than ``riscv64``, which is managed
-   separately).  If this doesn't happen after 90 minutes, then ask IS for
-   assistance in investigating; they can start by checking ``juju status``
-   in ``prod-launchpad-vbuilders@is-bastion-ps5.internal``.
+   region and architecture.  If this doesn't happen after 90 minutes, then
+   ask IS for assistance in investigating; they can start by checking ``juju
+   status`` in ``prod-launchpad-vbuilders@is-bastion-ps5.internal``.
 
 #. Once the updated version is visible for at least one builder in each
-   region and architecture (other than ``riscv64``), `build farm
-   administrators
+   region and architecture, `build farm administrators
<https://launchpad.net/~launchpad-buildd-admins/+members>`_ can use
``manage-builders --virt --idle --builder-version= --reset``
to reset idle builders, thereby causing builders that haven't taken any
builds recently to catch up.
 
-#. Ask Colin Watson or William Grant to reflash ``riscv64`` builders to the
-   new version (currently a separate manual process).
-
 #. Close any bugs fixed by the new release.
___
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/launchpad:charm-db-update-fix-backend-connections into launchpad:master

2023-11-17 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-db-update-fix-backend-connections into 
launchpad:master.

Commit message:
charm: Fix launchpad-db-update's connections to backend databases

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The launchpad-db-update charm typically needs to connect directly to backend 
databases, bypassing pgbouncer, because it needs to be able to disable ordinary 
database access via pgbouncer before performing schema updates.  I discovered 
when testing this on staging that I hadn't quite got all the connection 
arrangements for this right.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-db-update-fix-backend-connections into 
launchpad:master.
diff --git a/charm/launchpad-db-update/config.yaml b/charm/launchpad-db-update/config.yaml
new file mode 100644
index 000..90cc41d
--- /dev/null
+++ b/charm/launchpad-db-update/config.yaml
@@ -0,0 +1,12 @@
+options:
+  backend_database_name:
+type: string
+description: >
+  Name of the database we are updating.  (This must be the name of the
+  database as known to PostgreSQL, which is not necessarily the same as
+  that exposed by pgbouncer.)
+default: "launchpad_dev"
+  backend_database_user:
+type: string
+description: User name to use when connecting to backend databases.
+default: "postgres"
diff --git a/charm/launchpad-db-update/reactive/launchpad-db-update.py b/charm/launchpad-db-update/reactive/launchpad-db-update.py
index e9c4b06..0bb9806 100644
--- a/charm/launchpad-db-update/reactive/launchpad-db-update.py
+++ b/charm/launchpad-db-update/reactive/launchpad-db-update.py
@@ -21,8 +21,10 @@ from ols import base, postgres
 from psycopg2.extensions import make_dsn, parse_dsn
 
 
-def any_dbname(dsn):
+def any_host_or_port_or_dbname(dsn):
 parsed_dsn = parse_dsn(dsn)
+parsed_dsn["host"] = "*"
+parsed_dsn["port"] = "*"
 parsed_dsn["dbname"] = "*"
 return make_dsn(**parsed_dsn)
 
@@ -43,8 +45,11 @@ def configure():
 db_admin = endpoint_from_flag("db-admin.master.available")
 db_admin_primary, _ = postgres.get_db_uris(db_admin)
 # We assume that this admin user works for any database on this host,
-# which seems to be true in practice.
-update_pgpass(any_dbname(db_admin_primary))
+# which seems to be true in practice.  Indeed, since we need to bypass
+# pgbouncer and contact backend databases directly, assume that it works
+# for any host or port too so that we don't need to configure
+# credentials for all the database hosts individually.
+update_pgpass(any_host_or_port_or_dbname(db_admin_primary))
 config["db_admin_primary"] = strip_dsn_authentication(db_admin_primary)
 
 if is_flag_set("pgbouncer.master.available"):
diff --git a/charm/launchpad-db-update/templates/db-update.j2 b/charm/launchpad-db-update/templates/db-update.j2
index 4ca8e87..002933d 100755
--- a/charm/launchpad-db-update/templates/db-update.j2
+++ b/charm/launchpad-db-update/templates/db-update.j2
@@ -11,7 +11,9 @@ export LPCONFIG=launchpad-db-update
 {% if pgbouncer_primary -%}
 # Fastdowntime update, managing connections using pgbouncer.
 {{ code_dir }}/database/schema/full-update.py \
---pgbouncer='{{ pgbouncer_primary }}'
+--pgbouncer='{{ pgbouncer_primary }}' \
+--dbname='{{ backend_database_name }}' \
+--dbuser='{{ backend_database_user }}'
 {% else -%}
 # We can't manage connections using pgbouncer in this environment.  Attempt
 # a simple schema upgrade, which may fail if anything has an active database
diff --git a/charm/launchpad-db-update/templates/preflight.j2 b/charm/launchpad-db-update/templates/preflight.j2
index ef2a88f..906938f 100755
--- a/charm/launchpad-db-update/templates/preflight.j2
+++ b/charm/launchpad-db-update/templates/preflight.j2
@@ -7,5 +7,7 @@
 set -e
 
 LPCONFIG=launchpad-db-update {{ code_dir }}/database/schema/preflight.py \
---skip-connection-check --pgbouncer='{{ pgbouncer_primary }}'
+--skip-connection-check --pgbouncer='{{ pgbouncer_primary }}' \
+--dbname='{{ backend_database_name }}' \
+--dbuser='{{ backend_database_user }}'
 
___
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] ~cjwatson/launchpad-buildd:cgroup2 into launchpad-buildd:master

2023-11-16 Thread Colin Watson
@xnox I admire your optimism that xenial won't have its support lifetime 
extended in perpetuity!
-- 
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/455733
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-buildd:cgroup2 into launchpad-buildd:master.


___
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/launchpad-buildd:cgroup2 into launchpad-buildd:master

2023-11-16 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad-buildd:cgroup2 into 
launchpad-buildd:master.

Commit message:
Add lxc.cgroup2.* configuration

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is for compatibility with future environments where we use unified 
cgroup2.  (However, we should keep using systemd.unified_cgroup_hierarchy=false 
until we drop support for building xenial; see 
https://bugs.launchpad.net/ubuntu/xenial/+source/systemd/+bug/1962332.)
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-buildd:cgroup2 into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 3b5aa0a..7fdec1d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+launchpad-buildd (236) UNRELEASED; urgency=medium
+
+  * Add lxc.cgroup2.* configuration, for compatibility with future
+environments where we use unified cgroup2.  (However, we should keep
+using systemd.unified_cgroup_hierarchy=false until we drop support for
+building xenial; see
+https://bugs.launchpad.net/ubuntu/xenial/+source/systemd/+bug/1962332.)
+
+ -- Colin Watson   Thu, 16 Nov 2023 16:06:07 +
+
 launchpad-buildd (235) focal; urgency=medium
 
   * sourcepackagerecipe: Create /home/buildd inside the chroot if it doesn't
diff --git a/lpbuildd/target/lxd.py b/lpbuildd/target/lxd.py
index 832537a..3d66765 100644
--- a/lpbuildd/target/lxd.py
+++ b/lpbuildd/target/lxd.py
@@ -428,6 +428,8 @@ class LXD(Backend):
 ("lxc.cap.drop", "sys_time sys_module"),
 ("lxc.cgroup.devices.deny", ""),
 ("lxc.cgroup.devices.allow", ""),
+("lxc.cgroup2.devices.deny", ""),
+("lxc.cgroup2.devices.allow", ""),
 ("lxc.mount.auto", ""),
 ("lxc.mount.auto", "proc:rw sys:rw"),
 (
diff --git a/lpbuildd/target/tests/test_lxd.py b/lpbuildd/target/tests/test_lxd.py
index a5caba0..024c900 100644
--- a/lpbuildd/target/tests/test_lxd.py
+++ b/lpbuildd/target/tests/test_lxd.py
@@ -307,6 +307,8 @@ class TestLXD(TestCase):
 ("lxc.cap.drop", "sys_time sys_module"),
 ("lxc.cgroup.devices.deny", ""),
 ("lxc.cgroup.devices.allow", ""),
+("lxc.cgroup2.devices.deny", ""),
+("lxc.cgroup2.devices.allow", ""),
 ("lxc.mount.auto", ""),
 ("lxc.mount.auto", "proc:rw sys:rw"),
 (
___
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/txpkgupload:charm-handle-build-label-change into txpkgupload:master

2023-11-15 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/txpkgupload:charm-handle-build-label-change into txpkgupload:master.

Commit message:
charm: Handle build_label changes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Borrowed from the `launchpad-payload` layer.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/txpkgupload:charm-handle-build-label-change into txpkgupload:master.
diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
index f702b1d..bb22539 100644
--- a/charm/txpkgupload/reactive/txpkgupload.py
+++ b/charm/txpkgupload/reactive/txpkgupload.py
@@ -194,6 +194,12 @@ def config_changed():
 clear_flag("service.configured")
 
 
+@when("config.changed.build_label")
+def build_label_changed():
+clear_flag("ols.service.installed")
+clear_flag("ols.configured")
+
+
 @when("loadbalancer.available", "service.configured")
 @when_not("txpkgupload.loadbalancer.configured")
 def configure_loadbalancer():
___
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/launchpad:charm-codehosting-sync-branches-action into launchpad:master

2023-11-15 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-codehosting-sync-branches-action into 
launchpad:master.

Commit message:
charm: Add a sync-branches action to launchpad-codehosting

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Since this needs to be used by the staging-restore script, it's neater to wrap 
it up in an action.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-codehosting-sync-branches-action into 
launchpad:master.
diff --git a/charm/launchpad-codehosting/actions.yaml b/charm/launchpad-codehosting/actions.yaml
index 86aae0a..bca43bd 100644
--- a/charm/launchpad-codehosting/actions.yaml
+++ b/charm/launchpad-codehosting/actions.yaml
@@ -9,3 +9,12 @@ stop-services:
 will persist across a reboot.  It also doesn't disable cron jobs, since
 those are handled by the cron-control mechanism instead; see
 lp.services.scripts.base.cronscript_enabled.)
+sync-branches:
+  description: |
+Sync branch data from production to a non-production environment.
+  params:
+branches:
+  type: string
+  description: A space-separated list of branches to sync.
+  required:
+- branches
diff --git a/charm/launchpad-codehosting/actions/actions.py b/charm/launchpad-codehosting/actions/actions.py
index cbac43e..a424399 100755
--- a/charm/launchpad-codehosting/actions/actions.py
+++ b/charm/launchpad-codehosting/actions/actions.py
@@ -15,6 +15,7 @@ basic.bootstrap_charm_deps()
 basic.init_config_states()
 
 from charmhelpers.core import hookenv  # noqa: E402
+from ols import base  # noqa: E402
 
 
 def start_services():
@@ -31,6 +32,22 @@ def stop_services():
 hookenv.action_set({"result": "Services stopped"})
 
 
+def sync_branches():
+params = hookenv.action_get()
+script = Path(base.code_dir(), "scripts", "sync-branches.py")
+command = [
+"sudo",
+"-H",
+"-u",
+base.user(),
+"LPCONFIG=launchpad-codehosting",
+"--",
+script,
+] + params["branches"].split()
+subprocess.run(command, check=True)
+hookenv.action_set({"result": "Branches synced"})
+
+
 def main(argv):
 action = Path(argv[0]).name
 try:
@@ -38,6 +55,8 @@ def main(argv):
 start_services()
 elif action == "stop-services":
 stop_services()
+elif action == "sync-branches":
+sync_branches()
 else:
 hookenv.action_fail(f"Action {action} not implemented.")
 except Exception:
diff --git a/charm/launchpad-codehosting/actions/sync-branches b/charm/launchpad-codehosting/actions/sync-branches
new file mode 12
index 000..405a394
--- /dev/null
+++ b/charm/launchpad-codehosting/actions/sync-branches
@@ -0,0 +1 @@
+actions.py
\ No newline at end of file
___
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/launchpad:charm-codehosting-ro into launchpad:master

2023-11-15 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-codehosting-ro into 
launchpad:master.

Commit message:
charm: Allow codehosting access to the "ro" role

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is a generic read-only database role, and is used by 
`scripts/sync-branches.py`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-codehosting-ro into launchpad:master.
diff --git a/charm/launchpad-codehosting/layer.yaml b/charm/launchpad-codehosting/layer.yaml
index 35a531b..63d159a 100644
--- a/charm/launchpad-codehosting/layer.yaml
+++ b/charm/launchpad-codehosting/layer.yaml
@@ -10,6 +10,7 @@ options:
 roles:
   - branch-rewrite
   - reclaim-branch-space
+  - ro
   - translationstobranch
   - upgrade-branches
 repo: https://git.launchpad.net/launchpad
___
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/launchpad-mojo-specs/+git/private:vbuilder-riscv64-timeout into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-15 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-riscv64-timeout into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.

Commit message:
vbuilder: Bump sbuild-stalled-package-timeout to 1500 on riscv64

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/455619

Emulated builders are slow enough that the default timeout of 150 minutes can 
be too short.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-riscv64-timeout into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.
diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
index c00ca4a..c0f2988 100644
--- a/vbuilder/bundle.yaml
+++ b/vbuilder/bundle.yaml
@@ -467,6 +467,7 @@ applications:
   remote-modifiers: '{{ modifiers_bos03 }}'
   remote-modifier-private-key: include-base64://{{ local_dir }}/id_rsa.imagebuilder
   remote-modifier-public-key: include-base64://{{ local_dir }}/id_rsa.imagebuilder.pub
+  sbuild-stalled-package-timeout: 1500
 {%- endif %}
   vbuilder-manage-bos01:
 charm: {{ charm_dir }}/vbuilder-manage
___
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/launchpad:charm-ppa-publisher-missing-import into launchpad:master

2023-11-15 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-ppa-publisher-missing-import into launchpad:master.

Commit message:
charm: Add missing import to ppa-publisher secrets template

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/455617
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-ppa-publisher-missing-import into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2 b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
index 017aceb..7290654 100644
--- a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
+++ b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
@@ -8,6 +8,8 @@
 # Values are strings, except for numbers that look like ints.  The tokens
 # true, false, and none are treated as True, False, and None.
 
+{% from "macros.j2" import opt -%}
+
 [artifactory]
 {{- opt("write_credentials", artifactory_write_credentials) }}
 
___
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/launchpad:charm-codehosting-rsync-mirrors into launchpad:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-codehosting-rsync-mirrors into launchpad:master.

Commit message:
charm: Add bzr_repositories_rsync_hosts_allow option to codehosting

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Staging codehosting rsyncs a small set of Bazaar branches from production 
codehosting.  To make this work, the charm that we'll soon be deploying to 
replace production codehosting needs to support that.

I was able to tidy up some minor duplication in the process.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-codehosting-rsync-mirrors into launchpad:master.
diff --git a/charm/launchpad-codehosting/config.yaml b/charm/launchpad-codehosting/config.yaml
index 152b0be..c41fd80 100644
--- a/charm/launchpad-codehosting/config.yaml
+++ b/charm/launchpad-codehosting/config.yaml
@@ -3,6 +3,12 @@ options:
 type: boolean
 description: If true, enable jobs that may change the database.
 default: true
+  bzr_repositories_rsync_hosts_allow:
+type: string
+description: >
+  Space-separated list of hosts that should be allowed to rsync Bazaar
+  repositories (both public and private).
+default: ""
   codehosting_private_ssh_key:
 type: string
 description: >
diff --git a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
index 537cccb..b8eb323 100644
--- a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
+++ b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
@@ -31,6 +31,16 @@ def base64_decode(value):
 return base64.b64decode(value.encode("ASCII"))
 
 
+def get_data_dir():
+return os.path.join(base.base_dir(), "data")
+
+
+def get_codehosting_service_config():
+config = get_service_config()
+config["bzr_repositories_root"] = f"{get_data_dir()}/mirrors"
+return config
+
+
 def configure_logrotate(config):
 hookenv.log("Writing logrotate configuration.")
 templating.render(
@@ -65,7 +75,7 @@ def configure_systemd(config):
 def config_files():
 files = []
 files.extend(lazr_config_files())
-config = get_service_config()
+config = get_codehosting_service_config()
 files.append(config_file_path("launchpad-codehosting/launchpad-lazr.conf"))
 for i in range(config["workers"]):
 files.append(
@@ -155,11 +165,6 @@ def configure_ssh_keys(config):
 
 def configure_codehosting_lazr_config(config):
 hookenv.log("Writing lazr configuration.")
-# XXX lgp171188: 2023-10-26: This template recreates the value of
-# config["bzr_repositories_root"] since it can't use it directly
-# due to it being in a separate handler that is executed much later.
-# Fix this to unify the definition and usage of this configuration
-# value.
 configure_lazr(
 config,
 "launchpad-codehosting-lazr-common.conf.j2",
@@ -177,10 +182,21 @@ def configure_codehosting_lazr_config(config):
 )
 
 
+def configure_rsync(config):
+rsync_path = "/etc/rsync-juju.d/020-mirrors.conf"
+if config["bzr_repositories_rsync_hosts_allow"]:
+hookenv.log("Writing rsync configuration for Bazaar repositories.")
+templating.render(
+"mirrors-rsync.conf.j2", rsync_path, config, perms=0o644
+)
+elif os.path.exists(rsync_path):
+os.unlink(rsync_path)
+
+
 @when("launchpad.db.configured")
 @when_not("service.configured")
 def configure():
-config = get_service_config()
+config = get_codehosting_service_config()
 configure_codehosting_lazr_config(config)
 configure_email(config, "launchpad-codehosting")
 configure_logrotate(config)
@@ -188,6 +204,7 @@ def configure():
 configure_scripts(config)
 configure_ssh_keys(config)
 configure_systemd(config)
+configure_rsync(config)
 if config["active"]:
 if helpers.any_file_changed(
 [
@@ -238,10 +255,9 @@ def configure_document_root(config):
 perms=0o755,
 force=True,
 )
-data_dir = f"{config['base_dir']}/data"
+data_dir = get_data_dir()
 hookenv.log(f"Creating the data directory {data_dir}")
 host.mkdir(data_dir, owner=user, group=user, perms=0o755, force=True)
-config["bzr_repositories_root"] = f"{data_dir}/mirrors"
 host.mkdir(
 config["bzr_repositories_root"],
 owner=user,
@@ -276,7 +292,7 @@ def configure_document_root(config):
 @when_not("service.apache-website.configured")
 def configure_apache_website():
 apache_website = endpoint_from_flag(&

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-artifactory-write-credentials into launchpad:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-artifactory-write-credentials into launchpad:master.

Commit message:
charm: Add artifactory_write_credentials option to ppa-publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is needed to handle PPAs that are published to Artifactory rather than 
locally.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-artifactory-write-credentials into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/config.yaml b/charm/launchpad-ppa-publisher/config.yaml
index 06336ff..84483d6 100644
--- a/charm/launchpad-ppa-publisher/config.yaml
+++ b/charm/launchpad-ppa-publisher/config.yaml
@@ -8,6 +8,12 @@ options:
 default:
 description:
   Base URL for publishing suitably-configured archives to Artifactory.
+  artifactory_write_credentials:
+type: string
+default:
+description: >
+  Credentials for writing to Artifactory repositories (formatted as
+  "user:token").
   domain_ppa_private:
 type: string
 default: private-ppa.launchpad.test
diff --git a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2 b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
index 27e367b..017aceb 100644
--- a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
+++ b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-secrets-lazr.conf.j2
@@ -8,6 +8,9 @@
 # Values are strings, except for numbers that look like ints.  The tokens
 # true, false, and none are treated as True, False, and None.
 
+[artifactory]
+{{- opt("write_credentials", artifactory_write_credentials) }}
+
 [signing]
 client_private_key: {{ signing_client_private_key }}
 
___
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/launchpad:fix-refactor-team-membership-active-states into launchpad:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:fix-refactor-team-membership-active-states into 
launchpad:master.

Commit message:
Fix test regression caused by ACTIVE_STATES refactoring

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/455579
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:fix-refactor-team-membership-active-states into 
launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index f166706..4281303 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -2504,7 +2504,7 @@ class Person(
 def api_activemembers(self):
 """See `IPerson`."""
 return self._members(
-direct=True, status=ACTIVE_STATES, preload_for_api=True
+direct=True, status=tuple(ACTIVE_STATES), preload_for_api=True
 )
 
 @property
___
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/txpkgupload:charm-ipv6 into txpkgupload:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/txpkgupload:charm-ipv6 into 
txpkgupload:master.

Commit message:
charm: Make haproxy listen on both IPv4 and IPv6

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/txpkgupload/+git/txpkgupload/+merge/46
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/txpkgupload:charm-ipv6 into txpkgupload:master.
diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
index 201e3a9..f702b1d 100644
--- a/charm/txpkgupload/reactive/txpkgupload.py
+++ b/charm/txpkgupload/reactive/txpkgupload.py
@@ -241,7 +241,7 @@ def configure_loadbalancer():
 # usual FTP/SFTP ports but also to higher ports
 if config.get("min_passive_port") and config.get("max_passive_port"):
 extra_ports = (
-f"bind 0.0.0.0:"
+f"bind :::"
 f"{config['min_passive_port']}-{config['max_passive_port']}"
 )
 service_options_ftp.append(extra_ports)
@@ -254,7 +254,7 @@ def configure_loadbalancer():
 {
 "service_name": "txpkgupload-ftp",
 "service_port": ftp_port,
-"service_host": "0.0.0.0",
+"service_host": "::",
 "service_options": service_options_ftp,
 "servers": [
 [
@@ -271,7 +271,7 @@ def configure_loadbalancer():
 {
 "service_name": "txpkgupload-sftp",
 "service_port": sftp_port,
-"service_host": "0.0.0.0",
+"service_host": "::",
 "service_options": service_options_sftp,
 "servers": [
 [
___
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/launchpad:charm-ppa-artifactory into launchpad:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-ppa-artifactory 
into launchpad:master.

Commit message:
charm: Add artifactory_base_url option to ppa-publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is needed to handle PPAs that are published to Artifactory rather than 
locally.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-ppa-artifactory into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/config.yaml b/charm/launchpad-ppa-publisher/config.yaml
index 9829bf2..06336ff 100644
--- a/charm/launchpad-ppa-publisher/config.yaml
+++ b/charm/launchpad-ppa-publisher/config.yaml
@@ -3,6 +3,11 @@ options:
 type: boolean
 default: true
 description: If true, enable jobs that may change the database.
+  artifactory_base_url:
+type: string
+default:
+description:
+  Base URL for publishing suitably-configured archives to Artifactory.
   domain_ppa_private:
 type: string
 default: private-ppa.launchpad.test
diff --git a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2 b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
index ffd4330..0ff2443 100644
--- a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
+++ b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
@@ -16,6 +16,9 @@ archives_dir: {{ archives_dir }}
 {{- opt("oval_data_rsync_endpoint", oval_data_rsync_endpoint) }}
 oval_data_root: {{ oval_data_root }}
 
+[artifactory]
+{{- opt("base_url", artifactory_base_url) }}
+
 [personalpackagearchive]
 root: {{ ppa_archive_root }}
 private_root: {{ ppa_archive_private_root }}
___
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/launchpad:signing-cleanup into launchpad:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:signing-cleanup into 
launchpad:master.

Commit message:
signing: Clean up installed directory on failures

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

If `SigningUpload.installFiles` raises an exception, then it shouldn't leave 
the half-installed files around, since that will make it impossible to retry 
processing without manual intervention.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:signing-cleanup into launchpad:master.
diff --git a/lib/lp/archivepublisher/signing.py b/lib/lp/archivepublisher/signing.py
index 36f5681..9938a95 100644
--- a/lib/lp/archivepublisher/signing.py
+++ b/lib/lp/archivepublisher/signing.py
@@ -841,14 +841,20 @@ class SigningUpload(CustomUpload):
 # Avoid circular import.
 from lp.archivepublisher.publishing import DirectoryHash
 
-super().installFiles(archive, suite)
-
 versiondir = os.path.join(self.targetdir, self.version)
-with DirectoryHash(versiondir, self.temproot) as hasher:
-hasher.add_dir(versiondir)
-for checksum_path in hasher.checksum_paths:
-if self.shouldSign(checksum_path):
-self.sign(archive, suite, checksum_path)
+
+try:
+super().installFiles(archive, suite)
+
+with DirectoryHash(versiondir, self.temproot) as hasher:
+hasher.add_dir(versiondir)
+for checksum_path in hasher.checksum_paths:
+if self.shouldSign(checksum_path):
+self.sign(archive, suite, checksum_path)
+except Exception:
+if os.path.exists(versiondir):
+shutil.rmtree(versiondir, ignore_errors=True)
+raise
 
 def shouldInstall(self, filename):
 return filename.startswith("%s/" % self.version)
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index 11259d7..4318cb8 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -687,6 +687,11 @@ class TestLocalSigningUpload(RunPartsMixin, TestSigningHelpers):
 self.tarfile.add_file("1.0/dir/file.efi", b"foo")
 os.umask(0o002)  # cleanup already handled by setUp
 self.assertRaises(CustomUploadBadUmask, self.process)
+self.assertFalse(
+os.path.exists(
+os.path.join(self.getSignedPath("test", "amd64"), "1.0")
+)
+)
 
 def test_correct_uefi_signing_command_executed(self):
 # Check that calling signUefi() will generate the expected command
___
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/txpkgupload:charm-send-sftp-port into txpkgupload:master

2023-11-14 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/txpkgupload:charm-send-sftp-port 
into txpkgupload:master.

Commit message:
charm: Tell haproxy to send to the SFTP port

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The arrangements to use whatever port the client used are only actually 
necessary for FTP.  On production, we're using iptables to redirect incoming 
traffic on port 22 to port 5022, and not specifying the port causes haproxy to 
send traffic to port 22 on the backend, which is not what we want to happen.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/txpkgupload:charm-send-sftp-port into txpkgupload:master.
diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
index 689aa90..ab13487 100644
--- a/charm/txpkgupload/reactive/txpkgupload.py
+++ b/charm/txpkgupload/reactive/txpkgupload.py
@@ -250,9 +250,6 @@ def configure_loadbalancer():
 ftp_port = config["ftp_port"]
 sftp_port = config["sftp_port"]
 
-# Note that we don't send specific ports for the services.servers list.
-# Not setting a port makes the haproxy use the same port used in the
-# client's request.
 services = [
 {
 "service_name": "txpkgupload-ftp",
@@ -263,6 +260,8 @@ def configure_loadbalancer():
 [
 f"ftp_{unit_name}",
 unit_ip,
+# Not setting a port makes haproxy use the same port
+# used in the client's request.
 "",
 server_options.replace("{port}", str(ftp_port)),
 ]
@@ -277,7 +276,7 @@ def configure_loadbalancer():
 [
 f"sftp_{unit_name}",
 unit_ip,
-"",
+sftp_port,
 server_options.replace("{port}", str(sftp_port)),
 ]
 ],
___
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/launchpad-mojo-specs/+git/private:vbuilder-update-log-hosts-allow into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-13 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-update-log-hosts-allow 
into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder.

Commit message:
vbuilder: Allow launchpad-bastion-ps5.internal to rsync logs

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/455518
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-update-log-hosts-allow 
into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder.
diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
index 05a5701..c00ca4a 100644
--- a/vbuilder/bundle.yaml
+++ b/vbuilder/bundle.yaml
@@ -1,3 +1,5 @@
+{%- set log_hosts_allow = "carob.canonical.com launchpad-bastion-ps5.internal" %}
+
 {%- if stage_name == "production" %}
 {%-   set clamav_database_url = "http://clamav-database-mirror.lp.internal/; %}
 {%-   set content_id_template = "launchpad-buildd:production" %}
@@ -481,7 +483,7 @@ applications:
   instance-key-name: "{{ instance_key_name_bos01 }}"
   instance-network: "{{ instance_network_bos01 }}"
   instance-router: "{{ instance_router }}"
-  log-hosts-allow: 91.189.90.14
+  log-hosts-allow: "{{ log_hosts_allow }}"
   lp-buildd-managers: "{{ lp_buildd_managers }}"
   lp-environment: "{{ lp_environment }}"
   lp-sshkey: "{{ lp_sshkey }}"
@@ -505,7 +507,7 @@ applications:
   instance-key-name: "{{ instance_key_name_bos02 }}"
   instance-network: "{{ instance_network_bos02 }}"
   instance-router: "{{ instance_router }}"
-  log-hosts-allow: 91.189.90.14
+  log-hosts-allow: "{{ log_hosts_allow }}"
   lp-buildd-managers: "{{ lp_buildd_managers }}"
   lp-environment: "{{ lp_environment }}"
   lp-sshkey: "{{ lp_sshkey }}"
@@ -528,7 +530,7 @@ applications:
   instance-key-name: "{{ instance_key_name_bos03 }}"
   instance-network: "{{ instance_network_bos03 }}"
   instance-router: "{{ instance_router_bos03 }}"
-  log-hosts-allow: 91.189.90.14
+  log-hosts-allow: "{{ log_hosts_allow }}"
   lp-buildd-managers: "{{ lp_buildd_managers }}"
   lp-environment: "{{ lp_environment }}"
   lp-sshkey: "{{ lp_sshkey }}"
@@ -552,7 +554,7 @@ applications:
   instance-key-name: "{{ instance_key_name_lcy02 }}"
   instance-network: "{{ instance_network_lcy02 }}"
   instance-router: "{{ instance_router_lcy02 }}"
-  log-hosts-allow: 91.189.90.14
+  log-hosts-allow: "{{ log_hosts_allow }}"
   lp-buildd-managers: "{{ lp_buildd_managers }}"
   lp-environment: "{{ lp_environment }}"
   lp-sshkey: "{{ lp_sshkey }}"
___
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/launchpad:charm-ppa-fix-oval-data into launchpad:master

2023-11-13 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-ppa-fix-oval-data 
into launchpad:master.

Commit message:
charm: Fix oval_data_root in ppa-publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It was missing a "data" segment.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-ppa-fix-oval-data into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2 b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
index a0e08e8..ffd4330 100644
--- a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
+++ b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
@@ -14,7 +14,7 @@ extends: ../launchpad-db-lazr.conf
 [archivepublisher]
 archives_dir: {{ archives_dir }}
 {{- opt("oval_data_rsync_endpoint", oval_data_rsync_endpoint) }}
-oval_data_root: {{ base_dir }}/oval-data
+oval_data_root: {{ oval_data_root }}
 
 [personalpackagearchive]
 root: {{ ppa_archive_root }}
___
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] ~ines-almeida/launchpad-mojo-specs/+git/private:add-bos03-arm64-arch into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-13 Thread Colin Watson
Review: Approve


-- 
https://code.launchpad.net/~ines-almeida/launchpad-mojo-specs/+git/private/+merge/455512
Your team Launchpad code reviewers is subscribed to branch 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.


___
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/launchpad:update-sync-branches-source into launchpad:master

2023-11-13 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:update-sync-branches-source into launchpad:master.

Commit message:
Update rsync source used by sync-branches

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I currently get "Connection timed out" trying to rsync from 
`bazaar.launchpad.net::mirrors/` on tellurium, but 
`bazaar.lp.internal::mirrors/` works fine, and makes a bit more logical sense 
anyway.

It probably makes sense for this to be configurable.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:update-sync-branches-source into launchpad:master.
diff --git a/lib/lp/codehosting/scripts/sync_branches.py b/lib/lp/codehosting/scripts/sync_branches.py
index fc361a5..8bbd875 100644
--- a/lib/lp/codehosting/scripts/sync_branches.py
+++ b/lib/lp/codehosting/scripts/sync_branches.py
@@ -18,7 +18,6 @@ from lp.services.scripts.base import LaunchpadScript, LaunchpadScriptFailure
 
 # We don't want to spend too long syncing branches.
 BRANCH_LIMIT = 35
-REMOTE_SERVER = "bazaar.launchpad.net"
 
 
 class SyncBranchesScript(LaunchpadScript):
@@ -45,7 +44,7 @@ class SyncBranchesScript(LaunchpadScript):
 "rsync",
 "-a",
 "--delete-after",
-"%s::mirrors/%s/" % (REMOTE_SERVER, branch_path),
+"%s/%s/" % (config.codehosting.sync_branches_source, branch_path),
 "%s/" % branch_dir,
 ]
 try:
diff --git a/lib/lp/codehosting/scripts/tests/test_sync_branches.py b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
index 1d38c4a..312b0cc 100644
--- a/lib/lp/codehosting/scripts/tests/test_sync_branches.py
+++ b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
@@ -43,7 +43,7 @@ class BranchSyncProcessMatches(MatchesListwise):
 "rsync",
 "-a",
 "--delete-after",
-"bazaar.launchpad.net::mirrors/%s/" % branch_path,
+"bazaar.lp.internal::mirrors/%s/" % branch_path,
 "%s/"
 % os.path.join(
 config.codehosting.mirrored_branches_root,
@@ -161,7 +161,7 @@ class TestSyncBranches(TestCaseWithFactory):
 LaunchpadScriptFailure,
 "There was an error running: "
 "rsync -a --delete-after "
-"bazaar.launchpad.net::mirrors/{}/ {}/{}/\n"
+"bazaar.lp.internal::mirrors/{}/ {}/{}/\n"
 "Status: 1\n"
 "Output: rsync exploded".format(
 branch_id_to_path(branch.id),
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index ce448cf..ac68bd4 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -362,6 +362,11 @@ host_key_pair_path: none
 # called the 'mirrored area'.
 mirrored_branches_root: /var/tmp/bazaar.launchpad.test/mirrors
 
+# datatype: string
+# rsync host::module that scripts/sync-branches.py should use to sync
+# branches from production to a staging environment.
+sync_branches_source: bazaar.lp.internal::mirrors
+
 # datatype: boolean
 spew: False
 
___
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] ~ines-almeida/launchpad-mojo-specs/+git/private:add-bos03-arm64-arch into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-13 Thread Colin Watson
Review: Approve


-- 
https://code.launchpad.net/~ines-almeida/launchpad-mojo-specs/+git/private/+merge/455499
Your team Launchpad code reviewers is subscribed to branch 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.


___
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/launchpad:charm-codehosting-fix-mount-instructions into launchpad:master

2023-11-13 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-codehosting-fix-mount-instructions into 
launchpad:master.

Commit message:
charm: Fix instructions for mounting codehosting data volume

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

See comments in 
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/454809.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-codehosting-fix-mount-instructions into 
launchpad:master.
diff --git a/charm/launchpad-codehosting/README.md b/charm/launchpad-codehosting/README.md
index de715c2..eae6156 100644
--- a/charm/launchpad-codehosting/README.md
+++ b/charm/launchpad-codehosting/README.md
@@ -39,19 +39,21 @@ at the directory configured to store the `bzr` repositories.
 * Create a filesystem on the new volume using `sudo mkfs.ext4 /dev/vdb`. Do
   check and verify that this device node matches the new volume.
 
-* Create the `/srv/launchpad/data/mirror` directory, if it does not
-  exist already. Here, `/srv/launchpad` corresponds to the `base_dir`
-  template context variable.
+* Create the `/srv/launchpad/data` directory, if it does not exist already.
+  Here, `/srv/launchpad` corresponds to the `base_dir` template context
+  variable.
 
-* Add `/dev/vdb /srv/launchpad/data/mirror ext4 defaults 0 2` to
-  `/etc/fstab`.
+* Add `/dev/vdb /srv/launchpad/data ext4 defaults 0 2` to `/etc/fstab`.
 
-* Mount the new volume using `sudo mount /srv/launchpad/data/mirror`.
+* Mount the new volume using `sudo mount /srv/launchpad/data`.
 
 * Set the correct permissions on the new volume using the following commands.
 
-  sudo chown launchpad: /srv/launchpad/data/mirror
-  sudo chmod 755 /srv/launchpad/data/mirror
+  sudo chown launchpad: /srv/launchpad/data
+  sudo chmod 755 /srv/launchpad/data
+
+* Ensure that the `mirrors` directory exists in the new volume using
+  `sudo -u launchpad mkdir -m755 /srv/launchpad/data/mirrors`.
 
 ## Maintenance actions
 
___
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/launchpad:logintoken-typos into launchpad:master

2023-11-09 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:logintoken-typos into 
launchpad:master.

Commit message:
Fix typos in OpenPGP key import error message

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/455399
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:logintoken-typos into launchpad:master.
diff --git a/lib/lp/services/verification/browser/logintoken.py b/lib/lp/services/verification/browser/logintoken.py
index 7bdc469..514e51d 100644
--- a/lib/lp/services/verification/browser/logintoken.py
+++ b/lib/lp/services/verification/browser/logintoken.py
@@ -374,7 +374,7 @@ class ValidateGPGKeyView(BaseTokenView, LaunchpadFormView):
 "global key ring (using gpg --send-keys "
 "KEY) and that you entered the fingerprint "
 "correctly (as produced by gpg --fingerprint "
-'YOU). Try later or  '
+'YOU). Try later or '
 "cancel your request.",
 mapping=dict(fingerprint=fingerprint, url=person_url),
 )
___
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] ~ines-almeida/launchpad-mojo-specs/+git/private:add-bos03-arm64-arch into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-07 Thread Colin Watson
Review: Approve


-- 
https://code.launchpad.net/~ines-almeida/launchpad-mojo-specs/+git/private/+merge/455059
Your team Launchpad code reviewers is subscribed to branch 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.


___
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/launchpad:charm-codehosting-reload-apache2 into launchpad:master

2023-11-07 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-codehosting-reload-apache2 into launchpad:master.

Commit message:
charm: Reload apache2 on codehosting config changes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Since `branch-rewrite` is run by Apache, we need to reload Apache when 
configuration used by that script is changed.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-codehosting-reload-apache2 into launchpad:master.
diff --git a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
index d0aeec6..5cee23e 100644
--- a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
+++ b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
@@ -201,10 +201,11 @@ def configure():
 ):
 hookenv.log(
 "Config files changed; restarting"
-" the launchpad-bzr-sftp service."
+" the launchpad-bzr-sftp service and reloading apache2."
 )
 for i in range(config["workers"]):
 host.service_restart(f"launchpad-bzr-sftp@{i + 1}")
+host.service_reload("apache2")
 else:
 hookenv.log("Not restarting since no config files were changed.")
 host.service_resume("launchpad-bzr-sftp.service")
___
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/launchpad:pre-commit-autoupdate into launchpad:master

2023-11-07 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:pre-commit-autoupdate 
into launchpad:master.

Commit message:
Update pre-commit hooks

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This involved a number of spelling corrections and a couple of changes by 
`pyupgrade`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:pre-commit-autoupdate into launchpad:master.
diff --git a/.codespell-ignore b/.codespell-ignore
index 7af0ae1..b855d06 100644
--- a/.codespell-ignore
+++ b/.codespell-ignore
@@ -1,6 +1,7 @@
 buildd
 changee
 coo
+debbugs
 distroname
 falsy
 fpr
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7e7f119..55d7cf5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
 # See https://pre-commit.com/hooks.html for more hooks
 repos:
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-rev: v4.4.0
+rev: v4.5.0
 hooks:
 -   id: check-added-large-files
 -   id: check-ast
@@ -26,7 +26,7 @@ repos:
 -   id: no-commit-to-branch
 args: [--branch, master, --branch, db-devel]
 -   repo: https://github.com/asottile/pyupgrade
-rev: v3.3.1
+rev: v3.15.0
 hooks:
 -   id: pyupgrade
 args: [--keep-percent-format]
@@ -36,7 +36,7 @@ repos:
 |utilities/community-contributions\.py
   )$
 -   repo: https://github.com/psf/black-pre-commit-mirror
-rev: 23.9.1
+rev: 23.10.1
 hooks:
   - id: black
 exclude: |
@@ -62,7 +62,7 @@ repos:
   - flake8-alfred==1.1.1
   - flake8-bugbear==23.3.12
 -   repo: https://github.com/pre-commit/mirrors-eslint
-rev: v8.33.0
+rev: v8.53.0
 hooks:
 -   id: eslint
 args: [--quiet]
@@ -70,7 +70,7 @@ repos:
 # use the proxy correctly in Launchpad CI builds.
 language_version: "20.6.1"
 -   repo: https://github.com/keewis/blackdoc
-rev: v0.3.8
+rev: v0.3.9
 hooks:
 -   id: blackdoc
 args: ["-l", "78"]
@@ -82,11 +82,11 @@ repos:
 args: [--allow-option-flag, IGNORE_EXCEPTION_MODULE_IN_PYTHON2]
 exclude: ^doc/.*
 -   repo: https://github.com/shellcheck-py/shellcheck-py
-rev: v0.9.0.2
+rev: v0.9.0.6
 hooks:
 -   id: shellcheck
 -   repo: https://github.com/codespell-project/codespell
-rev: v2.2.5
+rev: v2.2.6
 hooks:
 -   id: codespell
 args: ["-I", ".codespell-ignore"]
diff --git a/lib/lp/answers/stories/question-add.rst b/lib/lp/answers/stories/question-add.rst
index 9be06dc..3723f10 100644
--- a/lib/lp/answers/stories/question-add.rst
+++ b/lib/lp/answers/stories/question-add.rst
@@ -2,7 +2,7 @@ Asking New Questions
 
 
 There are two paths available to a user to ask a new question. The first
-one involes two steps. First, go to the product or distribution for
+one involves two steps. First, go to the product or distribution for
 which support is desired:
 
 >>> browser.open("http://answers.launchpad.test/ubuntu;)
diff --git a/lib/lp/app/javascript/calendar.js b/lib/lp/app/javascript/calendar.js
index 5271734..d169199 100644
--- a/lib/lp/app/javascript/calendar.js
+++ b/lib/lp/app/javascript/calendar.js
@@ -64,7 +64,7 @@ var get_initial_value_for_input = function(date_input_node) {
  * to the provided time.
  *
  * @method create_time_selector_node
- * @param selected_time {Date} an optional Date instance for inititial
+ * @param selected_time {Date} an optional Date instance for initial
  * time values. If not provided the current time will be used instead.
  */
 var create_time_selector_node = function(selected_time) {
diff --git a/lib/lp/archiveuploader/tests/nascentupload.rst b/lib/lp/archiveuploader/tests/nascentupload.rst
index 29cbca8..989a31f 100644
--- a/lib/lp/archiveuploader/tests/nascentupload.rst
+++ b/lib/lp/archiveuploader/tests/nascentupload.rst
@@ -362,7 +362,7 @@ Retrieve the just-inserted SourcePackageRelease correspondent to 'ed'
 
 >>> ed_spr = ed_src.queue_root.sources[0].sourcepackagerelease
 
-Check if we have rebuid the change's author line properly (as
+Check if we have rebuilt the change's author line properly (as
 mentioned in bug # 30621)
 
 >>> print(ed_spr.changelog_entry)  # doctest: -NORMALIZE_WHITESPACE
diff --git a/lib/lp/archiveuploader/tests/nascentuploadfile.rst b/lib/lp/archiveuploader/tests/nascentuploadfile.rst
index 78bfed5..73febfc 100644
--- a/lib/lp/archiveuploader/tests/nascentuploadfile.rst
+++ b/lib/lp/archiveuploader/tests/nascentuploadfile.rst
@@ -121,7 +121,7 @@ At this point the changesfile content is already parsed:
 >>> print(ed_binary_changes.suite_name)
 unstable
 
-Push upload targeted suite into policy before the checks, nomally done
+Push 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:branch-hosting-import-policy into launchpad:master

2023-11-07 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:branch-hosting-import-policy into launchpad:master.

Commit message:
Fix import policy violation with InvalidRevisionException

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I noticed this in test output:

  There were 1 imports of names not appearing in the __all__.
  You should not import InvalidRevisionException from 
lp.code.model.branchhosting:
  lp.snappy.model.snap
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:branch-hosting-import-policy into launchpad:master.
diff --git a/lib/lp/code/interfaces/branchhosting.py b/lib/lp/code/interfaces/branchhosting.py
index 41b8926..54df027 100644
--- a/lib/lp/code/interfaces/branchhosting.py
+++ b/lib/lp/code/interfaces/branchhosting.py
@@ -5,11 +5,16 @@
 
 __all__ = [
 "IBranchHostingClient",
+"InvalidRevisionException",
 ]
 
 from zope.interface import Interface
 
 
+class InvalidRevisionException(Exception):
+"""An exception thrown when a revision ID is not valid"""
+
+
 class IBranchHostingClient(Interface):
 """Interface for the internal API provided by Loggerhead."""
 
diff --git a/lib/lp/code/model/branchhosting.py b/lib/lp/code/model/branchhosting.py
index 3be5857..06629b3 100644
--- a/lib/lp/code/model/branchhosting.py
+++ b/lib/lp/code/model/branchhosting.py
@@ -16,7 +16,10 @@ from lazr.restful.utils import get_current_browser_request
 from zope.interface import implementer
 
 from lp.code.errors import BranchFileNotFound, BranchHostingFault
-from lp.code.interfaces.branchhosting import IBranchHostingClient
+from lp.code.interfaces.branchhosting import (
+IBranchHostingClient,
+InvalidRevisionException,
+)
 from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
 from lp.services.config import config
 from lp.services.timeline.requesttimeline import get_request_timeline
@@ -31,10 +34,6 @@ class RequestExceptionWrapper(requests.RequestException):
 """A non-requests exception that occurred during a request."""
 
 
-class InvalidRevisionException(Exception):
-"""An exception thrown when a revision ID is not valid"""
-
-
 @implementer(IBranchHostingClient)
 class BranchHostingClient:
 """A client for the Bazaar Loggerhead API."""
diff --git a/lib/lp/code/model/tests/test_branchhosting.py b/lib/lp/code/model/tests/test_branchhosting.py
index 76e7aa2..b745cde 100644
--- a/lib/lp/code/model/tests/test_branchhosting.py
+++ b/lib/lp/code/model/tests/test_branchhosting.py
@@ -18,8 +18,10 @@ from zope.interface import implementer
 from zope.security.proxy import removeSecurityProxy
 
 from lp.code.errors import BranchFileNotFound, BranchHostingFault
-from lp.code.interfaces.branchhosting import IBranchHostingClient
-from lp.code.model.branchhosting import InvalidRevisionException
+from lp.code.interfaces.branchhosting import (
+IBranchHostingClient,
+InvalidRevisionException,
+)
 from lp.services.job.interfaces.job import IRunnableJob, JobStatus
 from lp.services.job.model.job import Job
 from lp.services.job.runner import BaseRunnableJob, JobRunner
diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
index c47ec1e..d5c26e7 100644
--- a/lib/lp/snappy/model/snap.py
+++ b/lib/lp/snappy/model/snap.py
@@ -67,6 +67,7 @@ from lp.code.errors import (
 )
 from lp.code.interfaces.branch import IBranch
 from lp.code.interfaces.branchcollection import IAllBranches, IBranchCollection
+from lp.code.interfaces.branchhosting import InvalidRevisionException
 from lp.code.interfaces.gitcollection import (
 IAllGitRepositories,
 IGitCollection,
@@ -78,7 +79,6 @@ from lp.code.interfaces.gitrepository import (
 )
 from lp.code.model.branch import Branch
 from lp.code.model.branchcollection import GenericBranchCollection
-from lp.code.model.branchhosting import InvalidRevisionException
 from lp.code.model.branchnamespace import (
 BRANCH_POLICY_ALLOWED_TYPES,
 BRANCH_POLICY_REQUIRED_GRANTS,
___
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/launchpad:refactor-team-membership-active-states into launchpad:master

2023-11-07 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:refactor-team-membership-active-states into 
launchpad:master.

Commit message:
Use ACTIVE_STATES in more places for team membership status checks

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This provides better abstraction than writing out something like 
`(TeamMembershipStatus.ADMIN, TeamMembershipStatus.APPROVED)` in lots of places.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:refactor-team-membership-active-states into 
launchpad:master.
diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py
index 5674164..67c91b2 100644
--- a/lib/lp/registry/browser/team.py
+++ b/lib/lp/registry/browser/team.py
@@ -115,6 +115,7 @@ from lp.registry.interfaces.person import (
 from lp.registry.interfaces.poll import IPollSet
 from lp.registry.interfaces.role import IPersonRoles
 from lp.registry.interfaces.teammembership import (
+ACTIVE_STATES,
 DAYS_BEFORE_EXPIRATION_WARNING_IS_SENT,
 CyclicalTeamMembershipError,
 ITeamMembership,
@@ -1408,8 +1409,6 @@ class TeamMembershipSelfRenewalView(LaunchpadFormView):
 """Return text describing why the membership can't be renewed."""
 context = self.context
 ondemand = TeamMembershipRenewalPolicy.ONDEMAND
-admin = TeamMembershipStatus.ADMIN
-approved = TeamMembershipStatus.APPROVED
 # We add a grace period of one day to the limit to
 # cover the fencepost error when `date_limit` is
 # earlier than `self.dateexpires`, which happens later
@@ -1417,7 +1416,7 @@ class TeamMembershipSelfRenewalView(LaunchpadFormView):
 date_limit = datetime.now(timezone.utc) + timedelta(
 days=DAYS_BEFORE_EXPIRATION_WARNING_IS_SENT + 1
 )
-if context.status not in (admin, approved):
+if context.status not in ACTIVE_STATES:
 text = "it is not active."
 elif context.team.renewal_policy != ondemand:
 text = (
diff --git a/lib/lp/registry/browser/teammembership.py b/lib/lp/registry/browser/teammembership.py
index e554738..07ccaa2 100644
--- a/lib/lp/registry/browser/teammembership.py
+++ b/lib/lp/registry/browser/teammembership.py
@@ -18,7 +18,10 @@ from zope.schema import Date
 from lp import _
 from lp.app.errors import UnexpectedFormData
 from lp.app.widgets.date import DateWidget
-from lp.registry.interfaces.teammembership import TeamMembershipStatus
+from lp.registry.interfaces.teammembership import (
+ACTIVE_STATES,
+TeamMembershipStatus,
+)
 from lp.services.webapp import LaunchpadView, canonical_url
 from lp.services.webapp.breadcrumb import Breadcrumb
 
@@ -92,10 +95,7 @@ class TeamMembershipEditView(LaunchpadView):
 
 # Boolean helpers
 def isActive(self):
-return self.context.status in [
-TeamMembershipStatus.APPROVED,
-TeamMembershipStatus.ADMIN,
-]
+return self.context.status in ACTIVE_STATES
 
 def isInactive(self):
 return self.context.status in [
diff --git a/lib/lp/registry/mail/teammembership.py b/lib/lp/registry/mail/teammembership.py
index e92b439..b305930 100644
--- a/lib/lp/registry/mail/teammembership.py
+++ b/lib/lp/registry/mail/teammembership.py
@@ -13,6 +13,7 @@ from zope.component import getUtility
 from lp.app.browser.tales import DurationFormatterAPI
 from lp.registry.enums import TeamMembershipPolicy, TeamMembershipRenewalPolicy
 from lp.registry.interfaces.teammembership import (
+ACTIVE_STATES,
 ITeamMembershipSet,
 TeamMembershipStatus,
 )
@@ -135,10 +136,7 @@ class TeamMembershipMailer(BaseMailer):
 notification_type = "team-membership-new"
 recipients = OrderedDict()
 reviewer = membership.proposed_by
-if reviewer != member and membership.status in [
-TeamMembershipStatus.APPROVED,
-TeamMembershipStatus.ADMIN,
-]:
+if reviewer != member and membership.status in ACTIVE_STATES:
 reviewer = membership.reviewed_by
 # Somebody added this person as a member, we better send a
 # notification to the person too.
@@ -161,10 +159,7 @@ class TeamMembershipMailer(BaseMailer):
 # Open teams do not notify admins about new members.
 if team.membership_policy != TeamMembershipPolicy.OPEN:
 reply_to = None
-if membership.status in [
-TeamMembershipStatus.APPROVED,
-TeamMembershipStatus.ADMIN,
-]:
+if membership.status in ACTIVE_STATES:
 template_name = "new-member-notification-for-admins.txt"
 subject = "%s joined %s" % (member.name, team.name)
 elif membership.statu

[Launchpad-reviewers] [Merge] ~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master

2023-11-05 Thread Colin Watson
The proposal to merge ~xnox/launchpad/+git/launchpad-private:deathrow-patch 
into launchpad:master has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~xnox/launchpad/+git/launchpad-private/+merge/452676
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master.


___
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] ~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master

2023-11-05 Thread Colin Watson
I somehow entirely failed to notice this when preparing 
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/454759 
(which is very similar except that it also includes necessary changes to some 
test cases), even though I swear I looked.  Sorry!  Anyway, that's deployed and 
on production now, so I'll just mark this as merged.
-- 
https://code.launchpad.net/~xnox/launchpad/+git/launchpad-private/+merge/452676
Your team Launchpad code reviewers is requested to review the proposed merge of 
~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master.


___
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] ~ines-almeida/launchpad-mojo-specs/+git/private:add-bos03-arm64-arch into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-11-04 Thread Colin Watson
Review: Needs Fixing

A good first try!  Needs a few fixes, but something like this should work.

Diff comments:

> diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
> index c601076..ec2d038 100644
> --- a/vbuilder/bundle.yaml
> +++ b/vbuilder/bundle.yaml
> @@ -131,7 +131,7 @@
>  {%-   set openstack_username_lcy02 = "launchpad-vbuilder-staging" %}
>  {%-   set vbuilders_bos01 = {"amd64": {"series": "focal", "flavor": 
> "vbuilder-gpu", "count": 1}, "arm64": {"series": "focal", "count": 1, 
> "config_drive": false}, "arm64-gpu": {"arch_base": "arm64", "arch_suffix": 
> "-gpu", "series": "focal", "flavor": "vbuilder-nvidia-l4", "count": 1, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": 
> {"series": "focal", "count": 1}} %}
>  {%-   set vbuilders_bos02 = {"arm64": {"series": "focal", "count": 1, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": 
> {"series": "focal", "count": 1}} %}
> -{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 4}, 
> "riscv64": {"series": "jammy", "count": 1, "config_drive": false}} %}
> +{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 4}, 
> "riscv64": {"series": "jammy", "count": 1, "config_drive": false}, "arm64": 
> {"series": "focal", "count": 1},} %}

I'm not 100% sure the trailing comma is safe here, and in any case it isn't 
needed.

We'll need `"config_drive": false` for the arm64 case (which is a workaround 
for OpenStack issues IIRC - I've slightly forgotten the details but they should 
be in git history if you're interested).

We'll also need `"flavor": "vbuilder-arm64"`, since that seems to be the 
relevant entry in `openstack flavor list`.

Could you keep this dict sorted by architecture name?

>  {%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 4}} %}
>  {%-   set vbuilder_prefix = "qastaging-" %}
>  {%- endif %}
> @@ -323,6 +323,24 @@ applications:
>use_swift: false
>visibility: private
>  {%- endif %}
> +{%- if stage_name == "qastaging" %}
> +  glance-simplestreams-sync-bos03-arm64:

Please sort this between `glance-simplestreams-sync-bos03-amd64` and 
`glance-simplestreams-sync-bos03-riscv64`.

> +charm: {{ charm_dir }}/glance-simplestreams-sync
> +constraints: "{{ extra_constraints }}"
> +num_units: 1
> +options:
> +  content_id_template: "{{ content_id_template }}"

Add this so that instances will boot properly:

  custom_properties: 'hypervisor_type=kvm hw_firmware_type=uefi'

> +  mirror_list: |-
> +[{url: "http://cloud-images.ubuntu.com/daily/;, name_prefix: 
> "ubuntu:released", path: "streams/v1/index.sjson", max: 3, item_filters: 
> ["release~({{ gss_series }})", "arch~(arm64|aarch64)", 
> "ftype~(disk1.img|disk.img)"]}]
> +  name_prefix: "{{ name_prefix }}/"
> +  openstack-auth-url: "https://keystone.ps6.canonical.com:5000/v3;
> +  openstack-identity-api-version: "3"
> +  openstack-tenant-name: "{{ openstack_tenant_name_bos03 }}"
> +  openstack-username: "{{ openstack_username_bos03 }}"
> +  region: scalingstack-bos03
> +  use_swift: false
> +  visibility: private
> +{%- endif %}
>glance-simplestreams-sync-lcy02-amd64:
>  charm: {{ charm_dir }}/glance-simplestreams-sync
>  constraints: "{{ extra_constraints }}"
> @@ -440,6 +458,14 @@ applications:
>remote-modifier-private-key: include-base64://{{ local_dir 
> }}/id_rsa.imagebuilder
>remote-modifier-public-key: include-base64://{{ local_dir 
> }}/id_rsa.imagebuilder.pub
>  {%- endif %}
> +{%- if stage_name == "qastaging" %}
> +  launchpad-buildd-image-modifier-bos03-arm64:

Please sort this between `launchpad-buildd-image-modifier-bos03-amd64` and 
`launchpad-buildd-image-modifier-bos03-riscv64`.

> +charm: {{ charm_dir }}/launchpad-buildd-image-modifier
> +options:
> +  clamav-database-url: "{{ clamav_database_url }}"
> +  launchpad-buildd-repository: "{{ launchpad_buildd_repository }}"
> +  linux-command-line-extra: "systemd.unified_cgroup_hierarchy=false"

Add the `compat_uts_machine=armv7l` Linux command-line option as well, so that 
arm64 machines will behave as expected when running armhf builds.  See other 
arm64 sections.

Also, since images will need to be built on a machine other than the g-s-s 
unit, add:

  remote-modifiers: '{{ modifiers_bos03 }}'
  remote-modifier-private-key: include-base64://{{ local_dir 
}}/id_rsa.imagebuilder
  remote-modifier-public-key: include-base64://{{ local_dir 
}}/id_rsa.imagebuilder.pub

Before landing this, we'll need to create an appropriate persistent instance 
from the management environment after sourcing 
`~/.scalingstack/scalingstack-bos03-vbuilder-staging.novarc`, and add its IP 
address to `modifiers_bos03`.  This is always something we've done ad-hoc, 
since Juju can't necessarily help us with all architectures; `history | grep 
'openstack server create'` in the management environment may be 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:invent-kde-org-blobs into launchpad:master

2023-11-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:invent-kde-org-blobs into 
launchpad:master.

Commit message:
Support fetching blobs from repositories on invent.kde.org

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #2040260 in Launchpad itself: "snap recipe is ignoring series: infer from 
snapcraft.yaml"
  https://bugs.launchpad.net/launchpad/+bug/2040260

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/455048
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:invent-kde-org-blobs into launchpad:master.
diff --git a/lib/lp/code/model/gitref.py b/lib/lp/code/model/gitref.py
index 240e604..9abe5d1 100644
--- a/lib/lp/code/model/gitref.py
+++ b/lib/lp/code/model/gitref.py
@@ -968,11 +968,14 @@ def _fetch_blob_from_gitlab(repository_url, ref_path, filename):
 
 
 # Some well-known GitLab instances.  This is certainly not comprehensive.
+# XXX cjwatson 2023-11-02: This should probably use a feature rule so that
+# it can be extended more easily.
 _gitlab_hostnames = {
 "gitlab.com",
 "gitlab.eclipse.org",
 "gitlab.freedesktop.org",
 "gitlab.gnome.org",
+"invent.kde.org",
 "salsa.debian.org",
 }
 
___
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-archive:always-set-cache-control into lp-archive:main

2023-11-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-archive:always-set-cache-control 
into lp-archive:main.

Commit message:
Always set Cache-Control header on redirect responses

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It's much easier to fix our nginx configuration to copy the Cache-Control 
header over to the followed-redirect response if we ensure that the redirect 
always has a Cache-Control header rather than relying on the one returned by 
the librarian.

Thanks to Clinton Fung for help puzzling this out.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-archive:always-set-cache-control into lp-archive:main.
diff --git a/lp_archive/archive.py b/lp_archive/archive.py
index 3e2e50f..f948c8f 100644
--- a/lp_archive/archive.py
+++ b/lp_archive/archive.py
@@ -76,7 +76,10 @@ def check_auth(archive: str) -> None:
 
 
 def get_extra_headers(path: str, live_at: datetime | None) -> dict[str, str]:
-headers = {}
+# It's safe to default to long caching even for files in private
+# archives, since we always set "Vary: Authorization" (see add_headers
+# below).
+cache_control = "max-age=31536000"
 # Non-content-addressed files under dists/ are mutable and may change on
 # subsequent publisher runs, so if we aren't addressing a snapshot then
 # we need to tell caches to give them a relatively short expiry time.
@@ -84,8 +87,8 @@ def get_extra_headers(path: str, live_at: datetime | None) -> dict[str, str]:
 if live_at is None:
 path_parts = PurePath(path).parts
 if path_parts[0] == "dists" and path_parts[2:][-3:-2] != ("by-hash",):
-headers["Cache-Control"] = "max-age=1800, proxy-revalidate"
-return headers
+cache_control = "max-age=1800, proxy-revalidate"
+return {"Cache-Control": cache_control}
 
 
 def translate(
diff --git a/tests/test_archive.py b/tests/test_archive.py
index 11481f7..a40cc6b 100644
--- a/tests/test_archive.py
+++ b/tests/test_archive.py
@@ -306,32 +306,33 @@ def test_translate_cache_control_dists_not_found(client, archive_proxy):
 
 
 def test_translate_cache_control_dists_at_timestamp(client, archive_proxy):
-# Non-content-addressed requests to a snapshot do not get a
-# Cache-Control header, even if they're under dists/.
+# Non-content-addressed requests to a snapshot get a Cache-Control
+# header with a long expiry time, even if they're under dists/.
 response = client.get(
 "/ubuntu/20220101T12Z/dists/focal/InRelease",
 headers=[("Host", "snapshot.ubuntu.test")],
 )
 assert response.status_code == 307
-assert "Cache-Control" not in response.headers
+assert response.headers["Cache-Control"] == "max-age=31536000"
 
 
 def test_translate_cache_control_dists_by_hash(client, archive_proxy):
-# Content-addressed requests under dists/ do not get a Cache-Control
-# header.
+# Content-addressed requests under dists/ get a Cache-Control header
+# with a long expiry time.
 response = client.get(
 f"/ubuntu/dists/focal/by-hash/SHA256/{'0' * 64}",
 headers=[("Host", "snapshot.ubuntu.test")],
 )
 assert response.status_code == 307
-assert "Cache-Control" not in response.headers
+assert response.headers["Cache-Control"] == "max-age=31536000"
 
 
 def test_translate_cache_control_not_dists(client, archive_proxy):
-# Requests not under dists/ do not get a Cache-Control header.
+# Requests not under dists/ get a Cache-Control header with a long
+# expiry time.
 response = client.get(
 "/ubuntu/pool/main/h/hello/hello_1.0-1.deb",
 headers=[("Host", "snapshot.ubuntu.test")],
 )
 assert response.status_code == 307
-assert "Cache-Control" not in response.headers
+assert response.headers["Cache-Control"] == "max-age=31536000"
___
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/launchpad:charm-fix-rebuilds-index into launchpad:master

2023-10-30 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-fix-rebuilds-index 
into launchpad:master.

Commit message:
charm: Fix rebuild-test.internal indexes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The directory entries in `rebuilds_dir` are actually symlinks into 
`archives_dir`, so we need to allow Apache access to the latter as well.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-fix-rebuilds-index into launchpad:master.
diff --git a/charm/launchpad-copy-archive-publisher/templates/vhosts/rebuild-test.conf.j2 b/charm/launchpad-copy-archive-publisher/templates/vhosts/rebuild-test.conf.j2
index d4f7b22..6c985ab 100644
--- a/charm/launchpad-copy-archive-publisher/templates/vhosts/rebuild-test.conf.j2
+++ b/charm/launchpad-copy-archive-publisher/templates/vhosts/rebuild-test.conf.j2
@@ -17,5 +17,9 @@
 IndexIgnore favicon.ico
 Require all granted
 
+
+
+Require all granted
+
 
 
___
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/launchpad:charm-fix-derived-archive-vhost into launchpad:master

2023-10-30 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-fix-derived-archive-vhost into launchpad:master.

Commit message:
charm: Fix derived.archive.canonical.com vhost config

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The document root for derived.archive.canonical.com points to an "archives" 
subdirectory that includes only some carefully-constructed symlinks that point 
into sub-sub-directories of `archives_dir`: for example, `archives/ubuntu-rtm` 
is a symlink to `ubuntu-rtm-archive/ubuntu-rtm` (relative to `archives_dir`), 
which lets us expose the actual archive contents without exposing all the 
temporary data and so on under other subdirectories of `ubuntu-rtm-archive`.

This is all quite historically weird, but let's mimic it so that we can migrate 
from the pre-charmed deployment while preserving existing URLs.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-fix-derived-archive-vhost into launchpad:master.
diff --git a/charm/launchpad-copy-archive-publisher/templates/vhosts/derived.conf.j2 b/charm/launchpad-copy-archive-publisher/templates/vhosts/derived.conf.j2
index 1ff9e19..8d00960 100644
--- a/charm/launchpad-copy-archive-publisher/templates/vhosts/derived.conf.j2
+++ b/charm/launchpad-copy-archive-publisher/templates/vhosts/derived.conf.j2
@@ -4,9 +4,9 @@
 CustomLog /var/log/apache2/{{ domain_derived_archive }}-access.log combined
 ErrorLog /var/log/apache2/{{ domain_derived_archive }}-error.log
 
-DocumentRoot {{ archives_dir }}
+DocumentRoot {{ archives_dir }}/archives
 
-
+
 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted
___
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/txpkgupload:charm-fix-log-messages into txpkgupload:master

2023-10-29 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/txpkgupload:charm-fix-log-messages 
into txpkgupload:master.

Commit message:
charm: Fix missing space in log messages

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/txpkgupload/+git/txpkgupload/+merge/454765
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/txpkgupload:charm-fix-log-messages into txpkgupload:master.
diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
index c563685..689aa90 100644
--- a/charm/txpkgupload/reactive/txpkgupload.py
+++ b/charm/txpkgupload/reactive/txpkgupload.py
@@ -68,7 +68,7 @@ def write_ssh_keys(config: Dict):
 sftp_host_key_private_path = os.path.join(keys_dir, "ssh-host-key")
 hookenv.log(
 "Writing private ssh key"
-+ "from config to: {}".format(sftp_host_key_private_path)
++ " from config to: {}".format(sftp_host_key_private_path)
 )
 host.write_file(
 sftp_host_key_private_path,
@@ -80,7 +80,7 @@ def write_ssh_keys(config: Dict):
 sftp_host_key_public_path = os.path.join(keys_dir, "ssh-host-key.pub")
 hookenv.log(
 "Writing public ssh key"
-+ "from config to: {}".format(sftp_host_key_public_path)
++ " from config to: {}".format(sftp_host_key_public_path)
 )
 host.write_file(
 sftp_host_key_public_path,
___
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/launchpad:pre-commit-flake8-bugbear into launchpad:master

2023-10-29 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:pre-commit-flake8-bugbear 
into launchpad:master.

Commit message:
pre-commit: Enable flake8-bugbear

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We haven't yet fixed all its default warnings, but most of them seem 
reasonable.  Get this into our `pre-commit` checks so that we at least don't 
regress the ones we've fixed so far.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:pre-commit-flake8-bugbear into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 12369b7..7e7f119 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -60,6 +60,7 @@ repos:
 additional_dependencies:
   - flake8-absolute-import==1.0.0.1
   - flake8-alfred==1.1.1
+  - flake8-bugbear==23.3.12
 -   repo: https://github.com/pre-commit/mirrors-eslint
 rev: v8.33.0
 hooks:
diff --git a/setup.cfg b/setup.cfg
index faaf10b..51645e8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -191,6 +191,16 @@ exclude =
 # to Launchpad's style.
 lib/contrib
 ignore =
+# Temporarily ignore Bugbear checks that we haven't yet fixed everywhere.
+B004,
+B006,
+B008,
+B011,
+B015,
+B020,
+B023,
+B028,
+B031,
 # Incompatible with Black.
 E203,
 # ==/!= comparisons with True/False/None are common idioms with Storm.
___
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/launchpad:loggerhead-max-requests into launchpad:master

2023-10-28 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:loggerhead-max-requests 
into launchpad:master.

Commit message:
loggerhead: Set Gunicorn max_requests to 2000

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We've found with Launchpad itself that the application server leaks memory over 
time.  This is surely a bug somewhere, but it's proven extremely difficult to 
track down, and a cheap and very effective workaround has been to set 
`max_requests` in Gunicorn.  (See the "Memory leaks" section of 
https://www.chiark.greenend.org.uk/~cjwatson/blog/lp-python3.html for some 
background.)

Judging by memory graphs, Loggerhead is behaving in very much the same way, so 
install the same workaround there.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:loggerhead-max-requests into launchpad:master.
diff --git a/lib/launchpad_loggerhead/wsgi.py b/lib/launchpad_loggerhead/wsgi.py
index 00defe8..23322d2 100644
--- a/lib/launchpad_loggerhead/wsgi.py
+++ b/lib/launchpad_loggerhead/wsgi.py
@@ -113,6 +113,8 @@ def _on_starting_hook(arbiter):
 )
 
 
+# XXX cjwatson 2023-10-29: Refactor this so that the charm can supply the
+# gunicorn configuration.
 class LoggerheadApplication(Application):
 def __init__(self, **kwargs):
 self.options = kwargs
@@ -140,6 +142,9 @@ class LoggerheadApplication(Application):
 "forwarded_allow_ips": "*",
 "logger_class": "launchpad_loggerhead.wsgi.LoggerheadLogger",
 "loglevel": "debug",
+# This is set relatively low to work around memory leaks on
+# Python 3.
+"max_requests": 2000,
 "on_starting": _on_starting_hook,
 "pidfile": pidfile_path("codebrowse"),
 "preload_app": True,
___
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/launchpad:deathrow-sha256 into launchpad:master

2023-10-28 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:deathrow-sha256 into 
launchpad:master.

Commit message:
deathrow: Compare SHA-256 hashes instead of MD5

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

There's no obvious reason to use the weaker hashes when checking whether we can 
remove files from archives, and this is a small step towards not having to 
store MD5 hashes in the first place.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:deathrow-sha256 into launchpad:master.
diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py
index 439971e..36c280f 100644
--- a/lib/lp/archivepublisher/deathrow.py
+++ b/lib/lp/archivepublisher/deathrow.py
@@ -160,7 +160,7 @@ class DeathRow:
 
 return (sources, binaries)
 
-def canRemove(self, publication_class, filename, file_md5):
+def canRemove(self, publication_class, filename, file_sha256):
 """Check if given (filename, MD5) can be removed from the pool.
 
 Check the archive reference-counter implemented in:
@@ -199,7 +199,7 @@ class DeathRow:
 [
 LibraryFileAlias.content == LibraryFileContent.id,
 LibraryFileAlias.filename == filename,
-LibraryFileContent.md5 == file_md5,
+LibraryFileContent.sha256 == file_sha256,
 ]
 )
 
@@ -247,9 +247,9 @@ class DeathRow:
 files = pub_record.files
 for pub_file in files:
 filename = pub_file.libraryfile.filename
-file_md5 = pub_file.libraryfile.content.md5
+file_sha256 = pub_file.libraryfile.content.sha256
 
-self.logger.debug("Checking %s (%s)" % (filename, file_md5))
+self.logger.debug("Checking %s (%s)" % (filename, file_sha256))
 
 # Calculating the file path in pool.
 pub_file_details = (
@@ -264,15 +264,17 @@ class DeathRow:
 # verified. If the verification was already made and the
 # file is condemned queue the publishing record for removal
 # otherwise just continue the iteration.
-if (filename, file_md5) in considered_files:
+if (filename, file_sha256) in considered_files:
 self.logger.debug("Already verified.")
 if file_path in condemned_files:
 condemned_records.add(pub_record)
 continue
-considered_files.add((filename, file_md5))
+considered_files.add((filename, file_sha256))
 
 # Check if the removal is allowed, if not continue.
-if not self.canRemove(publication_class, filename, file_md5):
+if not self.canRemove(
+publication_class, filename, file_sha256
+):
 self.logger.debug("Cannot remove.")
 continue
 
diff --git a/lib/lp/archivepublisher/tests/deathrow.rst b/lib/lp/archivepublisher/tests/deathrow.rst
index cbe463f..ded2fd6 100644
--- a/lib/lp/archivepublisher/tests/deathrow.rst
+++ b/lib/lp/archivepublisher/tests/deathrow.rst
@@ -268,8 +268,10 @@ Run DeathRow against the current 'removable' context.
 DEBUG 4 Sources
 DEBUG 3 Binaries
 ...
-DEBUG Checking superseded_666.dsc (02129bb861061d1a052c592e2dc6b383)
-DEBUG Checking obsolete_666.dsc (02129bb861061d1a052c592e2dc6b383)
+DEBUG Checking superseded_666.dsc
+(4b68ab3847feda7d6c62c1fbcbeebfa35eab7351ed5e78f4ddadea5df64b8015)
+DEBUG Checking obsolete_666.dsc
+(4b68ab3847feda7d6c62c1fbcbeebfa35eab7351ed5e78f4ddadea5df64b8015)
 ...
 INFO Removing 7 files marked for reaping
 DEBUG Removing superseded/superseded_666.dsc from main
@@ -367,9 +369,11 @@ Now DeathRow considers 'stuck-bin' publications.
 >>> death_row.reap()
 DEBUG 0 Sources
 DEBUG 2 Binaries
-DEBUG Checking stuck-bin_666_i386.deb (21c2e59531c8710156d34a3c30ac81d5)
+DEBUG Checking stuck-bin_666_i386.deb
+(bbeebd879e1dff6918546dc0c179fdde505f2a21591c9a9c96e36b054ec5af83)
 DEBUG Cannot remove.
-DEBUG Checking stuck-bin_666_i386.deb (21c2e59531c8710156d34a3c30ac81d5)
+DEBUG Checking stuck-bin_666_i386.deb
+(bbeebd879e1dff6918546dc0c179fdde505f2a21591c9a9c96e36b054ec5af83)
 DEBUG Already verified.
 INFO Removing 0 files marked for reaping
 INFO Total bytes freed: 0
@@ -393,10 +397,13 @@ single pass.
 >>> death_row.reap()
 DEBUG 0 Sources
 DEBUG 3 Binaries
-DEBUG Checking stuck-bin_666_i386.deb (21c2e59531c8710156d34a3c30ac81d5)
-DEBUG Checking stuck-bin_666_i386.deb (21c

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:snap-improve-infer-pro-enable into launchpad:master

2023-10-27 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:snap-improve-infer-pro-enable into launchpad:master.

Commit message:
snap: Improve some edge cases in inferProEnable

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Snaps with `build-base` but no `base` and snaps with `type: base` weren't being 
handled quite correctly, resulting in some cases returning True when they 
shouldn't.  Bring these cases into line with the algorithm in `Snap._findBase`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:snap-improve-infer-pro-enable into launchpad:master.
diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
index c475075..92dd911 100644
--- a/lib/lp/snappy/model/snap.py
+++ b/lib/lp/snappy/model/snap.py
@@ -1675,7 +1675,18 @@ class SnapSet:
 pass
 else:
 base = snapcraft_data.get("base")
-if base is None or base == "core":
+build_base = snapcraft_data.get("build-base")
+name = snapcraft_data.get("name")
+snap_type = snapcraft_data.get("type")
+
+if build_base is not None:
+snap_base_name = build_base
+elif name is not None and snap_type == "base":
+snap_base_name = name
+else:
+snap_base_name = base
+
+if snap_base_name is None or snap_base_name == "core":
 return True
 
 return False
diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py
index 5675585..0e6a31e 100644
--- a/lib/lp/snappy/tests/test_snap.py
+++ b/lib/lp/snappy/tests/test_snap.py
@@ -3670,13 +3670,16 @@ class TestSnapProcessors(TestCaseWithFactory):
 - Else, default to False
 """
 
-refs = [self.factory.makeGitRefs()[0] for _ in range(4)]
+refs = [self.factory.makeGitRefs()[0] for _ in range(7)]
 blobs = {
 ref.repository.getInternalPath(): blob
 for ref, blob in (
 (refs[0], b"name: test-snap\n"),
 (refs[1], b"name: test-snap\nbase: core\n"),
 (refs[2], b"name: test-snap\nbase: core18\n"),
+(refs[3], b"name: test-snap\nbuild-base: devel\n"),
+(refs[4], b"name: core\ntype: base\n"),
+(refs[5], b"name: core18\ntype: base\n"),
 )
 }
 self.useFixture(
@@ -3687,7 +3690,10 @@ class TestSnapProcessors(TestCaseWithFactory):
 self.assertTrue(inferProEnable(refs[0]))  # Snap with no base
 self.assertTrue(inferProEnable(refs[1]))  # Snap with 'core' base
 self.assertFalse(inferProEnable(refs[2]))  # Snap with 'core18' base
-self.assertFalse(inferProEnable(refs[3]))  # Snap w/out snapcraft.yaml
+self.assertFalse(inferProEnable(refs[3]))  # Snap with only build-base
+self.assertTrue(inferProEnable(refs[4]))  # 'core' snap itself
+self.assertFalse(inferProEnable(refs[5]))  # 'core18' snap itself
+self.assertFalse(inferProEnable(refs[6]))  # Snap w/out snapcraft.yaml
 self.assertFalse(inferProEnable(None))  # Snap w/out ref or branch
 
 
___
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/launchpad:charm-copy-archive-publisher-archives-dir into launchpad:master

2023-10-26 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-copy-archive-publisher-archives-dir into 
launchpad:master.

Commit message:
charm: Set archives_dir for copy archive publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This needs to be passed on to the application so that 
`lp.archivepublisher.config.getPubConfig` (via 
`lp.archivepublisher.model.publisherconfig.PublisherConfig.absolute_root_dir`) 
knows to publish archives to the correct place in the filesystem.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-copy-archive-publisher-archives-dir into 
launchpad:master.
diff --git a/charm/launchpad-copy-archive-publisher/reactive/launchpad-copy-archive-publisher.py b/charm/launchpad-copy-archive-publisher/reactive/launchpad-copy-archive-publisher.py
index 1288bfd..d88c239 100644
--- a/charm/launchpad-copy-archive-publisher/reactive/launchpad-copy-archive-publisher.py
+++ b/charm/launchpad-copy-archive-publisher/reactive/launchpad-copy-archive-publisher.py
@@ -64,6 +64,7 @@ def configure_copy_publish_archives_cronjob(config):
 def configure():
 hookenv.log("Configuring copy-archive-publisher")
 config = get_service_config()
+config["archives_dir"] = archives_dir()
 config["run_parts_location"] = publisher_parts_dir()
 
 host.mkdir(
diff --git a/charm/launchpad-copy-archive-publisher/templates/launchpad-copy-archive-publisher-lazr.conf.j2 b/charm/launchpad-copy-archive-publisher/templates/launchpad-copy-archive-publisher-lazr.conf.j2
index 2eb43c9..35dfef2 100644
--- a/charm/launchpad-copy-archive-publisher/templates/launchpad-copy-archive-publisher-lazr.conf.j2
+++ b/charm/launchpad-copy-archive-publisher/templates/launchpad-copy-archive-publisher-lazr.conf.j2
@@ -10,6 +10,7 @@
 extends: ../launchpad-db-lazr.conf
 
 [archivepublisher]
+archives_dir: {{ archives_dir }}
 run_parts_location: {{ run_parts_location }}
 
 [signing]
___
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/launchpad:charm-admin-bot-account-actions into launchpad:master

2023-10-26 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-admin-bot-account-actions into launchpad:master.

Commit message:
charm: Add launchpad-admin actions to manage bot accounts

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is for use by lp:canonical-is-service-manager.  It seems to use all the 
options of the underlying scripts, so I've just passed them all through as 
action parameters.  (The bits that seem unduly Canonical-specific are that way 
in the underlying scripts.)
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-admin-bot-account-actions into launchpad:master.
diff --git a/charm/launchpad-admin/actions.yaml b/charm/launchpad-admin/actions.yaml
new file mode 100644
index 000..7fd7a21
--- /dev/null
+++ b/charm/launchpad-admin/actions.yaml
@@ -0,0 +1,38 @@
+create-bot-account:
+  description: >
+Create a bot account.  This is intended mainly for use within
+Canonical's infrastructure, and so makes some assumptions around SSO
+account creation and team membership that only hold there; people
+running it elsewhere will need to set the "openid" and "teams"
+parameters.
+  params:
+username:
+  type: string
+  description: Username for the bot.
+openid:
+  type: string
+  description: >
+OpenID identifier suffix.  When used from Canonical's service
+manager infrastructure, this is unnecessary because SSO account
+creation handles it.
+email:
+  type: string
+  description: Email address.  Defaults to webops+usern...@canonical.com.
+sshkey:
+  type: string
+  description: SSH public key.  Defaults to no SSH key.
+teams:
+  type: string
+  description: >
+Add the bot to this comma-separated list of teams.  Defaults to
+canonical-is-devopsolution-bots.
+  required:
+- username
+suspend-bot-account:
+  description: Suspend a bot account.
+  params:
+email:
+  type: string
+  description: Email address for the bot.
+  required:
+- email
diff --git a/charm/launchpad-admin/actions/actions.py b/charm/launchpad-admin/actions/actions.py
new file mode 100755
index 000..8fb63a5
--- /dev/null
+++ b/charm/launchpad-admin/actions/actions.py
@@ -0,0 +1,84 @@
+#! /usr/bin/python3
+# Copyright 2023 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+import subprocess
+import sys
+import traceback
+from pathlib import Path
+
+sys.path.append("lib")
+
+from charms.layer import basic  # noqa: E402
+
+basic.bootstrap_charm_deps()
+basic.init_config_states()
+
+from charmhelpers.core import hookenv  # noqa: E402
+from ols import base  # noqa: E402
+
+
+def create_bot_account():
+params = hookenv.action_get()
+script = Path(base.code_dir(), "scripts", "create-bot-account.py")
+command = [
+"sudo",
+"-H",
+"-u",
+base.user(),
+"LPCONFIG=launchpad-admin",
+"--",
+script,
+"--username",
+params["username"],
+]
+if "openid" in params:
+command.extend(["--openid", params["openid"]])
+if "email" in params:
+command.extend(["--email", params["email"]])
+if "sshkey" in params:
+command.extend(["--sshkey", params["sshkey"]])
+if "teams" in params:
+command.extend(["--teams", params["teams"]])
+subprocess.run(command, check=True)
+hookenv.action_set({"result": f"Created {params['username']}"})
+
+
+def suspend_bot_account():
+params = hookenv.action_get()
+script = Path(base.code_dir(), "scripts", "suspend-bot-account.py")
+command = [
+"sudo",
+"-H",
+"-u",
+base.user(),
+"LPCONFIG=launchpad-admin",
+"--",
+script,
+"--email",
+params["email"],
+]
+subprocess.run(command, check=True)
+hookenv.action_set({"result": f"Suspended {params['email']}"})
+
+
+def main(argv):
+action = Path(argv[0]).name
+try:
+if action == "create-bot-account":
+create_bot_account()
+elif action == "suspend-bot-account":
+suspend_bot_account()
+else:
+hookenv.action_fail(f"Action {action} not implemented.")
+except Exception:
+hookenv.action_fail("Unhandled exception")
+tb = traceback.format_exc()
+hook

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-loggerhead-enable into launchpad:master

2023-10-26 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-loggerhead-enable 
into launchpad:master.

Commit message:
charm: Enable launchpad-loggerhead service

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/454597
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-loggerhead-enable into launchpad:master.
diff --git a/charm/launchpad-loggerhead/reactive/launchpad-loggerhead.py b/charm/launchpad-loggerhead/reactive/launchpad-loggerhead.py
index e12dd1a..6536f45 100644
--- a/charm/launchpad-loggerhead/reactive/launchpad-loggerhead.py
+++ b/charm/launchpad-loggerhead/reactive/launchpad-loggerhead.py
@@ -117,6 +117,7 @@ def configure():
 def restart():
 hookenv.log("Restarting application server")
 host.service_restart("launchpad-loggerhead.service")
+host.service_resume("launchpad-loggerhead.service")
 set_flag("service.configured")
 
 
___
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/launchpad:fix-bugbear-unused-loop-variables into launchpad:master

2023-10-23 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:fix-bugbear-unused-loop-variables into launchpad:master.

Commit message:
Fix test failures caused by "Remove/rename unused loop variables"

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/454266
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:fix-bugbear-unused-loop-variables into launchpad:master.
diff --git a/lib/lp/services/librarianserver/librariangc.py b/lib/lp/services/librarianserver/librariangc.py
index 1f362e6..1cec619 100644
--- a/lib/lp/services/librarianserver/librariangc.py
+++ b/lib/lp/services/librarianserver/librariangc.py
@@ -316,7 +316,7 @@ def merge_duplicates(con):
 UPDATE LibraryFileAlias SET content=%(prime_id)s
 WHERE content = %(other_id)s
 """,
-{"other_id": other_id},
+{"prime_id": prime_id, "other_id": other_id},
 )
 prime_count += 1
 dupe_count += len(dupes)
diff --git a/lib/lp/translations/tests/test_translationsplitter.py b/lib/lp/translations/tests/test_translationsplitter.py
index 83e7d43..f2c591b 100644
--- a/lib/lp/translations/tests/test_translationsplitter.py
+++ b/lib/lp/translations/tests/test_translationsplitter.py
@@ -71,7 +71,7 @@ class TestTranslationSplitter(TestCaseWithFactory):
 shared = list(splitter.findShared())
 for upstream, ubuntu in shared:
 self.assertEqual(upstream.potmsgset, ubuntu.potmsgset)
-self.assertEqual(1, len(shared))
+self.assertEqual(2, len(shared))
 
 def test_splitPOTMsgSet(self):
 """Splitting a POTMsgSet clones it and updates TemplateItem."""
___
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/launchpad:charm-bump-launchpad-layers into launchpad:master

2023-10-23 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-bump-launchpad-layers into launchpad:master.

Commit message:
charm: Bump launchpad-layers to 0fd04056ad

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This pulls in "Add dependencies of lp:ubuntu-archive-publishing".
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-bump-launchpad-layers into launchpad:master.
diff --git a/charm/launchpad-admin/charmcraft.yaml b/charm/launchpad-admin/charmcraft.yaml
index 7c7ccdb..3fa734d 100644
--- a/charm/launchpad-admin/charmcraft.yaml
+++ b/charm/launchpad-admin/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-appserver/charmcraft.yaml b/charm/launchpad-appserver/charmcraft.yaml
index 9a12f79..607181d 100644
--- a/charm/launchpad-appserver/charmcraft.yaml
+++ b/charm/launchpad-appserver/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-assets/charmcraft.yaml b/charm/launchpad-assets/charmcraft.yaml
index 0f1fc76..5d3fc15 100644
--- a/charm/launchpad-assets/charmcraft.yaml
+++ b/charm/launchpad-assets/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-buildd-manager/charmcraft.yaml b/charm/launchpad-buildd-manager/charmcraft.yaml
index 7c7ccdb..3fa734d 100644
--- a/charm/launchpad-buildd-manager/charmcraft.yaml
+++ b/charm/launchpad-buildd-manager/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-copy-archive-publisher/charmcraft.yaml b/charm/launchpad-copy-archive-publisher/charmcraft.yaml
index 5010346..605f876 100644
--- a/charm/launchpad-copy-archive-publisher/charmcraft.yaml
+++ b/charm/launchpad-copy-archive-publisher/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-db-update/charmcraft.yaml b/charm/launchpad-db-update/charmcraft.yaml
index 7c7ccdb..3fa734d 100644
--- a/charm/launchpad-db-update/charmcraft.yaml
+++ b/charm/launchpad-db-update/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-debian-importer/charmcraft.yaml b/charm/launchpad-debian-importer/charmcraft.yaml
index 7c7ccdb..3fa734d 100644
--- a/charm/launchpad-debian-importer/charmcraft.yaml
+++ b/charm/launchpad-debian-importer/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d50991efed385ec48"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-ftpmaster-publisher/charmcraft.yaml b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
index 5010346..605f876 100644
--- a/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
+++ b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "91defc30732b2565251101196630e5303fed7a64"
+source-commit: "0fd04056ad0ddb366be6ad7d5

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad-layers:publisher-parts-dependencies into launchpad-layers:main

2023-10-21 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-layers:publisher-parts-dependencies into 
launchpad-layers:main.

Commit message:
Add dependencies of lp:ubuntu-archive-publishing

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Those hook scripts need a few dependencies, and there's nowhere else sensible 
to declare them.  This will have to do.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-layers:publisher-parts-dependencies into 
launchpad-layers:main.
diff --git a/launchpad-publisher-parts/layer.yaml b/launchpad-publisher-parts/layer.yaml
index 2db9545..1a18e7a 100644
--- a/launchpad-publisher-parts/layer.yaml
+++ b/launchpad-publisher-parts/layer.yaml
@@ -4,4 +4,8 @@ options:
   apt:
 packages:
   - brz
+  # The following packages are needed by lp:ubuntu-archive-publishing.
+  - procmail  # for lockfile
+  - python3-apt
+  - python3-germinate
 repo: https://git.launchpad.net/launchpad-layers
___
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/launchpad:charm-bump-launchpad-layers into launchpad:master

2023-10-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-bump-launchpad-layers into launchpad:master.

Commit message:
charm: Bump launchpad-layers to 91defc3073

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This pulls in "launchpad-publisher-parts: Fix parts directory".
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-bump-launchpad-layers into launchpad:master.
diff --git a/charm/launchpad-admin/charmcraft.yaml b/charm/launchpad-admin/charmcraft.yaml
index d606ade..7c7ccdb 100644
--- a/charm/launchpad-admin/charmcraft.yaml
+++ b/charm/launchpad-admin/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-appserver/charmcraft.yaml b/charm/launchpad-appserver/charmcraft.yaml
index 21d790f..9a12f79 100644
--- a/charm/launchpad-appserver/charmcraft.yaml
+++ b/charm/launchpad-appserver/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-assets/charmcraft.yaml b/charm/launchpad-assets/charmcraft.yaml
index d6a95d9..0f1fc76 100644
--- a/charm/launchpad-assets/charmcraft.yaml
+++ b/charm/launchpad-assets/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-buildd-manager/charmcraft.yaml b/charm/launchpad-buildd-manager/charmcraft.yaml
index d606ade..7c7ccdb 100644
--- a/charm/launchpad-buildd-manager/charmcraft.yaml
+++ b/charm/launchpad-buildd-manager/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-copy-archive-publisher/charmcraft.yaml b/charm/launchpad-copy-archive-publisher/charmcraft.yaml
index b3b3126..5010346 100644
--- a/charm/launchpad-copy-archive-publisher/charmcraft.yaml
+++ b/charm/launchpad-copy-archive-publisher/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-db-update/charmcraft.yaml b/charm/launchpad-db-update/charmcraft.yaml
index d606ade..7c7ccdb 100644
--- a/charm/launchpad-db-update/charmcraft.yaml
+++ b/charm/launchpad-db-update/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-debian-importer/charmcraft.yaml b/charm/launchpad-debian-importer/charmcraft.yaml
index d606ade..7c7ccdb 100644
--- a/charm/launchpad-debian-importer/charmcraft.yaml
+++ b/charm/launchpad-debian-importer/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196630e5303fed7a64"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/launchpad-ftpmaster-publisher/charmcraft.yaml b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
index b3b3126..5010346 100644
--- a/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
+++ b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
@@ -35,7 +35,7 @@ parts:
 after:
   - ols-layers
 source: https://git.launchpad.net/launchpad-layers
-source-commit: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-commit: "91defc30732b2565251101196

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad-layers:fix-publisher-parts-directory into launchpad-layers:main

2023-10-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-layers:fix-publisher-parts-directory into 
launchpad-layers:main.

Commit message:
launchpad-publisher-parts: Fix parts directory

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

`publisher_parts_dir()` was set as 
`config.archivepublisher.run_parts_location`, and is 
`/srv/launchpad/publisher-parts`.  However, the code that uses this looks like 
this:

def find_run_parts_dir(distribution_name, parts):
"""Find the requested run-parts directory, if it exists."""
run_parts_location = config.archivepublisher.run_parts_location
if not run_parts_location:
return None

parts_dir = os.path.join(run_parts_location, distribution_name, parts)
if file_exists(parts_dir):
return parts_dir
else:
return None

This means that it's actually trying to look in 
`/srv/launchpad/publisher-parts/ubuntu`, which didn't exist.

The layer's configuration is really a bit wrong for this, since strictly we 
ought to support multiple distributions with independent configuration for 
each.  However, for now, hardcoding Ubuntu will do well enough.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-layers:fix-publisher-parts-directory into 
launchpad-layers:main.
diff --git a/launchpad-publisher-parts/lib/charms/launchpad/publisher_parts.py b/launchpad-publisher-parts/lib/charms/launchpad/publisher_parts.py
index 848ed74..d3ab445 100644
--- a/launchpad-publisher-parts/lib/charms/launchpad/publisher_parts.py
+++ b/launchpad-publisher-parts/lib/charms/launchpad/publisher_parts.py
@@ -21,6 +21,13 @@ def publisher_parts_dir():
 return os.path.join(base.base_dir(), parts)
 
 
+def publisher_parts_subdir():
+# XXX cjwatson 2023-10-20: Need to unhardcode Ubuntu here, but that
+# probably requires reshaping the configuration to take a dict of
+# distribution name -> (repository, revision).
+return os.path.join(publisher_parts_dir(), "ubuntu")
+
+
 def safe_payload_dir(repository, revision):
 dir = quote(urlparse(repository).path, safe="")
 return os.path.join(payloads_dir(), f"{dir}-{revision}")
@@ -33,8 +40,8 @@ def ensure_payloads_dir():
 
 
 def get_current_revision():
-current_revision_path = os.path.realpath(publisher_parts_dir())
-if current_revision_path == publisher_parts_dir():
+current_revision_path = os.path.realpath(publisher_parts_subdir())
+if current_revision_path == publisher_parts_subdir():
 return ""
 return current_revision_path
 
@@ -64,15 +71,23 @@ def link_run_parts(repository, revision):
 
 dir_path = safe_payload_dir(repository, revision)
 run_parts_dir = publisher_parts_dir()
+run_parts_subdir = publisher_parts_subdir()
+
+hookenv.log(f"Creating symlink {dir_path} {run_parts_subdir}")
 
-hookenv.log(f"Creating symlink {dir_path} {run_parts_dir}")
+# Fix up mistaken layout in earlier versions of this layer.
+if os.path.islink(run_parts_dir):
+os.unlink(run_parts_dir)
 
+host.mkdir(
+run_parts_dir, owner=base.user(), group=base.user(), perms=0o755
+)
 try:
-os.unlink(f"{run_parts_dir}.new")
+os.unlink(f"{run_parts_subdir}.new")
 except FileNotFoundError:
 pass
-os.symlink(dir_path, f"{run_parts_dir}.new")
-os.rename(f"{run_parts_dir}.new", run_parts_dir)
+os.symlink(dir_path, f"{run_parts_subdir}.new")
+os.rename(f"{run_parts_subdir}.new", run_parts_subdir)
 
 
 def prune_payloads(keep_revisions):
___
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/launchpad:charm-buildd-manager-authentication-timeout-option into launchpad:master

2023-10-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-buildd-manager-authentication-timeout-option into 
launchpad:master.

Commit message:
charm: Allow buildd-manager authentication timeout to be tuned

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It looks like we may need to adjust this on production, so add a charm option 
for it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-buildd-manager-authentication-timeout-option into 
launchpad:master.
diff --git a/charm/launchpad-buildd-manager/config.yaml b/charm/launchpad-buildd-manager/config.yaml
index ea622d3..58cbfe4 100644
--- a/charm/launchpad-buildd-manager/config.yaml
+++ b/charm/launchpad-buildd-manager/config.yaml
@@ -9,6 +9,12 @@ options:
   Credentials for reading from Artifactory repositories (formatted as
   "user:token").
 default: ""
+  authentication_timeout:
+type: int
+description: >
+  The time in seconds that the builddmaster will wait for a reply from
+  the authserver.
+default: 60
   builder_proxy_auth_api_admin_secret:
 type: string
 description: >
diff --git a/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf b/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
index ddf9fbd..3641a19 100644
--- a/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
+++ b/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
@@ -13,7 +13,7 @@ extends: ../launchpad-db-lazr.conf
 
 [builddmaster]
 authentication_endpoint: http://{{ domain_xmlrpc_private }}:{{ port_xmlrpc }}/authserver
-authentication_timeout: 60
+authentication_timeout: {{ authentication_timeout }}
 {{- opt("builder_proxy_auth_api_admin_username", builder_proxy_auth_api_admin_username) }}
 {{- opt("builder_proxy_auth_api_endpoint", builder_proxy_auth_api_endpoint) }}
 {{- opt("builder_proxy_host", builder_proxy_host) }}
___
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/launchpad:charm-ftpmaster-top-level-directory-index into launchpad:master

2023-10-20 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-ftpmaster-top-level-directory-index into 
launchpad:master.

Commit message:
charm: Enable a top-level directory index on ftpmaster-publish

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Although it doesn't strictly break anything if http://ftpmaster.internal/ 
returns 403 (as opposed to http://ftpmaster.internal/ubuntu/ etc.), it's a bit 
ugly and makes it look as though things are broken.  Restructure the Apache 
configuration so that requests for a top-level directory index return 200 with 
a filtered index showing only the permitted subdirectories.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-ftpmaster-top-level-directory-index into 
launchpad:master.
diff --git a/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2 b/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
index 169ff83..b24e533 100644
--- a/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
+++ b/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
@@ -6,14 +6,19 @@
 CustomLog /var/log/apache2/{{ domain_ftpmaster }}-access.log combined
 ErrorLog /var/log/apache2/{{ domain_ftpmaster }}-error.log
 
-{% for distribution in ("ubuntu", "ubuntu-partner") %}
-
+
 IndexOptions NameWidth=* +SuppressDescription
 Options +Indexes +FollowSymLinks
 IndexIgnore favicon.ico
 AllowOverride None
 Require all granted
 
-{% endfor %}
+
+# Deny access to subdirectories other than "ubuntu" and
+# "ubuntu-partner".  (This also has the effect of including only those
+# subdirectories in the top-level directory index.)
+
+Require all denied
+
 
 
___
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/launchpad:charm-ftpmaster-rsync-secrets-permissions into launchpad:master

2023-10-19 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-ftpmaster-rsync-secrets-permissions into 
launchpad:master.

Commit message:
charm: Fix permissions of rsync secrets file

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

rsyncd.conf(5) says 'The file must normally not be readable by "other"'.  Fix 
permissions so that rsync will be prepared to read it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-ftpmaster-rsync-secrets-permissions into 
launchpad:master.
diff --git a/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py b/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
index 1ccd609..ccf2a10 100644
--- a/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
+++ b/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
@@ -66,7 +66,7 @@ def configure():
 "ftp.secrets.j2",
 rsync_secrets_path,
 config,
-perms=0o644,
+perms=0o640,
 )
 config["rsync_secrets_path"] = rsync_secrets_path
 elif os.path.exists("/etc/rsyncd/ftp.secrets"):
___
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/launchpad:bugbear-getattr-setattr into launchpad:master

2023-10-19 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:bugbear-getattr-setattr 
into launchpad:master.

Commit message:
Remove useless uses of getattr/setattr

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

`flake8-bugbear` points out:

  B009: Do not call getattr(x, 'attr'), instead use normal property access: 
x.attr. Missing a default to getattr will cause an AttributeError to be raised 
for non-existent properties. There is no additional safety in using getattr if 
you know the attribute name ahead of time.

  B010: Do not call setattr(x, 'attr', val), instead use normal property 
access: x.attr = val. There is no additional safety in using setattr if you 
know the attribute name ahead of time.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:bugbear-getattr-setattr into launchpad:master.
diff --git a/lib/lp/answers/tests/test_question_workflow.py b/lib/lp/answers/tests/test_question_workflow.py
index c0e61ce..2569042 100644
--- a/lib/lp/answers/tests/test_question_workflow.py
+++ b/lib/lp/answers/tests/test_question_workflow.py
@@ -426,7 +426,7 @@ class RequestInfoTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.assertRaises(Unauthorized, getattr, self.question, "requestInfo")
 
 login_person(self.answerer)
-getattr(self.question, "requestInfo")
+self.question.requestInfo
 
 
 class GiveInfoTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -473,7 +473,7 @@ class GiveInfoTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.assertRaises(Unauthorized, getattr, self.question, "giveInfo")
 
 login_person(self.owner)
-getattr(self.question, "giveInfo")
+self.question.giveInfo
 
 
 class GiveAnswerTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -588,7 +588,7 @@ class GiveAnswerTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.assertRaises(Unauthorized, getattr, self.question, "giveAnswer")
 
 login_person(self.answerer)
-getattr(self.question, "giveAnswer")
+self.question.giveAnswer
 
 
 class LinkFAQTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -680,7 +680,7 @@ class LinkFAQTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.assertRaises(Unauthorized, getattr, self.question, "linkFAQ")
 
 login_person(self.answerer)
-getattr(self.question, "linkFAQ")
+self.question.linkFAQ
 
 
 class ConfirmAnswerTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -856,7 +856,7 @@ class ConfirmAnswerTestCase(BaseAnswerTrackerWorkflowTestCase):
 )
 
 login_person(self.owner)
-getattr(self.question, "confirmAnswer")
+self.question.confirmAnswer
 
 
 class ReopenTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -971,7 +971,7 @@ class ReopenTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.assertRaises(Unauthorized, getattr, self.question, "reopen")
 
 login_person(self.owner)
-getattr(self.question, "reopen")
+self.question.reopen
 
 
 class ExpireQuestionTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -1014,7 +1014,7 @@ class ExpireQuestionTestCase(BaseAnswerTrackerWorkflowTestCase):
 )
 
 login_person(self.answerer)
-getattr(self.question, "expireQuestion")
+self.question.expireQuestion
 
 
 class RejectTestCase(BaseAnswerTrackerWorkflowTestCase):
@@ -1103,13 +1103,10 @@ class RejectTestCase(BaseAnswerTrackerWorkflowTestCase):
 # clear authorization cache for check_permission
 clear_cache()
 self.assertTrue(
-getattr(self.question, "reject"),
-"Answer contact cannot reject question.",
+self.question.reject, "Answer contact cannot reject question."
 )
 login_person(self.admin)
-self.assertTrue(
-getattr(self.question, "reject"), "Admin cannot reject question."
-)
+self.assertTrue(self.question.reject, "Admin cannot reject question.")
 
 def testRejectPermission_indirect_answer_contact(self):
 # Indirect answer contacts (for a distribution) can reject
@@ -1121,6 +1118,5 @@ class RejectTestCase(BaseAnswerTrackerWorkflowTestCase):
 self.answerer.addLanguage(getUtility(ILanguageSet)["en"])
 self.ubuntu.addAnswerContact(self.answerer, self.answerer)
 self.assertTrue(
-getattr(self.question, "reject"),
-"Answer contact cannot reject question.",
+self.question.reject, "Answer contact cannot reject question."
 )
diff --git a/lib/lp/blueprints/model/sprint.py b/lib/lp/blueprints/model/sprint.py
index 15f20ea..7b5fc16 100644
--- a/lib/lp/b

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-fix-tour into launchpad:master

2023-10-17 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-fix-tour into 
launchpad:master.

Commit message:
charm: Send +tour requests to appserver, not assets

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #2039479 in Launchpad itself: "Broken ‘Take the tour’  links across 
Launchpad"
  https://bugs.launchpad.net/launchpad/+bug/2039479

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

The assets charm doesn't serve anything under this path, and as far as I can 
see the pre-charm frontends never treated these requests as ones for assets; 
this was just a migration error.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-fix-tour into launchpad:master.
diff --git a/charm/launchpad-appserver/templates/vhosts/mainsite-https.conf.j2 b/charm/launchpad-appserver/templates/vhosts/mainsite-https.conf.j2
index 9b9598d..16708c2 100644
--- a/charm/launchpad-appserver/templates/vhosts/mainsite-https.conf.j2
+++ b/charm/launchpad-appserver/templates/vhosts/mainsite-https.conf.j2
@@ -49,7 +49,7 @@
 RewriteRule ^/(\+apidoc.*)$ balancer://cached-launchpad-assets/$1 [P,L]
 RewriteRule ^/(\+combo/.*)$ balancer://cached-launchpad-assets/$1 [P,L]
 RewriteRule ^/(\+icing/.*)$ balancer://cached-launchpad-assets/$1 [P,L]
-RewriteRule ^/(\+tour.*)$ balancer://cached-launchpad-assets/$1 [P,L]
+RewriteRule ^/(\+tour.*)$ balancer://cached-launchpad-appserver-main/$1 [P,L]
 RewriteRule ^/(@@/.*)$ balancer://cached-launchpad-assets/$1 [P,L]
 RewriteRule ^/(favicon\.(?:ico|gif|png))$ balancer://cached-launchpad-assets/$1 [P,L]
 
___
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/launchpad:lazr.restful-2.0.2 into launchpad:master

2023-10-17 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:lazr.restful-2.0.2 into 
launchpad:master.

Commit message:
Upgrade to lazr.restful 2.0.2

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #2039251 in Launchpad itself: "Launchpad API randomly returns empty 
responses"
  https://bugs.launchpad.net/launchpad/+bug/2039251

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

This removes superfluous HTTP headers from 304 responses that caused caching 
problems.

Dependencies MP: 
https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/453774
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:lazr.restful-2.0.2 into launchpad:master.
diff --git a/lib/lp/services/webservice/stories/conditional-write.rst b/lib/lp/services/webservice/stories/conditional-write.rst
index 6e25c81..0376317 100644
--- a/lib/lp/services/webservice/stories/conditional-write.rst
+++ b/lib/lp/services/webservice/stories/conditional-write.rst
@@ -123,7 +123,10 @@ modified by mod_compress as though it were the original ETag.
 >>> headers = {"If-None-Match": etag}
 >>> print(webservice.get(url, headers=headers))
 HTTP/1.1 304 Not Modified
-...
+Etag: "..."
+Vary: Accept
+
+
 
 Some versions of mod_compress turn '"foo"' into '"foo"-gzip', and some
 versions turn it into '"foo-gzip"'. We treat all three forms the same.
@@ -131,12 +134,18 @@ versions turn it into '"foo-gzip"'. We treat all three forms the same.
 >>> headers = {"If-None-Match": etag + "-gzip"}
 >>> print(webservice.get(url, headers=headers))
 HTTP/1.1 304 Not Modified
-...
+Etag: "..."
+Vary: Accept
+
+
 
 >>> headers = {"If-None-Match": etag[:-1] + "-gzip" + etag[-1]}
 >>> print(webservice.get(url, headers=headers))
 HTTP/1.1 304 Not Modified
-...
+Etag: "..."
+Vary: Accept
+
+
 
 Any other modification to the ETag is treated as a distinct ETag.
 
diff --git a/requirements/launchpad.txt b/requirements/launchpad.txt
index 78fb87c..4f2ba94 100644
--- a/requirements/launchpad.txt
+++ b/requirements/launchpad.txt
@@ -81,7 +81,7 @@ lazr.delegates==2.0.4
 lazr.enum==1.2.1
 lazr.jobrunner==0.17
 lazr.lifecycle==1.2.1
-lazr.restful==2.0.1
+lazr.restful==2.0.2
 lazr.restfulclient==0.14.5
 lazr.sshserver==0.1.13
 lazr.uri==1.0.6
___
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-source-dependencies:lazr.restful-2.0.2 into lp-source-dependencies:master

2023-10-17 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/lp-source-dependencies:lazr.restful-2.0.2 into 
lp-source-dependencies:master.

Commit message:
Add lazr.restful 2.0.2

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/453774
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-source-dependencies:lazr.restful-2.0.2 into 
lp-source-dependencies:master.
diff --git a/dist/lazr.restful-2.0.2.tar.gz b/dist/lazr.restful-2.0.2.tar.gz
new file mode 100644
index 000..60b3ce0
Binary files /dev/null and b/dist/lazr.restful-2.0.2.tar.gz differ
___
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/launchpad:charm-scripts-export-queue-verbose into launchpad:master

2023-10-12 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-scripts-export-queue-verbose into launchpad:master.

Commit message:
charm: Run rosetta-export-queue with more verbosity

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Its logs are nearly useless right now.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-scripts-export-queue-verbose into launchpad:master.
diff --git a/charm/launchpad-scripts/templates/crontab.j2 b/charm/launchpad-scripts/templates/crontab.j2
index 08a07d6..84c12e3 100644
--- a/charm/launchpad-scripts/templates/crontab.j2
+++ b/charm/launchpad-scripts/templates/crontab.j2
@@ -44,7 +44,7 @@ LPCONFIG=launchpad-scripts
 
 # Rosetta
 */10 * * * * nice -16 {{ code_dir }}/cronscripts/rosetta-approve-imports.py -q --log-file=INFO:{{ logs_dir }}/rosetta-approve-imports.log
-*/4 * * * * {{ code_dir }}/cronscripts/rosetta-export-queue.py -q --log-file=INFO:{{ logs_dir }}/rosetta-export-queue.log
+*/4 * * * * {{ code_dir }}/cronscripts/rosetta-export-queue.py -v --log-file=INFO:{{ logs_dir }}/rosetta-export-queue.log
 */3 * * * * nice -16 {{ code_dir }}/cronscripts/rosetta-poimport.py -q --log-file=INFO:{{ logs_dir }}/rosetta-poimport.log
 
 {% if language_pack_exporter_schedule -%}
___
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/launchpad:charm-loggerhead into launchpad:master

2023-10-12 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:charm-loggerhead into 
launchpad:master.

Commit message:
charm: Add launchpad-loggerhead

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/453470
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-loggerhead into launchpad:master.
diff --git a/charm/launchpad-loggerhead/README.md b/charm/launchpad-loggerhead/README.md
new file mode 100644
index 000..92efbe0
--- /dev/null
+++ b/charm/launchpad-loggerhead/README.md
@@ -0,0 +1,7 @@
+# Launchpad Bazaar/Breezy code browsing server
+
+This charm runs a code browsing server for Bazaar/Breezy branches.
+
+You will need the following relations:
+
+juju relate launchpad-loggerhead rabbitmq-server
diff --git a/charm/launchpad-loggerhead/charmcraft.yaml b/charm/launchpad-loggerhead/charmcraft.yaml
new file mode 100644
index 000..71dcf7f
--- /dev/null
+++ b/charm/launchpad-loggerhead/charmcraft.yaml
@@ -0,0 +1,75 @@
+type: charm
+bases:
+  - build-on:
+- name: ubuntu
+  channel: "20.04"
+  architectures: [amd64]
+run-on:
+- name: ubuntu
+  channel: "20.04"
+  architectures: [amd64]
+parts:
+  charm-wheels:
+source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
+source-commit: "42c89d9c66dbe137139b047fd54aed49b66d1a5e"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": charm-wheels/
+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: "58edb3e5a88794c3baa2274a94e21d3a298a6c79"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  launchpad-base: layers/layer/launchpad-base
+  launchpad-payload: layers/layer/launchpad-payload
+stage:
+  - layers
+prime:
+  - "-layers"
+  layer-coordinator:
+source: https://git.launchpad.net/layer-coordinator
+source-commit: "fa27fc93e0b08000963e83a6bfe49812d890dfcf"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": layers/layer/coordinator/
+stage:
+  - layers
+prime:
+  - "-layers"
+  charm:
+after:
+  - charm-wheels
+  - launchpad-layers
+  - layer-coordinator
+source: .
+plugin: reactive
+build-snaps: [charm]
+build-packages: [libpq-dev, 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/launchpad-loggerhead/config.yaml b/charm/launchpad-loggerhead/config.yaml
new file mode 100644
index 000..3145bff
--- /dev/null
+++ b/charm/launchpad-loggerhead/config.yaml
@@ -0,0 +1,43 @@
+options:
+  haproxy_server_options:
+type: string
+description: Options to add to HAProxy "server" lines.
+default: check inter 1 rise 2 fall 2 maxconn 15
+  haproxy_service_options:
+type: string
+description: HAProxy options for codebrowse services.
+default: |
+  - mode http
+  - option httplog
+  - option httpchk GET /robots.txt HTTP/1.0
+  - option forwardfor
+  - balance leastconn
+  internal_branch_by_id_root:
+type: string
+description: |
+  The URL prefix for where branches are served by URLs based on the
+  branch ID.
+default:
+  nagios_check_branch:
+type: string
+description: If set, add Nagios checks for this branch.
+default: ""
+  port_loggerhead:
+type: int
+description: >
+  Port to expose to the public (indirectly; we expect Apache on the
+  Bazaar codehosting system to ProxyPass to this port).  This serves
+  both public and private branches, but requests for private branches
+  must be authenticated.
+default: 10007
+  port_loggerhead_api:
+type: int
+description: >
+  Private port for read-only API requests.  This must not be exposed to
+  the public; other parts of Launchpad with access to this port must
+  ensure that the appropriate security checks are performed.
+default: 10017
+  session_secret:
+type: string
+description: A base64-encoded secret key used to sign session cookies.

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:verifyObject-person-as-registry into launchpad:master

2023-10-12 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:verifyObject-person-as-registry into launchpad:master.

Commit message:
Run verifyObject on IPerson as a registry expert

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Evaluating `Person.exported_id` requires high privileges.  Perhaps we should 
have made it a method so that `verifyObject` wouldn't complain, but that would 
be slower from the client side and rather artificial.  There seems to be some 
precedent for running `verifyObject` as privileged users to cope with 
permission issues.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:verifyObject-person-as-registry into launchpad:master.
diff --git a/lib/lp/registry/doc/person.rst b/lib/lp/registry/doc/person.rst
index eb3075a..867a46b 100644
--- a/lib/lp/registry/doc/person.rst
+++ b/lib/lp/registry/doc/person.rst
@@ -11,7 +11,7 @@ not Launchpad users.
 >>> from lp.services.identity.interfaces.emailaddress import (
 ... IEmailAddressSet,
 ... )
->>> from lp.testing import verifyObject
+>>> from lp.testing import celebrity_logged_in, verifyObject
 >>> from lp.registry.interfaces.person import (
 ... IHasStanding,
 ... IPerson,
@@ -22,21 +22,27 @@ not Launchpad users.
 ... IHasTranslationImports,
 ... )
 
-Any Person object (either a person or a team) implements IPerson...
+Any Person object (either a person or a team) implements IPerson.  We have
+to check this as a registry expert, because evaluating
+``Person.exported_id`` requires high privileges.
 
 >>> personset = getUtility(IPersonSet)
 >>> foobar = personset.getByName("name16")
 >>> foobar.is_team
 False
 
->>> verifyObject(IPerson, foobar)
+>>> with celebrity_logged_in("registry_experts"):
+... verifyObject(IPerson, foobar)
+...
 True
 
 >>> ubuntu_team = personset.getByName("ubuntu-team")
 >>> ubuntu_team.is_team
 True
 
->>> verifyObject(IPerson, ubuntu_team)
+>>> with celebrity_logged_in("registry_experts"):
+... verifyObject(IPerson, ubuntu_team)
+...
 True
 
 
@@ -416,7 +422,9 @@ property of IPerson or check if the object provides the ITeam interface.
 >>> ITeam.providedBy(landscape_devs)
 True
 
->>> verifyObject(ITeam, landscape_devs)
+>>> with celebrity_logged_in("registry_experts"):
+... verifyObject(ITeam, landscape_devs)
+...
 True
 
 Also note that a team will never have a Launchpad account, so its
@@ -503,7 +511,9 @@ entries into teams.
 >>> ITeam.providedBy(not_a_person)
 True
 
->>> verifyObject(ITeam, not_a_person)
+>>> with celebrity_logged_in("registry_experts"):
+... verifyObject(ITeam, not_a_person)
+...
 True
 
 The team owner is also added as an administrator of its team.
diff --git a/lib/lp/soyuz/doc/package-diff.rst b/lib/lp/soyuz/doc/package-diff.rst
index ac90cfe..c081d91 100644
--- a/lib/lp/soyuz/doc/package-diff.rst
+++ b/lib/lp/soyuz/doc/package-diff.rst
@@ -36,7 +36,7 @@ Requesting a diff from pmount_0.1-1 to pmount_0.1-2.
 
 Let's inspect the PackageDiff record created.
 
->>> from lp.testing import verifyObject
+>>> from lp.testing import celebrity_logged_in, verifyObject
 >>> from lp.soyuz.interfaces.packagediff import IPackageDiff
 
 >>> verifyObject(IPackageDiff, package_diff)
@@ -45,10 +45,13 @@ Let's inspect the PackageDiff record created.
 Its main attributes are:
 
  * 'requester', which maps to a `IPerson`, the user who made the diff
-   request.
+   request.  (We have to check this as a registry expert, because evaluating
+   ``Person.exported_id`` requires high privileges.)
 
 >>> from lp.registry.interfaces.person import IPerson
->>> verifyObject(IPerson, package_diff.requester)
+>>> with celebrity_logged_in("registry_experts"):
+... verifyObject(IPerson, package_diff.requester)
+...
 True
 
 >>> print(package_diff.requester.displayname)
___
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/turnip:lpci-pre-commit into turnip:master

2023-10-12 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/turnip:lpci-pre-commit into 
turnip:master.

Commit message:
Add pre-commit checks via lpci

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Rather than having two different linters that might potentially disagree, I 
removed the older one that was done via `flake8` in turnip's own virtual 
environment rather than via `pre-commit`.  I updated `requirements.txt` with 
the aid of `pip freeze` - this found a few missing entries as well as the ones 
I was able to remove.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/turnip:lpci-pre-commit into turnip:master.
diff --git a/.launchpad.yaml b/.launchpad.yaml
new file mode 100644
index 000..d099949
--- /dev/null
+++ b/.launchpad.yaml
@@ -0,0 +1,21 @@
+pipeline:
+  - docs
+  - lint
+
+jobs:
+  docs:
+architectures: amd64
+packages:
+  - tox
+run: tox -e docs
+series: focal
+  lint:
+architectures: amd64
+packages:
+  - tox
+  - git
+snaps:
+  - name: go
+classic: true
+run: tox -e lint
+series: focal
diff --git a/Makefile b/Makefile
index 06ee204..1f350bd 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,6 @@ PIP_CACHE = $(CURDIR)/pip-cache
 
 PYTHON := $(ENV)/bin/python
 PSERVE := $(ENV)/bin/pserve
-FLAKE8 := $(ENV)/bin/flake8
 CELERY := $(ENV)/bin/celery
 PIP := $(ENV)/bin/pip
 VIRTUALENV := /usr/bin/virtualenv
@@ -103,14 +102,10 @@ TAGS:
 tags:
 	ctags -R turnip
 
-lint: $(ENV)
-	@$(FLAKE8) --exclude=__pycache__,version_info.py *.tac turnip
-	$(PYTHON) setup.py check --restructuredtext --strict
-
 pip-check: $(ENV)
 	$(PIP) check
 
-check: pip-check test lint
+check: pip-check test
 
 run-api: $(ENV)
 	$(PSERVE) api.ini --reload
@@ -175,5 +170,5 @@ publish-tarball: build-tarball
 		$(SWIFT_CONTAINER_NAME) $(SWIFT_OBJECT_PATH) \
 		$(TARBALL_BUILD_PATH) turnip=$(TARBALL_BUILD_LABEL)
 
-.PHONY: build check clean dist lint run-api run-pack test
+.PHONY: build check clean dist run-api run-pack test
 .PHONY: build-tarball publish-tarball
diff --git a/requirements.txt b/requirements.txt
index c9bc202..7043dd9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,5 @@
 amqp==2.6.0
 appdirs==1.4.3
-asn1crypto==1.3.0
 attrs==19.3.0
 Automat==20.2.0
 bcrypt==3.1.7
@@ -8,7 +7,6 @@ beautifulsoup4==4.6.3
 billiard==3.6.3.0
 celery==4.4.6
 cffi==1.14.1
-configparser==4.0.2
 constantly==15.1.0
 contextlib2==0.6.0.post1
 cornice==3.6.1
@@ -17,45 +15,34 @@ docutils==0.14
 envdir==0.7
 extras==1.0.0
 fixtures==3.0.0
-flake8==3.9.2
 future==0.18.2
 gevent==20.6.2
-gmpy==1.17
 greenlet==0.4.16
 gunicorn==20.1.0
+hupper==1.10.2
 hyperlink==19.0.0
 idna==2.9
-importlib_metadata==1.7.0
 incremental==17.5.0
-ipaddress==1.0.23
 kombu==4.6.11
 lazr.sshserver==0.1.13
 linecache2==1.0.0
 lxml==4.5.2
-m2r==0.1.14
-# lp:~launchpad/mccabe:launchpad
-# lp1 Remove use of deprecated 'setup.py test'.
-mccabe==0.6.1+lp1
-mistune==0.8.3
-pathlib2==2.3.5
 Paste==3.5.0
 PasteDeploy==2.1.0
 pbr==5.4.5
+plaster==1.0
+plaster-pastedeploy==0.7
 psutil==5.7.0
 pyasn1==0.4.8
-pycodestyle==2.7.0
 pycparser==2.17
-pycrypto==2.6.1
-pyflakes==2.3.1
 pygit2==1.0.3
+PyHamcrest==1.10.1
 PyNaCl==1.3.0
 pyramid==1.10.4
 python-mimeparse==1.6.0
 python-openid2==3.2
 pytz==2020.1
 PyYAML==5.3
-repoze.lru==0.6
-scandir==1.10.0
 setuptools-scm==1.17.0
 simplejson==3.6.5
 six==1.15.0
@@ -68,12 +55,11 @@ translationstring==1.3
 # https://code.launchpad.net/~launchpad/twisted/+git/twisted/+ref/lp-backport.
 Twisted[conch_nacl]==20.3.0+lp9
 unittest2==1.1.0
-vine==1.3.0
 venusian==2.1.0
+vine==1.3.0
 waitress==0.8.9
 WebOb==1.8.6
 WebTest==2.0.35
-zipp==1.2.0
 zope.component==4.2.1
 zope.deprecation==4.4.0
 zope.event==4.4
diff --git a/setup.py b/setup.py
index a3e086f..6e4e70f 100755
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,6 @@ requires = [
 test_requires = [
 "docutils",
 "fixtures",
-"flake8",
 "testscenarios",
 "testtools",
 "webtest",
diff --git a/tox.ini b/tox.ini
index 210d480..cb85b17 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,18 @@
 [tox]
-env_list = docs
+env_list =
+lint
+docs
+
+[testenv:lint]
+skip_install = true
+deps = pre-commit
+commands = pre-commit run --all-files --show-diff-on-failure
+# adding http(s)_proxy is a workaround for
+# https://github.com/tox-dev/tox/pull/2378/files
+passenv =
+HOME
+http_proxy
+https_proxy
 
 [testenv:docs]
 description = Build documentation via Sphinx.
___
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/launchpad:makefile-quiet-if-no-git into launchpad:master

2023-10-10 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:makefile-quiet-if-no-git 
into launchpad:master.

Commit message:
Quieten Makefile when there's no .git directory

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is the case when deploying one of Launchpad's charms.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:makefile-quiet-if-no-git into launchpad:master.
diff --git a/Makefile b/Makefile
index 7e5c4c2..7bb06c0 100644
--- a/Makefile
+++ b/Makefile
@@ -91,8 +91,8 @@ PIP_BIN = \
 # XXX cjwatson 2023-04-11: Should be "git branch --show-current", but
 # xenial's git doesn't support that.  Use the more concise form once we
 # require focal.
-GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
-TARBALL_REVISION ?= $(shell git rev-parse HEAD)
+GIT_BRANCH := $(shell if [ -d .git ]; then git rev-parse --abbrev-ref HEAD; fi)
+TARBALL_REVISION ?= $(shell if [ -d .git ]; then git rev-parse HEAD; fi)
 ifeq ($(GIT_BRANCH),db-devel)
 TARBALL_SUFFIX := db
 else
___
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] ~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-production-riscv64 into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-10-10 Thread Colin Watson



Diff comments:

> diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
> index c3b40ce..c601076 100644
> --- a/vbuilder/bundle.yaml
> +++ b/vbuilder/bundle.yaml
> @@ -38,7 +41,7 @@
>  {%-   set openstack_username_lcy02 = "launchpad-vbuilder-production" %}
>  {%-   set vbuilders_bos01 = {"amd64": {"series": "focal", "flavor": 
> "vbuilder-gpu", "count": 5}, "arm64": {"series": "focal", "count": 40, 
> "config_drive": false}, "arm64-gpu": {"arch_base": "arm64", "arch_suffix": 
> "-gpu", "series": "focal", "flavor": "vbuilder-nvidia-l4", "count": 2, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 20}, "s390x": 
> {"series": "focal", "count": 20}} %}
>  {%-   set vbuilders_bos02 = {"arm64": {"series": "focal", "count": 80, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 30}, "s390x": 
> {"series": "focal", "count": 20}} %}
> -{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 60}} %}
> +{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 60}, 
> "riscv64": {"series": "jammy", "count": 60, "config_drive": false}} %}

We only got the necessary OpenStack support for it in PS6 very recently - there 
was no way to make it work before that.

>  {%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 120}} %}
>  {%-   set vbuilder_prefix = "" %}
>  {%- elif stage_name == "staging" %}


-- 
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/453216
Your team Launchpad code reviewers is subscribed to branch 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.


___
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/launchpad-mojo-specs/+git/private:vbuilder-production-riscv64 into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-10-10 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-production-riscv64 into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.

Commit message:
vbuilder: Add bos03-riscv64 on production

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/453216
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-production-riscv64 into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.
diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
index c3b40ce..c601076 100644
--- a/vbuilder/bundle.yaml
+++ b/vbuilder/bundle.yaml
@@ -23,12 +23,15 @@
 {%-   set instance_router = "vbuilder_router" %}
 {%-   set instance_router_bos03 = "router_launchpad-vbuilder-production" %}
 {%-   set instance_router_lcy02 = "router_launchpad-vbuilder-production" %}
+{#-   Output of "openstack image show -c id -f value qemu-riscv64-uboot". #}
+{%-   set kernel_id_bos03_riscv64 = "c5015509-91c3-4684-80cc-b8a2ef44c8b5" %}
 {%-   set launchpad_buildd_repository = "ppa:launchpad/buildd" %}
 {%-   set lp_buildd_managers = "10.131.66.156 10.131.215.202" %}
 {%-   set lp_environment = "production" %}
 {%-   set lp_sshkey = "ssh-rsa B3NzaC1yc2EDAQABAAACAQD3tBvyEaZFX8H4krfXGhczq9q/GCfcE0kpsjK8WzM/lQOhWQAVSmm8O9gposKvu4mT28hBWI746+NOPLBrf9ax7YRoU+ZuZesyIIK6ztN07G4aK2vt+1W9yNZKgTJZ8FvxHwlbFy6wMjMP3OzuxWyh0yi03z1YiGPJt0riJRZT+QecaoyYhkTuRbcCoWbhmM0veUjCvfR7LA43YbOfmts7STNCtl1IUJErmUY6fSR1LkyF9uJSdwozAVht242vI8Yg+PrOnKCx3X5w546okP2uMDVXKWeY2g/MhUSr+ZyIaS2JxUygZ7FKS4gNLYb3O4Q6tcIwPE++zsr9HueTfjw2LyeQTZQDQjuv0kJ40B3IFF4E9FMzu8MDwArOKUGzISLrX5VtDZBKINDclfDbrFWHUlVBC2CIIjGPKj3afluP9jadWjsOQx0ooBO0tb0Se+7t3oNjKlknwD85AYCPzIlZt7wo/+e/V/Tilw+UUf00JioEceTdxuOHmbuxP5RzCleg8pYLfe5jiHfBJi0DhO61IYlFMgSToh78EShHWYEdSbD+Ve5GWKvPEU9CsSTleSSqBFdhyggfB5fHiup0efAqMnstDn5sxGYFzfFu7SNVHkMuFeiRHZK+9fF/nfzk0UK5EaGs+4IMhWS1ns8m5O5Li609c/nXK5t5fBOkiWa+RQ== lp_buildd@juju-4112d9-prod-launchpad-manual-servers-4" %}
 {%-   set modifiers_bos01 = '{"arm64": "10.43.0.29", "ppc64el": "10.43.0.36", "s390x": "10.43.0.39"}' %}
 {%-   set modifiers_bos02 = '{"arm64": "10.44.0.22", "ppc64el": "10.44.0.20", "s390x": "10.44.0.18"}' %}
+{%-   set modifiers_bos03 = '{"riscv64": "10.143.254.223"}' %}
 {%-   set name_prefix = "launchpad-buildd" %}
 {%-   set openstack_tenant_name = "vbuilder_project" %}
 {%-   set openstack_tenant_name_bos03 = "launchpad-vbuilder-production_project" %}
@@ -38,7 +41,7 @@
 {%-   set openstack_username_lcy02 = "launchpad-vbuilder-production" %}
 {%-   set vbuilders_bos01 = {"amd64": {"series": "focal", "flavor": "vbuilder-gpu", "count": 5}, "arm64": {"series": "focal", "count": 40, "config_drive": false}, "arm64-gpu": {"arch_base": "arm64", "arch_suffix": "-gpu", "series": "focal", "flavor": "vbuilder-nvidia-l4", "count": 2, "config_drive": false}, "ppc64el": {"series": "focal", "count": 20}, "s390x": {"series": "focal", "count": 20}} %}
 {%-   set vbuilders_bos02 = {"arm64": {"series": "focal", "count": 80, "config_drive": false}, "ppc64el": {"series": "focal", "count": 30}, "s390x": {"series": "focal", "count": 20}} %}
-{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 60}} %}
+{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 60}, "riscv64": {"series": "jammy", "count": 60, "config_drive": false}} %}
 {%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 120}} %}
 {%-   set vbuilder_prefix = "" %}
 {%- elif stage_name == "staging" %}
@@ -301,7 +304,7 @@ applications:
   region: scalingstack-bos03
   use_swift: false
   visibility: private
-{%- if stage_name == "qastaging" %}
+{%- if stage_name in ("production", "qastaging") %}
   glance-simplestreams-sync-bos03-riscv64:
 charm: {{ charm_dir }}/glance-simplestreams-sync
 constraints: "{{ extra_constraints }}"
@@ -423,7 +426,7 @@ applications:
   clamav-database-url: "{

[Launchpad-reviewers] [Merge] ~cjwatson/lp-signing:doc-simplify-deployment into lp-signing:master

2023-10-09 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-signing:doc-simplify-deployment 
into lp-signing:master.

Commit message:
doc: Simplify deployment commands

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

`upgrade-staging` and `upgrade-production` are wrapper scripts in 
`launchpad-bastion-ps5.internal:~stg-launchpad-signing/bin/` that do the same 
thing as the previous commands listed here, but that additionally save the 
output to a log file.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-signing:doc-simplify-deployment into lp-signing:master.
diff --git a/docs/how-to/deployment.rst b/docs/how-to/deployment.rst
index 66e3aa3..0221bf7 100644
--- a/docs/how-to/deployment.rst
+++ b/docs/how-to/deployment.rst
@@ -58,7 +58,7 @@ changes to the charm, which are not automatically deployed.
  directly without needing a merge proposal.
 
 #. As ``stg-launchpad-signing@launchpad-bastion-ps5.internal``, run
-   ``run-one mojo run``.
+   ``upgrade-staging``.
 
 #. Check the behaviour of http://staging.signing.lp.internal:8000/ as
appropriate, perhaps via the dogfood publisher.
@@ -80,13 +80,8 @@ Deploying to production
 #. Announce the rollout in `~is-outage
<https://chat.canonical.com/canonical/channels/is-outage>`_.
 
-#. As ``stg-launchpad-signing@launchpad-bastion-ps5.internal``, run ``ssh
-   prod-launchpad-signing@is-bastion-il3-not-ps5.internal autodeploy-trigger
-   prod-launchpad-signing
-   EXTRA_SKIP_CHECKS='check_disk|check_hardware_firmware|check_ntpmon'``.
-   (The ``EXTRA_SKIP_CHECKS`` part is temporary until those issues are
-   fixed; `cRT#154821 <https://portal.admin.canonical.com/C154821>`_ covers
-   the ``check_disk`` part.)  This should take on the order of five minutes.
+#. As ``stg-launchpad-signing@launchpad-bastion-ps5.internal``, run
+   ``upgrade-production``.  This should take on the order of five minutes.
 
 #. Check production publisher logs as appropriate for any issues with the
production signing service.
___
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/launchpad:charm-cron-control-redirects into launchpad:master

2023-10-09 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-cron-control-redirects into launchpad:master.

Commit message:
charm: Redirect old cron-control URLs

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The current URLs used for cron-control on production, qastaging, and staging 
are "http://cron-control.lp.internal/production.ini;, 
"http://cron-control.qastaging.lp.internal/qastaging.ini;, and 
"http://cron-control.staging.lp.internal/staging.ini; respectively.  The 
`launchpad-cron-control` charm just exposes `/cron.ini`, which is simpler.

However, to migrate to this, we're going to need to change DNS for 
`cron-control.lp.internal` etc., and it's going to be awkward to coordinate 
that change with also changing all the URLs to `/cron.ini`.  Redirecting the 
old URLs for a transitional period will simplify this.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-cron-control-redirects into launchpad:master.
diff --git a/charm/launchpad-cron-control/templates/vhosts/cron-http.conf.j2 b/charm/launchpad-cron-control/templates/vhosts/cron-http.conf.j2
index 1525ef2..a1e94e5 100644
--- a/charm/launchpad-cron-control/templates/vhosts/cron-http.conf.j2
+++ b/charm/launchpad-cron-control/templates/vhosts/cron-http.conf.j2
@@ -9,5 +9,11 @@
 
 Require all granted
 
+
+# XXX cjwatson 2023-10-09: Temporarily redirect old URLs until we've
+# finished migration.
+Redirect /production.ini /cron.ini
+Redirect /qastaging.ini /cron.ini
+Redirect /staging.ini /cron.ini
 
 
___
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/launchpad-mojo-specs/+git/private:vbuilder-qastaging-riscv64 into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-10-09 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging-riscv64 into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.

Commit message:
vbuilder: Add bos03-riscv64 on qastaging

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/453131

This is up and running on qastaging, and is good enough to get a builder VM up.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging-riscv64 into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.
diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
index d588d9d..c3b40ce 100644
--- a/vbuilder/bundle.yaml
+++ b/vbuilder/bundle.yaml
@@ -110,12 +110,15 @@
 {%-   set instance_router = "vbuilder_staging_router" %}
 {%-   set instance_router_bos03 = "router_launchpad-vbuilder-staging" %}
 {%-   set instance_router_lcy02 = "router_launchpad-vbuilder-staging" %}
+{#-   Output of "openstack image show -c id -f value qemu-riscv64-uboot". #}
+{%-   set kernel_id_bos03_riscv64 = "bcbb013b-9424-4f61-9fda-6374d29d3ee0" %}
 {%-   set launchpad_buildd_repository = "ppa:launchpad/buildd-staging" %}
 {%-   set lp_buildd_managers = "10.132.54.242" %}
 {%-   set lp_environment = "qastaging" %}
 {%-   set lp_sshkey = "ssh-ed25519 C3NzaC1lZDI1NTE5IFrjt0yytzrK9fQuG+6VgE6QStUbDmunlN7+Lv5XhmoL stg-launchpad@launchpad-bastion-ps5" %}
 {%-   set modifiers_bos01 = '{"arm64": "10.43.0.10", "ppc64el": "10.43.0.23", "s390x": "10.43.0.15"}' %}
 {%-   set modifiers_bos02 = '{"arm64": "10.44.0.13", "ppc64el": "10.44.0.19", "s390x": "10.44.0.14"}' %}
+{%-   set modifiers_bos03 = '{"riscv64": "10.144.0.114"}' %}
 {%-   set name_prefix = "launchpad-buildd-qastaging" %}
 {%-   set openstack_tenant_name = "vbuilder_staging_project" %}
 {%-   set openstack_tenant_name_bos03 = "launchpad-vbuilder-staging_project" %}
@@ -125,7 +128,7 @@
 {%-   set openstack_username_lcy02 = "launchpad-vbuilder-staging" %}
 {%-   set vbuilders_bos01 = {"amd64": {"series": "focal", "flavor": "vbuilder-gpu", "count": 1}, "arm64": {"series": "focal", "count": 1, "config_drive": false}, "arm64-gpu": {"arch_base": "arm64", "arch_suffix": "-gpu", "series": "focal", "flavor": "vbuilder-nvidia-l4", "count": 1, "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": {"series": "focal", "count": 1}} %}
 {%-   set vbuilders_bos02 = {"arm64": {"series": "focal", "count": 1, "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": {"series": "focal", "count": 1}} %}
-{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 4}} %}
+{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 4}, "riscv64": {"series": "jammy", "count": 1, "config_drive": false}} %}
 {%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 4}} %}
 {%-   set vbuilder_prefix = "qastaging-" %}
 {%- endif %}
@@ -298,6 +301,25 @@ applications:
   region: scalingstack-bos03
   use_swift: false
   visibility: private
+{%- if stage_name == "qastaging" %}
+  glance-simplestreams-sync-bos03-riscv64:
+charm: {{ charm_dir }}/glance-simplestreams-sync
+constraints: "{{ extra_constraints }}"
+num_units: 1
+options:
+  content_id_template: "{{ content_id_template }}"
+  custom_properties: "hw_emulation_architecture=riscv64 hw_machine_type=virt kernel_id={{ kernel_id_bos03_riscv64 }}"
+  mirror_list: |-
+[{url: "http://cloud-images.ubuntu.com/daily/;, name_prefix: "ubuntu:released", path: "streams/v1/index.sjson", max: 3, item_filters: ["release~({{ gss_series }})", "arch~(riscv64)", "ftype~(disk1.img|disk.img)"]}]
+  name_prefix: "{{ name_prefix }}/"
+  openstack-auth-url: "https://keystone.ps6.canonical.com:5000/v3;
+  openstack-identity-api-version: "3"
+  openstack-tenant-name: &quo

Re: [Launchpad-reviewers] [Merge] ~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-10-05 Thread Colin Watson
The private repo is because I never managed to quite persuade management to 
sign off on open-sourcing it.  I've sent the thread from a couple of years ago 
on to Clinton in the hope of reviving it, since it would certainly make life 
easier in a few ways.

Diff comments:

> diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
> index 6a6c5e3..d588d9d 100644
> --- a/vbuilder/bundle.yaml
> +++ b/vbuilder/bundle.yaml
> @@ -84,6 +85,49 @@
>  {%-   set vbuilders_bos03 = {"amd64": {"series": "jammy", "count": 4}} %}
>  {%-   set vbuilders_lcy02 = {"amd64": {"series": "jammy", "count": 4}} %}
>  {%-   set vbuilder_prefix = "dogfood-" %}
> +{%- elif stage_name == "qastaging" %}
> +{%-   set clamav_database_url = 
> "http://clamav-database-mirror.staging.lp.internal/; %}
> +{%-   set content_id_template = "launchpad-buildd:qastaging" %}
> +{%-   set dns_update_host_bos01 = "10.189.0.2" %}
> +{%-   set dns_update_host_bos02 = "10.189.128.2" %}
> +{%-   set dns_update_host_bos03 = "10.189.128.2" %}
> +{%-   set dns_update_host_lcy02 = "10.132.31.11 10.132.31.12 10.132.31.13" %}
> +{%-   set dns_update_key_name = "vbuilder-staging-manage" %}
> +{%-   set domain_bos01 = "vbuilder.qastaging.bos01.scalingstack" %}
> +{%-   set domain_bos02 = "vbuilder.qastaging.bos02.scalingstack" %}
> +{%-   set domain_bos03 = "vbuilder.qastaging.bos03.scalingstack" %}
> +{%-   set domain_lcy02 = "vbuilder.qastaging.lcy02.scalingstack" %}
> +{%-   set extra_constraints = "" %}
> +{%-   set gss_series = "focal|jammy" %}
> +{%-   set instance_key_name_bos01 = "ppa-manage-test-qastaging" %}
> +{%-   set instance_key_name_bos02 = "ppa-manage-test-qastaging" %}
> +{%-   set instance_key_name_bos03 = "ppa-manage-test-qastaging" %}
> +{%-   set instance_key_name_lcy02 = "ppa-manage-test-qastaging" %}
> +{%-   set instance_network_bos01 = "10.189.36.0/24" %}
> +{%-   set instance_network_bos02 = "10.189.164.0/23" %}
> +{%-   set instance_network_bos03 = "10.144.4.0/23" %}
> +{%-   set instance_network_lcy02 = "10.134.4.0/23" %}
> +{%-   set instance_router = "vbuilder_staging_router" %}
> +{%-   set instance_router_bos03 = "router_launchpad-vbuilder-staging" %}
> +{%-   set instance_router_lcy02 = "router_launchpad-vbuilder-staging" %}
> +{%-   set launchpad_buildd_repository = "ppa:launchpad/buildd-staging" %}
> +{%-   set lp_buildd_managers = "10.132.54.242" %}
> +{%-   set lp_environment = "qastaging" %}
> +{%-   set lp_sshkey = "ssh-ed25519 
> C3NzaC1lZDI1NTE5IFrjt0yytzrK9fQuG+6VgE6QStUbDmunlN7+Lv5XhmoL 
> stg-launchpad@launchpad-bastion-ps5" %}

This is the public half of the key, so it's OK.  I wouldn't put private keys in 
even a private repo (well, maybe if they were in a repository that's clearly 
labelled with very tight permissions and that _only_ contains secrets and 
nothing else - even then I'd think twice).

> +{%-   set modifiers_bos01 = '{"arm64": "10.43.0.10", "ppc64el": 
> "10.43.0.23", "s390x": "10.43.0.15"}' %}
> +{%-   set modifiers_bos02 = '{"arm64": "10.44.0.13", "ppc64el": 
> "10.44.0.19", "s390x": "10.44.0.14"}' %}
> +{%-   set name_prefix = "launchpad-buildd-qastaging" %}
> +{%-   set openstack_tenant_name = "vbuilder_staging_project" %}
> +{%-   set openstack_tenant_name_bos03 = "launchpad-vbuilder-staging_project" 
> %}
> +{%-   set openstack_tenant_name_lcy02 = "launchpad-vbuilder-staging_project" 
> %}
> +{%-   set openstack_username = "vbuilder_staging" %}
> +{%-   set openstack_username_bos03 = "launchpad-vbuilder-staging" %}
> +{%-   set openstack_username_lcy02 = "launchpad-vbuilder-staging" %}
> +{%-   set vbuilders_bos01 = {"amd64": {"series": "focal", "flavor": 
> "vbuilder-gpu", "count": 1}, "arm64": {"series": "focal", "count": 1, 
> "config_drive": false}, "arm64-gpu": {"arch_base": "arm64", "arch_suffix": 
> "-gpu", "series": "focal", "flavor": "vbuilder-nvidia-l4", "count": 1, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": 
> {"series": "focal", "count": 1}} %}
> +{%-   set vbuilders_bos02 = {"arm64": {"series": "focal", "count": 1, 
> "config_drive": false}, "ppc64el": {"series": "focal", "count": 1}, "s390x": 
> {"series": "focal", "count": 1}} %}
> +{%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 4}} %}
> +{%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 4}} %}
> +{%-   set vbuilder_prefix = "qastaging-" %}
>  {%- endif %}
>  
>  {%- macro vbuilder_hostnames(prefix, count) %}
> diff --git a/vbuilder/upgrade-charms b/vbuilder/upgrade-charms
> index 471b7c4..6f7f70d 100755
> --- a/vbuilder/upgrade-charms
> +++ b/vbuilder/upgrade-charms
> @@ -5,58 +5,85 @@ import utils.check_version  # noqa: F401
>  import os.path
>  import subprocess
>  
> -from utils import utils
> -
> -
> -juju_services = utils.juju_services()
> -apps = [
> -('glance-simplestreams-sync-bos01-amd64',
> - 'glance-simplestreams-sync'),
> -('glance-simplestreams-sync-bos01-arm64',
> - 'glance-simplestreams-sync'),
> -

Re: [Launchpad-reviewers] [Merge] ~xnox/launchpad:only-sha256 into launchpad:master

2023-10-04 Thread Colin Watson
Making this series-specific shouldn't require any database schema changes.  
There's already a `DistroSeries.publishing_options` column which we use for a 
number of other pieces of series-specific behaviour, and that would be the 
appropriate place to put this as well.
-- 
https://code.launchpad.net/~xnox/launchpad/+git/launchpad/+merge/452749
Your team Launchpad code reviewers is requested to review the proposed merge of 
~xnox/launchpad:only-sha256 into launchpad:master.


___
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/launchpad:stagingsetup-syntax into launchpad:master

2023-10-03 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:stagingsetup-syntax into 
launchpad:master.

Commit message:
Fix syntax error in stagingsetup

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/452659
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:stagingsetup-syntax into launchpad:master.
diff --git a/database/replication/Makefile b/database/replication/Makefile
index c8de967..a2c1b8e 100644
--- a/database/replication/Makefile
+++ b/database/replication/Makefile
@@ -100,7 +100,7 @@ stagingsetup:
 	# Restore the database. We need to restore permissions, despite
 	# later running security.py, to pull in permissions granted on
 	# production to users not maintained by security.py.
-	< ${STAGING_DUMP} ${STAGING_WALBLOCK}
+	< ${STAGING_DUMP} ${STAGING_WALBLOCK} \
 	| pg_restore --dbname=${STAGING_DBNAME_MAIN} --no-owner ${EXIT_ON_ERROR} \
 		--use-list=${DUMPLIST} -v
 	rm ${DUMPLIST}
___
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/launchpad:doc-services-build-farm into launchpad:master

2023-10-03 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:doc-services-build-farm 
into launchpad:master.

Commit message:
doc: Add high-level build farm documentation

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Written collaboratively during a hackathon.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:doc-services-build-farm into launchpad:master.
diff --git a/doc/reference/index.rst b/doc/reference/index.rst
index 0fd2897..836b6f2 100644
--- a/doc/reference/index.rst
+++ b/doc/reference/index.rst
@@ -15,6 +15,7 @@ Services
 .. toctree::
:maxdepth: 1
 
+   services/build-farm
services/signing
 
 Possibly out-of-date
diff --git a/doc/reference/services/build-farm.rst b/doc/reference/services/build-farm.rst
new file mode 100644
index 000..5dccb6b
--- /dev/null
+++ b/doc/reference/services/build-farm.rst
@@ -0,0 +1,164 @@
+Build farm
+==
+
+Short description
+-
+Builds and tests software for Ubuntu and related systems.
+
+Detailed description
+
+The build farm builds packages, such as debs, snaps, charms, and other
+formats for Ubuntu in a secure and isolated way.
+
+The build farm consists of a manager, a proxy for outbound communication,
+and various builder regions.
+Build jobs are created by other parts of Launchpad, such as a change to a
+git repository resulting in snap recipe builds.
+They are then scheduled onto builders as virtual machines by
+``buildd-manager``.
+
+``buildd-manager`` continuously monitors all builders in the farm, and when
+a builder is idle it chooses the next highest priority job for dispatch to
+the idle builder.
+It does this by using XML-RPC, passing relevant data to the builder, which
+in turn fetches all ingredients for executing the build.
+When a build has completed, ``buildd-manager`` gathers the resulting files
+and injects them into Launchpad via an upload queue processor, and then the
+builder is reset to a baseline state.
+
+The manner in which a build is executed is determined by the build type.
+This typically involves invoking some external tools; ``sbuild`` for Ubuntu
+package builds, ``snapcraft`` for snap builds, etc.
+
+Builders do not have direct access to the internet, but rather need to
+acquire an authentication token to be able to access a restricted set of
+URLs on the internet via a squid proxy.
+
+Builder regions are physically co-located and consist of machines of the
+same architecture family.
+Builder regions comprise per-architecture image builders, and each physical
+location contains a ``launchpad-vbuilder-manage`` instance which handles
+resets for all architectures within that location.
+
+Each builder region maintains clean VM images for its builders; these are
+built using ``glance-simplestreams-sync``, which automatically and
+periodically copies standard pre-built images from
+``cloud-images.ubuntu.com``, and ``launchpad-buildd-image-modifier``, which
+hooks into ``glance-simplestreams-sync`` to produce modified images with
+``launchpad-buildd`` installed.
+
+Documentation
+-
+* `Documentation for launchpad-buildd <https://launchpad-buildd.readthedocs.io/en/latest/index.html>`_
+* `Documentation for the Launchpad CI runner <https://lpci.readthedocs.io/en/latest/>`_
+* `Documentation for Launchpad CI <https://help.launchpad.net/Code/ContinuousIntegration>`_
+
+Git repositories
+
+* `buildd-manager <https://git.launchpad.net/launchpad/tree/lib/lp/buildmaster/>`_
+* `launchpad-buildd <https://git.launchpad.net/launchpad-buildd>`_
+* `Launchpad CI runner <https://git.launchpad.net/lpci>`_
+* `glance-simplestreams-sync charm <https://git.launchpad.net/~launchpad/charm-glance-simplestreams-sync/tree/?h=scalingstack>`_
+* `launchpad-buildd-image-modifier charm <https://git.launchpad.net/charm-launchpad-buildd-image-modifier>`_
+* `launchpad-vbuilder-manage <https://git.launchpad.net/launchpad-vbuilder-manage>`_
+
+Bug trackers
+
+* https://bugs.launchpad.net/launchpad-project/+bugs?field.tag=soyuz-build
+* https://bugs.launchpad.net/launchpad-buildd
+* https://bugs.launchpad.net/lpci
+* https://bugs.launchpad.net/charm-glance-simplestreams-sync
+* https://bugs.launchpad.net/charm-launchpad-buildd-image-modifier
+* https://bugs.launchpad.net/launchpad-vbuilder-manage
+
+Deployment
+--
+* `Deployment of launchpad-buildd <https://launchpad-buildd.readthedocs.io/en/latest/how-to/deployment.html>`_
+* `Production deployment notes for launchpad-buildd <https://launchpad-buildd.readthedocs.io/en/latest/explanation/deployment.html>`_
+* `vbuilder Mojo spec <https://git.launchpad.net/~launchpad/launchpad-mojo-specs/+git/private/tree/vbuilder?h=vbuilder>`_
+* `lp-builder-proxy Mojo spec <https://

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-10-03 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder with 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-remove-lgw01 as a 
prerequisite.

Commit message:
vbuilder: Add qastaging

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/452644

This shares OpenStack credentials with staging, but uses different instance 
networks, domains, image names, and builder names so that things don't overlap 
where that would cause problems.  This is working well on qastaging already so 
I'd like to merge it back.

I took the opportunity to rewrite `vbuilder/upgrade-charms` to look a bit more 
like `vbuilder/rebuild-images`, as it was getting hard to understand what to 
change here and it was easy to miss things.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-qastaging into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder.
diff --git a/vbuilder/bundle.yaml b/vbuilder/bundle.yaml
index 6a6c5e3..d588d9d 100644
--- a/vbuilder/bundle.yaml
+++ b/vbuilder/bundle.yaml
@@ -41,7 +41,8 @@
 {%-   set vbuilders_bos03 = {"amd64": {"series": "focal", "count": 60}} %}
 {%-   set vbuilders_lcy02 = {"amd64": {"series": "focal", "count": 120}} %}
 {%-   set vbuilder_prefix = "" %}
-{%- else %}
+{%- elif stage_name == "staging" %}
+{#-   This environment is confusingly named, and is actually connected to Launchpad dogfood. #}
 {%-   set clamav_database_url = "http://clamav-database-mirror.staging.lp.internal/; %}
 {%-   set content_id_template = "launchpad-buildd:staging" %}
 {%-   set dns_update_host_bos01 = "10.189.0.2" %}
@@ -84,6 +85,49 @@
 {%-   set vbuilders_bos03 = {"amd64": {"series": "jammy", "count": 4}} %}
 {%-   set vbuilders_lcy02 = {"amd64": {"series": "jammy", "count": 4}} %}
 {%-   set vbuilder_prefix = "dogfood-" %}
+{%- elif stage_name == "qastaging" %}
+{%-   set clamav_database_url = "http://clamav-database-mirror.staging.lp.internal/; %}
+{%-   set content_id_template = "launchpad-buildd:qastaging" %}
+{%-   set dns_update_host_bos01 = "10.189.0.2" %}
+{%-   set dns_update_host_bos02 = "10.189.128.2" %}
+{%-   set dns_update_host_bos03 = "10.189.128.2" %}
+{%-   set dns_update_host_lcy02 = "10.132.31.11 10.132.31.12 10.132.31.13" %}
+{%-   set dns_update_key_name = "vbuilder-staging-manage" %}
+{%-   set domain_bos01 = "vbuilder.qastaging.bos01.scalingstack" %}
+{%-   set domain_bos02 = "vbuilder.qastaging.bos02.scalingstack" %}
+{%-   set domain_bos03 = "vbuilder.qastaging.bos03.scalingstack" %}
+{%-   set domain_lcy02 = "vbuilder.qastaging.lcy02.scalingstack" %}
+{%-   set extra_constraints = "" %}
+{%-   set gss_series = "focal|jammy" %}
+{%-   set instance_key_name_bos01 = "ppa-manage-test-qastaging" %}
+{%-   set instance_key_name_bos02 = "ppa-manage-test-qastaging" %}
+{%-   set instance_key_name_bos03 = "ppa-manage-test-qastaging" %}
+{%-   set instance_key_name_lcy02 = "ppa-manage-test-qastaging" %}
+{%-   set instance_network_bos01 = "10.189.36.0/24" %}
+{%-   set instance_network_bos02 = "10.189.164.0/23" %}
+{%-   set instance_network_bos03 = "10.144.4.0/23" %}
+{%-   set instance_network_lcy02 = "10.134.4.0/23" %}
+{%-   set instance_router = "vbuilder_staging_router" %}
+{%-   set instance_router_bos03 = "router_launchpad-vbuilder-staging" %}
+{%-   set instance_router_lcy02 = "router_launchpad-vbuilder-staging" %}
+{%-   set launchpad_buildd_repository = "ppa:launchpad/buildd-staging" %}
+{%-   set lp_buildd_managers = "10.132.54.242" %}
+{%-   set lp_environment = "qastaging" %}
+{%-   set lp_sshkey = "ssh-ed25519 C3NzaC1lZDI1NTE5IFrjt0yytzrK9fQuG+6VgE6QStUbDmunlN7+Lv5XhmoL stg-launchpad@launchpad-bastion-ps5" %}
+{%-   set modifiers_bos01 = '{"arm64": "10.43.0.10", "ppc64el": "10.43.0.23", "s390x": "10.43.0.15"}' %}
+{%-   set modifiers_bos02 = '{"arm64": "10.44.0.13", "ppc64el": "10.44.0.19", "s390x": "10.44.0.14"}' %}
+{%-   set name_prefix = "launchpad-buildd-qastaging" %}
+{%-   set openstack_tenant_name = "vbuilder_staging_project" %}
+{%-   set openstack_tenant_name_bos03 = "launchpad-vbuilder-staging_project" %}
+{%-   set openst

[Launchpad-reviewers] [Merge] ~cjwatson/lp-signing:charm-update-ols-layers into lp-signing:master

2023-10-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-signing:charm-update-ols-layers 
into lp-signing:master.

Commit message:
charm: Update charm-wheels/ols-layers

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The old version of layer-basic embedded in ols-layers had some insufficient 
pinning; as a result, builds have started failing recently due to changes in 
some unpinned dependencies.  Updating charm-wheels and ols-layers fixes that.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-signing:charm-update-ols-layers into lp-signing:master.
diff --git a/charm/lp-signing/charmcraft.yaml b/charm/lp-signing/charmcraft.yaml
index 9b1a73d..e0454fe 100644
--- a/charm/lp-signing/charmcraft.yaml
+++ b/charm/lp-signing/charmcraft.yaml
@@ -11,7 +11,7 @@ bases:
 parts:
   charm-wheels:
 source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
-source-commit: "81b18be78649b73fda9a65dbbb1e02fc3aba166f"
+source-commit: "42c89d9c66dbe137139b047fd54aed49b66d1a5e"
 source-submodules: []
 source-type: git
 plugin: dump
@@ -21,7 +21,7 @@ parts:
   - "-charm-wheels"
   ols-layers:
 source: https://git.launchpad.net/ols-charm-deps
-source-commit: "e13ccad47df4f05afbf93fa62ddafe180fde78aa"
+source-commit: "9c59a9804f1f40e2a74be7dac9bf18a655a7864f"
 source-submodules: []
 source-type: git
 plugin: dump
___
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-codeimport:charm-update-ols-layers into lp-codeimport:master

2023-10-02 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/lp-codeimport:charm-update-ols-layers into lp-codeimport:master.

Commit message:
charm: Update charm-wheels/ols-layers

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The old version of layer-basic embedded in ols-layers had some insufficient 
pinning; as a result, builds have started failing recently due to changes in 
some unpinned dependencies.  Updating charm-wheels and ols-layers fixes that.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-codeimport:charm-update-ols-layers into lp-codeimport:master.
diff --git a/charm/lp-codeimport-storage/charmcraft.yaml b/charm/lp-codeimport-storage/charmcraft.yaml
index 14cc685..5b9d5f0 100644
--- a/charm/lp-codeimport-storage/charmcraft.yaml
+++ b/charm/lp-codeimport-storage/charmcraft.yaml
@@ -11,7 +11,7 @@ bases:
 parts:
   charm-wheels:
 source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
-source-commit: "59b32ae07f98051385c96d6d8e7e02ca4f197fe5"
+source-commit: "42c89d9c66dbe137139b047fd54aed49b66d1a5e"
 source-submodules: []
 source-type: git
 plugin: dump
@@ -21,7 +21,7 @@ parts:
   - "-charm-wheels"
   ols-layers:
 source: https://git.launchpad.net/ols-charm-deps
-source-commit: "1ca8acbef7eb49b8a2cc81e5e13479b4f226a48b"
+source-commit: "9c59a9804f1f40e2a74be7dac9bf18a655a7864f"
 source-submodules: []
 source-type: git
 plugin: dump
diff --git a/charm/lp-codeimport/charmcraft.yaml b/charm/lp-codeimport/charmcraft.yaml
index 09f8a2d..86f193b 100644
--- a/charm/lp-codeimport/charmcraft.yaml
+++ b/charm/lp-codeimport/charmcraft.yaml
@@ -11,7 +11,7 @@ bases:
 parts:
   charm-wheels:
 source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
-source-commit: "fe523e25521254c2034eea96e2fde079034b593a"
+source-commit: "42c89d9c66dbe137139b047fd54aed49b66d1a5e"
 source-submodules: []
 source-type: git
 plugin: dump
@@ -21,7 +21,7 @@ parts:
   - "-charm-wheels"
   ols-layers:
 source: https://git.launchpad.net/ols-charm-deps
-source-commit: "df20c87d00ca0bfda64c1b58d8254220aa55f680"
+source-commit: "9c59a9804f1f40e2a74be7dac9bf18a655a7864f"
 source-submodules: []
 source-type: git
 plugin: dump
___
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/launchpad:doc-services-signing into launchpad:master

2023-10-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:doc-services-signing into 
launchpad:master.

Commit message:
doc: Add high-level signing service documentation

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/452548
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:doc-services-signing into launchpad:master.
diff --git a/doc/reference/index.rst b/doc/reference/index.rst
index a8615c5..0fd2897 100644
--- a/doc/reference/index.rst
+++ b/doc/reference/index.rst
@@ -9,6 +9,14 @@ Reference
python
tests
 
+Services
+
+
+.. toctree::
+   :maxdepth: 1
+
+   services/signing
+
 Possibly out-of-date
 
 
diff --git a/doc/reference/services/signing.rst b/doc/reference/services/signing.rst
new file mode 100644
index 000..5af3366
--- /dev/null
+++ b/doc/reference/services/signing.rst
@@ -0,0 +1,66 @@
+Signing service
+===
+
+Short description
+-
+A service for storing keys and signing messages.
+
+Detailed description
+
+The signing service provides Launchpad with a way to sign important objects
+such as boot loaders, kernel images, kernel modules, or archive metadata,
+while isolating private keys so that other components of Launchpad cannot
+read them directly.
+
+It exposes authenticated and encrypted HTTP interfaces for generating keys,
+injecting keys that were generated elsewhere, and signing data.
+
+It is used both by Launchpad itself and by some other services within
+Canonical, such as the Snap Models Service.
+
+Documentation
+-
+https://lp-signing.readthedocs.io/
+
+Git repository
+--
+https://git.launchpad.net/lp-signing
+
+Bug tracker
+---
+https://bugs.launchpad.net/lp-signing
+
+Deployment
+--
+* `lp-signing charm <https://charmhub.io/lp-signing>`_
+* `Mojo spec <https://git.launchpad.net/launchpad-mojo-specs/tree/lp-signing/>`_
+* `Deploying lp-signing <https://lp-signing.readthedocs.io/en/latest/how-to/deployment.html>`_
+
+Related specifications
+--
+`Launchpad signing service <https://docs.google.com/document/d/1kCUUVFb1m0-Uo81tHFyYJCxysquMbKgJDMOSF63NWFc>`_
+
+Log files
+-
+See https://wiki.canonical.com/Launchpad/FreshLogs.
+
+Production
+~~
+
+* ``rless il3-signing1.lp.internal::lp-signing-gunicorn-logs/gunicorn.log``
+* ``rless il3-signing2.lp.internal::lp-signing-gunicorn-logs/gunicorn.log``
+
+Staging
+~~~
+
+* ``rless 10.132.60.12::lp-signing-gunicorn-logs/gunicorn.log``
+* ``rless 10.132.60.220::lp-signing-gunicorn-logs/gunicorn.log``
+
+Common support cases
+
+..
+  XXX: https://warthogs.atlassian.net/browse/LP-1323: add documentation for enrolling a new client
+
+More information
+
+`Launchpad services diagram <https://viewer.diagrams.net/?tags=%7B%7D=ff=_blank=1=1=14glVH8XSJX-2FxTRWny#G1j-yk3c4mzYfMC79Y-uo9__u93pLWkiMi>`_
___
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-codeimport:flake8-6.1.0 into lp-codeimport:master

2023-10-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-codeimport:flake8-6.1.0 into 
lp-codeimport:master.

Commit message:
pre-commit: Update to flake8 6.1.0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This spotted an unused assignment shadowed by a property.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-codeimport:flake8-6.1.0 into lp-codeimport:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6cb6e67..e631592 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -12,7 +12,7 @@ repos:
 exclude: systemdocs\.py
 -   id: no-commit-to-branch
 -   repo: https://github.com/PyCQA/flake8
-rev: 6.0.0
+rev: 6.1.0
 hooks:
 -   id: flake8
 exclude: ^lib/contrib/
diff --git a/lib/lp/services/scripts/base.py b/lib/lp/services/scripts/base.py
index 55d7ff0..813bb2c 100644
--- a/lib/lp/services/scripts/base.py
+++ b/lib/lp/services/scripts/base.py
@@ -116,7 +116,6 @@ class LaunchpadScript:
 txn = None
 usage = None
 description = None
-lockfilepath = None
 loglevel = logging.INFO
 
 # State for the log_unhandled_exceptions decorator.
___
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-signing:readthedocs-config into lp-signing:master

2023-10-02 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lp-signing:readthedocs-config into 
lp-signing:master.

Commit message:
Add readthedocs configuration

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-signing/+git/lp-signing/+merge/452533
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-signing:readthedocs-config into lp-signing:master.
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 000..6527c11
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,17 @@
+version: 2
+
+build:
+  os: ubuntu-22.04
+  tools:
+python: "3.10"
+
+python:
+  install:
+- method: pip
+  path: .
+  extra_requirements:
+- docs
+
+sphinx:
+  configuration: docs/conf.py
+  fail_on_warning: true
___
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/lpci:release-0.2.4 into lpci:main

2023-09-29 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/lpci:release-0.2.4 into lpci:main.

Commit message:
Release version 0.2.4

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lpci/+git/lpci/+merge/452455
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lpci:release-0.2.4 into lpci:main.
diff --git a/NEWS.rst b/NEWS.rst
index 2748244..942013f 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,7 +2,7 @@
 Version history
 ===
 
-0.2.4 (unreleased)
+0.2.4 (2023-09-29)
 ==
 
 - Fix ``lpci release`` to release the latest build of each architecture (or
diff --git a/setup.cfg b/setup.cfg
index 1fe623d..6abdc77 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = lpci
-version = 0.2.3
+version = 0.2.4
 description = Runner for Launchpad CI jobs
 long_description = file: README.rst
 long_description_content_type = text/x-rst
___
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


  1   2   3   4   5   6   7   8   9   10   >