[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:build-status-allow-cancelling-to-uploading into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:build-status-allow-cancelling-to-uploading into 
launchpad:master.

Commit message:
Allow build status transitions from CANCELLING to UPLOADING

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

It turns out to be possible for this transition to happen in practice if a 
cancel request is sent for a build while buildd-manager is gathering its output 
files, which can be quite a large window since the entire download happens as 
part of a single scan cycle for a builder.  Ideally we'd probably restructure 
buildd-manager so that builds can be effectively cancelled during this process, 
but that's considerably more work.  In the meantime, I don't think it should 
actually cause a practical problem if we effectively ignore the cancel request 
in this case and allow the build to complete normally, and it will avoid some 
unnecessary large failures piling up on the buildd-manager unit.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:build-status-allow-cancelling-to-uploading into 
launchpad:master.
diff --git a/lib/lp/buildmaster/model/buildfarmjob.py b/lib/lp/buildmaster/model/buildfarmjob.py
index e69651f..e6c7663 100644
--- a/lib/lp/buildmaster/model/buildfarmjob.py
+++ b/lib/lp/buildmaster/model/buildfarmjob.py
@@ -46,7 +46,17 @@ VALID_STATUS_TRANSITIONS = {
 BuildStatus.FAILEDTOUPLOAD,
 BuildStatus.SUPERSEDED,
 ),
-BuildStatus.CANCELLING: (BuildStatus.CANCELLED,),
+BuildStatus.CANCELLING: (
+# Gathering a build's output files is all done in the middle of a
+# single iteration of its scan loop, so there's no opportunity for
+# cancelling a build to interrupt that process.  As a result, it's
+# possible and somewhat reasonable for a build to go from CANCELLING
+# to UPLOADING if it was cancelled while gathering files, perhaps
+# because the files were very large and so the build appeared to
+# have hung.
+BuildStatus.UPLOADING,
+BuildStatus.CANCELLED,
+),
 BuildStatus.CANCELLED: (BuildStatus.NEEDSBUILD,),
 }
 
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
index 11c6a3e..6fd202c 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
@@ -11,6 +11,7 @@ from collections import OrderedDict
 from datetime import datetime
 
 import six
+from fixtures import MockPatchObject
 from testtools import ExpectedException
 from testtools.twistedsupport import AsynchronousDeferredRunTest
 from twisted.internet import defer
@@ -489,6 +490,37 @@ class TestHandleStatusMixin:
 self.assertResultCount(1, "incoming")
 
 @defer.inlineCallbacks
+def test_handleStatus_WAITING_OK_normal_file_cancel_while_gathering(self):
+# Cancelling a build while it is in the process of gathering files
+# does not (currently) interrupt that process; it leaves the build
+# in the CANCELLING status until the scan cycle for that builder
+# finishes (which in practice means until gathering has completed or
+# failed).  While this is a bit odd, if gathering completes anyway
+# then we might as well upload the results of the build.
+original_handleSuccess = self.behaviour.handleSuccess
+
+def cancel_then_handle_success(*args, **kwargs):
+self.build.cancel()
+return original_handleSuccess(*args, **kwargs)
+
+self.useFixture(
+MockPatchObject(
+self.behaviour, "handleSuccess", cancel_then_handle_success
+)
+)
+with dbuser(config.builddmaster.dbuser):
+yield self.behaviour.handleStatus(
+self.build.buildqueue_record,
+{
+"builder_status": "BuilderStatus.WAITING",
+"build_status": "BuildStatus.OK",
+"filemap": {"myfile.py": "test_file_hash"},
+},
+)
+self.assertEqual(BuildStatus.UPLOADING, self.build.status)
+self.assertResultCount(1, "incoming")
+
+@defer.inlineCallbacks
 def test_handleStatus_WAITING_OK_absolute_filepath(self):
 # A filemap that tries to write to files outside of the upload
 # directory will not be collected.
___
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] ~lgp171188/launchpad:launchpad-scripts-configuration-enable-debian-bugs-mirroring into launchpad:master

2023-07-24 Thread Guruprasad
Guruprasad has proposed merging 
~lgp171188/launchpad:launchpad-scripts-configuration-enable-debian-bugs-mirroring
 into launchpad:master.

Commit message:
charm/launchpad-scripts: Add configuration to enable Debian bugs mirror

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/447561
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~lgp171188/launchpad:launchpad-scripts-configuration-enable-debian-bugs-mirroring
 into launchpad:master.
diff --git a/charm/launchpad-scripts/config.yaml b/charm/launchpad-scripts/config.yaml
index 5abcb52..6f79540 100644
--- a/charm/launchpad-scripts/config.yaml
+++ b/charm/launchpad-scripts/config.yaml
@@ -11,6 +11,13 @@ options:
 type: string
 description: YAML-encoded dict mapping the credentials name to values.
 default: "{}"
+  enable_debian_bugs_mirroring:
+type: boolean
+description: |
+  Should the Debian bug data mirroring job be enabled? Disabling this
+  will also disable the checkwatches script which depends on the mirrored
+  Debian bug data.
+default: false
   language_pack_exporter_schedule:
 type: string
 description: >-
diff --git a/charm/launchpad-scripts/templates/crontab.j2 b/charm/launchpad-scripts/templates/crontab.j2
index 27a29e2..2a45014 100644
--- a/charm/launchpad-scripts/templates/crontab.j2
+++ b/charm/launchpad-scripts/templates/crontab.j2
@@ -30,6 +30,8 @@ LPCONFIG=launchpad-scripts
 
 27 07 * * 3 {{ code_dir }}/cronscripts/rosetta-pofile-stats.py -q --log-file=INFO:{{ logs_dir }}/rosetta-pofile-stats.log
 
+{%- if enable_debian_bugs_mirroring %}
+
 # Debian bugs mirroring, used by checkwatches
 4,19,34,49 * * * * {{ code_dir }}/scripts/debbugs-sync {{ var_dir }}/debbugs-mirror >> {{ logs_dir }}/debbugs-sync.log 2>&1
 
@@ -39,6 +41,8 @@ LPCONFIG=launchpad-scripts
 # Compress old checkwatches logs
 5 0 * * * find {{ logs_dir }}/checkwatches -maxdepth 1 -name '*.log' -type f -mtime +5 -print0 | xargs -0 -r nice gzip
 
+{%- endif %}
+
 # 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
___
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:sqlbase-comments into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:sqlbase-comments into 
launchpad:master.

Commit message:
Update some old comments that mention SQLBase

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I'm using `git grep SQLBase` as my to-do list for SQLObject-to-Storm 
conversions at the moment, and it would be nice to clean up a bit of noise.  
This commit introduces no functional change.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:sqlbase-comments into launchpad:master.
diff --git a/lib/lp/answers/model/questionmessage.py b/lib/lp/answers/model/questionmessage.py
index 2f5dd6c..01ad7f5 100644
--- a/lib/lp/answers/model/questionmessage.py
+++ b/lib/lp/answers/model/questionmessage.py
@@ -1,7 +1,7 @@
 # Copyright 2009-2021 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""SQLBase implementation of IQuestionMessage."""
+"""Storm implementation of IQuestionMessage."""
 
 __all__ = [
 "QuestionMessage",
diff --git a/lib/lp/answers/model/questionreopening.py b/lib/lp/answers/model/questionreopening.py
index 7b850a2..1b23906 100644
--- a/lib/lp/answers/model/questionreopening.py
+++ b/lib/lp/answers/model/questionreopening.py
@@ -1,7 +1,7 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""SQLBase implementation of IQuestionReopening."""
+"""Storm implementation of IQuestionReopening."""
 
 __all__ = ["QuestionReopening", "create_questionreopening"]
 
diff --git a/lib/lp/app/interfaces/launchpad.py b/lib/lp/app/interfaces/launchpad.py
index 767f45a..ca8f2d6 100644
--- a/lib/lp/app/interfaces/launchpad.py
+++ b/lib/lp/app/interfaces/launchpad.py
@@ -28,7 +28,7 @@ from lp.app.enums import ServiceUsage
 class ILaunchpadCelebrities(Interface):
 """Well known things.
 
-Celebrities are SQLBase instances that have a well known name.
+Celebrities are database objects that have a well-known name.
 """
 
 admin = Attribute("The 'admins' team.")
diff --git a/lib/lp/services/database/stormbase.py b/lib/lp/services/database/stormbase.py
index 65a1933..9dfa6e1 100644
--- a/lib/lp/services/database/stormbase.py
+++ b/lib/lp/services/database/stormbase.py
@@ -72,8 +72,8 @@ class StormBase(Storm):  # noqa: B1
 primary = [var.get() for var in obj_info["primary_vars"]]
 return hash((self.__class__,) + tuple(primary))
 
-# XXX: jcsackett 2011-01-20 bug=622648: Much as with the SQLBase,
-# this is not tested.
+# XXX: jcsackett 2011-01-20 bug=622648: This is not directly tested, but
+# large chunks of the test suite blow up if it's broken.
 def __storm_invalidated__(self):
 """Flush cached properties."""
 clear_property_cache(self)
diff --git a/lib/lp/testing/layers.py b/lib/lp/testing/layers.py
index df1c60c..ce68de6 100644
--- a/lib/lp/testing/layers.py
+++ b/lib/lp/testing/layers.py
@@ -172,8 +172,8 @@ def reconnect_stores(reset=False):
 main_store = IStore(LibraryFileAlias)
 assert main_store is not None, "Failed to reconnect"
 
-# Confirm that SQLOS is again talking to the database (it connects
-# as soon as SQLBase._connection is accessed
+# Confirm that Storm is talking to the database again (it connects
+# as soon as any query is executed).
 r = main_store.execute("SELECT count(*) FROM LaunchpadDatabaseRevision")
 assert r.get_one()[0] > 0, "Storm is not talking to the database"
 assert session_store() is not None, "Failed to reconnect"
___
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-update-lxd-links into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:doc-update-lxd-links into 
launchpad:master.

Commit message:
doc: Update LXD links

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/447555
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:doc-update-lxd-links into launchpad:master.
diff --git a/doc/explanation/charms.rst b/doc/explanation/charms.rst
index 712279e..8e8f8eb 100644
--- a/doc/explanation/charms.rst
+++ b/doc/explanation/charms.rst
@@ -150,7 +150,7 @@ Workflow
 
 
 You can run test deployments using `Juju `_ and
-`LXD `_.
+`LXD `_.
 
 Each Mojo spec has a ``README.md`` file explaining how to deploy it, and
 that's usually the easiest way to get started.  You should normally use the
diff --git a/doc/how-to/running.rst b/doc/how-to/running.rst
index 7eb4de3..4afe397 100644
--- a/doc/how-to/running.rst
+++ b/doc/how-to/running.rst
@@ -9,7 +9,7 @@ Setting up and running Launchpad
 
 This page explains how to set up and run Launchpad (for development) on your
 own machine, using a `LXD
-`_-managed container to
+`_-managed container to
 isolate it from the rest of your system.
 
 After you've done this, you may want to read about
@@ -72,8 +72,8 @@ Create a LXD container
 ==
 
 This assumes you already have LXD set up.  If not, follow the `instructions
-`_ for getting it
-installed and configured on your network.
+`_ for
+getting it installed and configured on your network.
 
 1. If you haven't done so already, run this script to set up LXD to let you
use your home directory inside the container.  Some developers prefer to
___
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:charmrecipebuild-getFileUrls into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charmrecipebuild-getFileUrls into launchpad:master.

Commit message:
Add and export CharmRecipeBuild.getFileUrls

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #2028406 in Launchpad itself: "Library does not provide a getFileUrls for 
charm_recipe_builds"
  https://bugs.launchpad.net/launchpad/+bug/2028406

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

This is directly analogous to methods on other similar build types, such as 
`SnapBuild.getFileUrls`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charmrecipebuild-getFileUrls into launchpad:master.
diff --git a/lib/lp/charms/interfaces/charmrecipebuild.py b/lib/lp/charms/interfaces/charmrecipebuild.py
index b3bfd33..78cec6b 100644
--- a/lib/lp/charms/interfaces/charmrecipebuild.py
+++ b/lib/lp/charms/interfaces/charmrecipebuild.py
@@ -16,6 +16,7 @@ import http.client
 from lazr.enum import EnumeratedType, Item
 from lazr.restful.declarations import (
 error_status,
+export_read_operation,
 export_write_operation,
 exported,
 exported_as_webservice_entry,
@@ -264,6 +265,13 @@ class ICharmRecipeBuildView(IPackageBuildView):
 :return: The corresponding `ILibraryFileAlias`.
 """
 
+@export_read_operation()
+@operation_for_version("devel")
+def getFileUrls():
+"""URLs for all the files produced by this build.
+
+:return: A collection of URLs for this build."""
+
 
 class ICharmRecipeBuildEdit(IBuildFarmJobEdit):
 """`ICharmRecipeBuild` methods that require launchpad.Edit."""
diff --git a/lib/lp/charms/model/charmrecipebuild.py b/lib/lp/charms/model/charmrecipebuild.py
index b5e4fe6..083c7ac 100644
--- a/lib/lp/charms/model/charmrecipebuild.py
+++ b/lib/lp/charms/model/charmrecipebuild.py
@@ -68,6 +68,7 @@ from lp.services.database.interfaces import IPrimaryStore, IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.model.job import Job
+from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
 from lp.services.propertycache import cachedproperty, get_property_cache
 from lp.services.webapp.snapshot import notify_modified
@@ -403,6 +404,13 @@ class CharmRecipeBuild(PackageBuildMixin, StormBase):
 
 raise NotFoundError(filename)
 
+def getFileUrls(self):
+"""See `ICharmRecipeBuild`."""
+return [
+ProxiedLibraryFileAlias(lfa, self).http_url
+for _, lfa, _ in self.getFiles()
+]
+
 def addFile(self, lfa):
 """See `ICharmRecipeBuild`."""
 charm_file = CharmFile(build=self, library_file=lfa)
diff --git a/lib/lp/charms/tests/test_charmrecipebuild.py b/lib/lp/charms/tests/test_charmrecipebuild.py
index e3816fe..c5903fa 100644
--- a/lib/lp/charms/tests/test_charmrecipebuild.py
+++ b/lib/lp/charms/tests/test_charmrecipebuild.py
@@ -45,6 +45,7 @@ from lp.services.config import config
 from lp.services.crypto.interfaces import IEncryptedContainer
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import JobStatus
+from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.services.propertycache import clear_property_cache
 from lp.services.webapp.interfaces import OAuthPermission
 from lp.services.webapp.publisher import canonical_url
@@ -998,3 +999,23 @@ class TestCharmRecipeBuildWebservice(TestCaseWithFactory):
 self.assertCanOpenRedirectedUrl(browser, build["build_log_url"])
 self.assertIsNotNone(build["upload_log_url"])
 self.assertCanOpenRedirectedUrl(browser, build["upload_log_url"])
+
+def test_getFileUrls(self):
+# API clients can fetch files attached to builds.
+db_build = self.factory.makeCharmRecipeBuild(requester=self.person)
+db_files = [
+self.factory.makeCharmFile(build=db_build) for i in range(2)
+]
+build_url = api_url(db_build)
+file_urls = [
+ProxiedLibraryFileAlias(file.library_file, db_build).http_url
+for file in db_files
+]
+logout()
+response = self.webservice.named_get(build_url, "getFileUrls")
+self.assertEqual(200, response.status)
+self.assertContentEqual(file_urls, response.jsonBody())
+browser = self.getNonRedirectingBrowser(user=self.person)
+browser.raiseHttpErrors = False
+for file_url in file_urls:
+self.assertCanOpenRedirectedUrl(browser, file_url)
___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : http

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:charm-librarian-frontend-relations into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad:charm-librarian-frontend-relations into launchpad:master.

Commit message:
charm: Set up frontend relations for the librarian

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The Apache configuration files here are lifted fairly directly from production, 
although qastaging and staging are much the same.  The `service_name` settings 
are passed through the stack of Juju relations (with Squid and Apache) and can 
be used in Apache `balancer://` URLs with no extra configuration required.

At the moment, the public and restricted librarians are on different sets of IP 
addresses.  I _think_ that this was mostly due to historical issues around 
issuing TLS certificates that are no longer an issue, so I'm going to try to 
get things working with a single set of public IP addresses on (qa)staging; if 
that doesn't work out then I'll fall back to splitting the `vhost-config` 
relation into two and deploying two Apache applications, but it doesn't end up 
being all that fundamentally different.

This depends on 
https://code.launchpad.net/~cjwatson/launchpad-layers/+git/launchpad-layers/+merge/447537,
 and before I land this I'd expect to fix up `source` and `source-commit` and 
make sure that all our charms stay in sync.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:charm-librarian-frontend-relations into launchpad:master.
diff --git a/charm/launchpad-librarian/charmcraft.yaml b/charm/launchpad-librarian/charmcraft.yaml
index 77e67e8..569c452 100644
--- a/charm/launchpad-librarian/charmcraft.yaml
+++ b/charm/launchpad-librarian/charmcraft.yaml
@@ -34,12 +34,13 @@ parts:
   launchpad-layers:
 after:
   - ols-layers
-source: https://git.launchpad.net/launchpad-layers
-source-commit: "42a4b4c4f62936b1d050c775e84f7364dfb5efc0"
+source: https://git.launchpad.net/~cjwatson/launchpad-layers
+source-commit: "8b7d25a29b8297d491abe6a0c6b69f34e39dddba"
 source-submodules: []
 source-type: git
 plugin: dump
 organize:
+  apache-vhost-config: layers/interface/apache-vhost-config
   launchpad-base: layers/layer/launchpad-base
   launchpad-db: layers/layer/launchpad-db
   launchpad-payload: layers/layer/launchpad-payload
diff --git a/charm/launchpad-librarian/config.yaml b/charm/launchpad-librarian/config.yaml
index 937f30d..b48a704 100644
--- a/charm/launchpad-librarian/config.yaml
+++ b/charm/launchpad-librarian/config.yaml
@@ -3,6 +3,11 @@ options:
 type: boolean
 default: true
 description: If true, enable jobs that may change the database.
+  domain_librarian_aliases:
+type: string
+default: "[]"
+description: >
+  A YAML-encoded list of aliases for the librarian's primary domain.
   haproxy_server_options:
 type: string
 description: Options to add to HAProxy "server" lines.
diff --git a/charm/launchpad-librarian/layer.yaml b/charm/launchpad-librarian/layer.yaml
index ce520c3..6efe850 100644
--- a/charm/launchpad-librarian/layer.yaml
+++ b/charm/launchpad-librarian/layer.yaml
@@ -1,5 +1,6 @@
 includes:
   - layer:launchpad-db
+  - interface:apache-vhost-config
   - interface:http
 repo: https://git.launchpad.net/launchpad
 options:
diff --git a/charm/launchpad-librarian/metadata.yaml b/charm/launchpad-librarian/metadata.yaml
index 5fb0de8..f114ffa 100644
--- a/charm/launchpad-librarian/metadata.yaml
+++ b/charm/launchpad-librarian/metadata.yaml
@@ -19,3 +19,5 @@ requires:
 provides:
   loadbalancer:
 interface: http
+  vhost-config:
+interface: apache-vhost-config
diff --git a/charm/launchpad-librarian/reactive/launchpad-librarian.py b/charm/launchpad-librarian/reactive/launchpad-librarian.py
index 516e537..be74fe0 100644
--- a/charm/launchpad-librarian/reactive/launchpad-librarian.py
+++ b/charm/launchpad-librarian/reactive/launchpad-librarian.py
@@ -3,6 +3,7 @@
 
 import os.path
 import subprocess
+from urllib.parse import urlparse
 
 import yaml
 from charmhelpers.core import hookenv, host, templating
@@ -210,7 +211,7 @@ def configure_loadbalancer():
 unit_ip = hookenv.unit_private_ip()
 services = [
 {
-"service_name": config["librarian_download_host"],
+"service_name": "launchpad_librarian_download",
 "service_port": config["librarian_download_port"],
 "service_host": "0.0.0.0",
 "service_options": list(service_options_download),
@@ -225,7 +226,7 @@ def configure_loadbalancer():
 ],
 },
 {
-"service_name": config["librarian_upload_host"],
+"service_name": "launchpad_librarian_upload",
 "service_port": config["librarian_upload_port"],
 "service_host": "0.0.0.0",
 "service_options": list(service_options_upload),
@@ -241,7 +242,7 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad-layers:interface-apache-vhost-config into launchpad-layers:main

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-layers:interface-apache-vhost-config into 
launchpad-layers:main.

Commit message:
Add interface to publish Apache virtual host configuration

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This implements the interface described under "Using the vhost-config relation" 
in https://git.launchpad.net/apache2-charm/tree/README.md.  It will allow us to 
put the desired Apache frontend configuration in the corresponding service 
charm and then just add some relations to make everything work.  I have a 
functioning prototype of this for the librarian.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-layers:interface-apache-vhost-config into 
launchpad-layers:main.
diff --git a/apache-vhost-config/interface.yaml b/apache-vhost-config/interface.yaml
new file mode 100644
index 000..0394b31
--- /dev/null
+++ b/apache-vhost-config/interface.yaml
@@ -0,0 +1,3 @@
+name: apache-vhost-config
+summary: Apache virtual host configuration interface
+version: 1
diff --git a/apache-vhost-config/provides.py b/apache-vhost-config/provides.py
new file mode 100644
index 000..7bd4a3e
--- /dev/null
+++ b/apache-vhost-config/provides.py
@@ -0,0 +1,53 @@
+# Copyright 2023 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+import base64
+from dataclasses import dataclass
+from typing import Dict, Iterable
+
+from charmhelpers.core import hookenv
+from charms.reactive import Endpoint, clear_flag, set_flag, when
+
+
+@dataclass
+class Vhost:
+port: int
+template: str
+
+def to_publish(self) -> Dict[str, str]:
+return {
+"port": self.port,
+"template": base64.b64encode(self.template.encode()).decode(),
+}
+
+
+class ApacheVhostConfigProvides(Endpoint):
+@when("endpoint.{endpoint_name}.joined")
+def handle_joined_unit(self):
+set_flag(self.expand_name("{endpoint_name}.available"))
+
+@when("endpoint.{endpoint_name}.changed")
+def handle_changed_unit(self):
+set_flag(self.expand_name("{endpoint_name}.available"))
+clear_flag(self.expand_name("changed"))
+
+@when("endpoint.{endpoint_name}.departed")
+def handle_departed_unit(self):
+clear_flag(self.expand_name("{endpoint_name}.available"))
+self.all_departed_units.clear()
+clear_flag(self.expand_name("departed"))
+
+def make_vhost(self, port: int, template: str):
+"""Prepare a vhost entry for use by `publish_vhosts`."""
+return Vhost(port=port, template=template)
+
+def publish_vhosts(self, vhosts: Iterable[Vhost]):
+"""Publish virtual host configurations for use by the Apache charm.
+
+:param vhosts: An iterable of objects returned by `make_vhost`.
+"""
+hookenv.log("Publishing Apache virtual host configurations")
+for relation in self.relations:
+relation.to_publish.update(
+{"vhosts": [vhost.to_publish() for vhost in vhosts]}
+)
___
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:stormify-branch into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-branch into 
launchpad:master.

Commit message:
Convert Branch to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/447535
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:stormify-branch into launchpad:master.
diff --git a/lib/lp/app/doc/tales.rst b/lib/lp/app/doc/tales.rst
index e872cff..662c1ff 100644
--- a/lib/lp/app/doc/tales.rst
+++ b/lib/lp/app/doc/tales.rst
@@ -597,7 +597,7 @@ For branches, fmt:link links to the branch page.
 >>> eric = factory.makePerson(name="eric")
 >>> fooix = factory.makeProduct(name="fooix")
 >>> branch = factory.makeProductBranch(
-... owner=eric, product=fooix, name="bar", title="The branch title"
+... owner=eric, product=fooix, name="bar"
 ... )
 >>> print(test_tales("branch/fmt:link", branch=branch))
 >> branch = factory.makeProductBranch(
-... owner=eric, product=fooix, name="my-branch", title="My Branch"
+... owner=eric, product=fooix, name="my-branch"
 ... )
 >>> michael = factory.makePerson(
 ... name="michael", displayname="Michael the Viking"
diff --git a/lib/lp/code/doc/branch.rst b/lib/lp/code/doc/branch.rst
index 7984f04..1b92425 100644
--- a/lib/lp/code/doc/branch.rst
+++ b/lib/lp/code/doc/branch.rst
@@ -273,7 +273,7 @@ Branch names
 
 Branches have a display name that is the bzr_identity.
 
->>> untitled_branch = factory.makeAnyBranch(title=None)
+>>> untitled_branch = factory.makeAnyBranch()
 >>> untitled_branch.displayname == untitled_branch.bzr_identity
 True
 
diff --git a/lib/lp/code/interfaces/branchnamespace.py b/lib/lp/code/interfaces/branchnamespace.py
index 345f36d..24c6ffb 100644
--- a/lib/lp/code/interfaces/branchnamespace.py
+++ b/lib/lp/code/interfaces/branchnamespace.py
@@ -32,9 +32,8 @@ class IBranchNamespace(Interface):
 name,
 registrant,
 url=None,
-title=None,
 lifecycle_status=BranchLifecycleStatus.DEVELOPMENT,
-summary=None,
+description=None,
 whiteboard=None,
 ):
 """Create and return an `IBranch` in this namespace."""
diff --git a/lib/lp/code/mail/tests/test_branch.py b/lib/lp/code/mail/tests/test_branch.py
index e1faf88..c9285fc 100644
--- a/lib/lp/code/mail/tests/test_branch.py
+++ b/lib/lp/code/mail/tests/test_branch.py
@@ -149,9 +149,9 @@ class TestRecipientReasonBzr(TestRecipientReasonMixin, TestCaseWithFactory):
 """Test fixture."""
 if subscriber is None:
 subscriber = self.factory.makePerson()
-source_branch = self.factory.makeProductBranch(title="foo")
+source_branch = self.factory.makeProductBranch()
 target_branch = self.factory.makeProductBranch(
-product=source_branch.product, title="bar"
+product=source_branch.product
 )
 merge_proposal = source_branch.addLandingTarget(
 source_branch.owner, target_branch
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index b9f9b5f..48fd5fc 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -16,7 +16,14 @@ from breezy.revision import NULL_REVISION
 from breezy.url_policy_open import open_only_scheme
 from lazr.lifecycle.event import ObjectCreatedEvent
 from storm.expr import SQL, And, Coalesce, Desc, Join, Not, Or, Select
-from storm.locals import AutoReload, ReferenceSet
+from storm.locals import (
+AutoReload,
+DateTime,
+Int,
+Reference,
+ReferenceSet,
+Unicode,
+)
 from storm.store import Store
 from zope.component import getUtility
 from zope.event import notify
@@ -130,12 +137,10 @@ from lp.registry.model.teammembership import TeamParticipation
 from lp.services.config import config
 from lp.services.database import bulk
 from lp.services.database.constants import DEFAULT, UTC_NOW
-from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import IPrimaryStore, IStore
-from lp.services.database.sqlbase import SQLBase
-from lp.services.database.sqlobject import ForeignKey, IntCol, StringCol
+from lp.services.database.stormbase import StormBase
 from lp.services.database.stormexpr import Array, ArrayAgg, ArrayIntersects
 from lp.services.helpers import shortlist
 from lp.services.job.interfaces.job import JobStatus
@@ -151,27 +156,68 @@ from lp.snappy.interfaces.snap import ISnapSet
 
 
 @implementer(IBranch, IInformationType)
-class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
+class Branch(StormBase, WebhookTargetMixin, BzrIdentityMixin):
 """A sequence of ordered revisions in Bazaar."""
 
-_table = "Branch"
+__storm_table__ = "Branch"

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:stormify-packaging into launchpad:master

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-packaging into 
launchpad:master.

Commit message:
Convert Packaging to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/447534
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:stormify-packaging into launchpad:master.
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index cf764f9..c2efa92 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -1610,7 +1610,7 @@ class Distribution(
 1,
 tables=[Packaging],
 where=(
-Packaging.sourcepackagenameID == SourcePackageName.id
+Packaging.sourcepackagename_id == SourcePackageName.id
 ),
 )
 )
diff --git a/lib/lp/registry/model/distributionsourcepackage.py b/lib/lp/registry/model/distributionsourcepackage.py
index 42a452d..1aacc71 100644
--- a/lib/lp/registry/model/distributionsourcepackage.py
+++ b/lib/lp/registry/model/distributionsourcepackage.py
@@ -365,7 +365,7 @@ class DistributionSourcePackage(
 store = Store.of(self.sourcepackagename)
 condition = And(
 Packaging.sourcepackagename == self.sourcepackagename,
-Packaging.distroseriesID == DistroSeries.id,
+Packaging.distroseries_id == DistroSeries.id,
 DistroSeries.distribution == self.distribution,
 )
 result = store.find(Packaging, condition)
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index bcb4a27..cd596f2 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -1094,7 +1094,7 @@ class DistroSeries(
 Not(
 SourcePackageName.id.is_in(
 Select(
-Packaging.sourcepackagenameID,
+Packaging.sourcepackagename_id,
 where=(Packaging.distroseries == self),
 distinct=True,
 )
@@ -1110,7 +1110,7 @@ class DistroSeries(
 .find(
 SourcePackageName,
 Packaging.sourcepackagename == SourcePackageName.id,
-Is(Packaging.productseriesID, None),
+Is(Packaging.productseries_id, None),
 POTemplate.sourcepackagename == SourcePackageName.id,
 POTemplate.distroseries == self,
 )
diff --git a/lib/lp/registry/model/packaging.py b/lib/lp/registry/model/packaging.py
index 047b0e5..13555a9 100644
--- a/lib/lp/registry/model/packaging.py
+++ b/lib/lp/registry/model/packaging.py
@@ -3,7 +3,10 @@
 
 __all__ = ["Packaging", "PackagingUtil"]
 
+from datetime import timezone
+
 from lazr.lifecycle.event import ObjectCreatedEvent, ObjectDeletedEvent
+from storm.locals import DateTime, Int, Reference
 from zope.component import getUtility
 from zope.event import notify
 from zope.interface import implementer
@@ -16,39 +19,36 @@ from lp.registry.interfaces.packaging import (
 PackagingType,
 )
 from lp.registry.interfaces.person import validate_public_person
-from lp.services.database.constants import DEFAULT, UTC_NOW
-from lp.services.database.datetimecol import UtcDateTimeCol
+from lp.services.database.constants import UTC_NOW
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.sqlbase import SQLBase
-from lp.services.database.sqlobject import ForeignKey
+from lp.services.database.interfaces import IStore
+from lp.services.database.stormbase import StormBase
 
 
 @implementer(IPackaging)
-class Packaging(SQLBase):
+class Packaging(StormBase):
 """A Packaging relating a SourcePackage and a Product."""
 
-_table = "Packaging"
+__storm_table__ = "Packaging"
 
-productseries = ForeignKey(
-foreignKey="ProductSeries", dbName="productseries", notNull=True
-)
-sourcepackagename = ForeignKey(
-foreignKey="SourcePackageName",
-dbName="sourcepackagename",
-notNull=True,
-)
-distroseries = ForeignKey(
-foreignKey="DistroSeries", dbName="distroseries", notNull=True
-)
+id = Int(primary=True)
+productseries_id = Int(name="productseries", allow_none=False)
+productseries = Reference(productseries_id, "ProductSeries.id")
+sourcepackagename_id = Int(name="sourcepackagename", allow_none=False)
+sourcepackagename = Reference(sourcepackagename_id, "SourcePackageName.id")
+distroseries_id = Int(name="distroseries", allow_none=False)
+distroseries = Reference(distroseries_id, "DistroSeries.id")
 packaging = DBEnum(name="packaging", allow_none=False, enum=PackagingType)
-datecreated =

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

2023-07-24 Thread Ines Almeida
Thanks for the info! Sounds good
-- 
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/447434
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-use-jammy into ~launchpad/launchpad-mojo-specs/+git/private:vbuilder

2023-07-24 Thread mp+447434
The proposal to merge 
~cjwatson/launchpad-mojo-specs/+git/private:vbuilder-use-jammy into 
~launchpad/launchpad-mojo-specs/+git/private:vbuilder has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/447434
-- 
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


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

2023-07-24 Thread Colin Watson
"Somewhat".  We have to do it, but an LTS upgrade of the host OS of all our 
builders is inevitably somewhat risky.  Dogfood builders have been running with 
it for a while and should have caught anything catastrophic, although the load 
there is pretty low so it's possible we missed an edge case somewhere.

Our sources of information will be graphs, user reports, and in the short term 
probably explicitly watching buildd-manager logs.  Note that one possibility 
that would indicate a problem is that build queues drop _faster_ than usual due 
to lots of failures in quick succession.
-- 
https://code.launchpad.net/~cjwatson/launchpad-mojo-specs/+git/private/+merge/447434
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-bastion-scripts:ignore-haproxy-queue-depth-checks into launchpad-bastion-scripts:main

2023-07-24 Thread Colin Watson
Colin Watson has proposed merging 
~cjwatson/launchpad-bastion-scripts:ignore-haproxy-queue-depth-checks into 
launchpad-bastion-scripts:main.

Commit message:
Ignore haproxy queue depth checks for production deployments

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/447523

This doesn't mean that we should ignore them in general, just that they 
shouldn't block deployments.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-bastion-scripts:ignore-haproxy-queue-depth-checks into 
launchpad-bastion-scripts:main.
diff --git a/upgrade-production b/upgrade-production
index 9c6a5a1..da01057 100755
--- a/upgrade-production
+++ b/upgrade-production
@@ -1,5 +1,10 @@
 #! /bin/sh
 set -e
 
+# Ignore haproxy queue depth checks for deployment purposes: they may need
+# to be handled by IS, but are unlikely to relate very closely to code
+# deployments.
+skip_checks=check_haproxy_queue_depth
+
 mkdir -p "$HOME/logs"
-ssh prod-launchpad@is-bastion-ps5.internal autodeploy-trigger prod-launchpad 2>&1 | tee -a "$HOME/logs/$(date +%F).log"
+ssh prod-launchpad@is-bastion-ps5.internal autodeploy-trigger prod-launchpad EXTRA_SKIP_CHECKS="$skip_checks" 2>&1 | tee -a "$HOME/logs/$(date +%F).log"
___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


[Launchpad-reviewers] [Merge] ~pelpsi/turnip:turnip-payload-upgrade-to-focal into turnip:master

2023-07-24 Thread Simone Pelosi
Simone Pelosi has proposed merging 
~pelpsi/turnip:turnip-payload-upgrade-to-focal into turnip:master.

Commit message:
VM upgraded from bionic to focal

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/turnip/+git/turnip/+merge/447505
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~pelpsi/turnip:turnip-payload-upgrade-to-focal into turnip:master.
diff --git a/ols-vms.conf b/ols-vms.conf
index bbafdfc..72394bc 100644
--- a/ols-vms.conf
+++ b/ols-vms.conf
@@ -1,6 +1,6 @@
 # Options defined here provide defaults for all sections
 vm.architecture = amd64
-vm.release = bionic
+vm.release = focal
 
 # pygit2
 apt.sources = ppa:launchpad/ppa
___
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