[Launchpad-reviewers] [Merge] ~barryprice/turnip:master into turnip:master

2021-03-16 Thread Barry Price
Barry Price has proposed merging ~barryprice/turnip:master into turnip:master.

Commit message:
Reformat our E2E check hint to avoid using parentheses, which Nagios considers 
illegal

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~barryprice/turnip/+git/turnip/+merge/399759
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~barryprice/turnip:master into turnip:master.
diff --git a/charm/layer/turnip-base/lib/charms/turnip/base.py b/charm/layer/turnip-base/lib/charms/turnip/base.py
index 4cd1f55..2f24293 100644
--- a/charm/layer/turnip-base/lib/charms/turnip/base.py
+++ b/charm/layer/turnip-base/lib/charms/turnip/base.py
@@ -320,7 +320,7 @@ def add_nagios_e2e_checks(nagios):
 nagios.add_check(
 [os.path.join(nrpe_dir(), 'check_git_refs'), url],
 name='check_turnip_git_refs_{}'.format(i),
-description='Git E2E {} (hint: check nfs-ganesha status)'.format(
+description='Git E2E {} - hint: check nfs-ganesha status'.format(url),
 url),
 context=config['nagios_context'])
 
___
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] ~pappacena/launchpad:ocirecipe-subscription-ui into launchpad:master

2021-03-16 Thread Thiago F. Pappacena
Thiago F. Pappacena has proposed merging 
~pappacena/launchpad:ocirecipe-subscription-ui into launchpad:master with 
~pappacena/launchpad:ocirecipe-subscription as a prerequisite.

Commit message:
OCI recipe subscription UI flow

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/399750
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~pappacena/launchpad:ocirecipe-subscription-ui into launchpad:master.
diff --git a/lib/lp/oci/browser/configure.zcml b/lib/lp/oci/browser/configure.zcml
index 6c254fb..53db0d2 100644
--- a/lib/lp/oci/browser/configure.zcml
+++ b/lib/lp/oci/browser/configure.zcml
@@ -1,4 +1,4 @@
-
 
@@ -129,5 +129,44 @@
 for="lp.oci.interfaces.ocipushrule.IOCIPushRule"
 path_expression="string:+push-rule/${id}"
 attribute_to_parent="recipe" />
+
+
+
+
+
+
+
+
+
 
 
diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
index 3b79cec..801b005 100644
--- a/lib/lp/oci/browser/ocirecipe.py
+++ b/lib/lp/oci/browser/ocirecipe.py
@@ -42,6 +42,7 @@ from zope.schema import (
 TextLine,
 ValidationError,
 )
+from zope.security.interfaces import Unauthorized
 
 from lp.app.browser.launchpadform import (
 action,
@@ -76,6 +77,7 @@ from lp.oci.interfaces.ociregistrycredentials import (
 OCIRegistryCredentialsAlreadyExist,
 user_can_edit_credentials_for_owner,
 )
+from lp.registry.interfaces.person import IPersonSet
 from lp.services.features import getFeatureFlag
 from lp.services.propertycache import cachedproperty
 from lp.services.webapp import (
@@ -121,6 +123,13 @@ class OCIRecipeNavigation(WebhookTargetNavigationMixin, Navigation):
 id = int(id)
 return getUtility(IOCIPushRuleSet).getByID(id)
 
+@stepthrough("+subscription")
+def traverse_subscription(self, name):
+"""Traverses to an `IOCIRecipeSubscription`."""
+person = getUtility(IPersonSet).getByName(name)
+if person is not None:
+return self.context.getSubscription(person)
+
 
 class OCIRecipeBreadcrumb(NameBreadcrumb):
 
@@ -164,7 +173,8 @@ class OCIRecipeContextMenu(ContextMenu):
 
 facet = 'overview'
 
-links = ('request_builds', 'edit_push_rules')
+links = ('request_builds', 'edit_push_rules',
+ 'add_subscriber', 'subscription')
 
 @enabled_with_permission('launchpad.Edit')
 def request_builds(self):
@@ -175,6 +185,23 @@ class OCIRecipeContextMenu(ContextMenu):
 return Link(
 '+edit-push-rules', 'Edit push rules', icon='edit')
 
+@enabled_with_permission("launchpad.AnyPerson")
+def subscription(self):
+if self.context.getSubscription(self.user) is not None:
+url = "+subscription/%s" % self.user.name
+text = "Edit your subscription"
+icon = "edit"
+else:
+url = "+subscribe"
+text = "Subscribe yourself"
+icon = "add"
+return Link(url, text, icon=icon)
+
+@enabled_with_permission("launchpad.AnyPerson")
+def add_subscriber(self):
+text = "Subscribe someone else"
+return Link("+addsubscriber", text, icon="add")
+
 
 class OCIProjectRecipesView(LaunchpadView):
 """Default view for the list of OCI recipes of an OCI project."""
@@ -233,6 +260,13 @@ class OCIRecipeView(LaunchpadView):
 return len(self.push_rules) > 0
 
 @property
+def user_can_see_source(self):
+try:
+return self.context.git_ref.repository.visibleByUser(self.user)
+except Unauthorized:
+return False
+
+@property
 def person_picker(self):
 field = copy_field(
 IOCIRecipe["owner"],
diff --git a/lib/lp/oci/browser/ocirecipesubscription.py b/lib/lp/oci/browser/ocirecipesubscription.py
new file mode 100644
index 000..2b83696
--- /dev/null
+++ b/lib/lp/oci/browser/ocirecipesubscription.py
@@ -0,0 +1,176 @@
+# Copyright 2020-2021 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""OCI recipe subscription views."""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+'OCIRecipePortletSubscribersContent'
+]
+
+from lp.oci.interfaces.ocirecipesubscription import IOCIRecipeSubscription
+from zope.component import getUtility
+from zope.formlib.form import action
+from zope.security.interfaces import ForbiddenAttribute
+
+from lp.app.browser.launchpadform import (
+LaunchpadEditFormView,
+LaunchpadFormView,
+)
+from lp.registry.interfaces.person import IPersonSet
+from lp.services.webapp import (
+canonical_url,
+LaunchpadView,
+)
+from lp.services.webapp.authorization import (
+check_permission,
+

[Launchpad-reviewers] [Merge] ~ilasc/turnip:add-log-repack-completion into turnip:master

2021-03-16 Thread Ioana Lasc
Ioana Lasc has proposed merging ~ilasc/turnip:add-log-repack-completion into 
turnip:master.

Commit message:
Add log for return of repack call

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/turnip/+git/turnip/+merge/399720
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ilasc/turnip:add-log-repack-completion into turnip:master.
diff --git a/turnip/api/store.py b/turnip/api/store.py
index 8ea2240..545b76e 100644
--- a/turnip/api/store.py
+++ b/turnip/api/store.py
@@ -484,10 +484,17 @@ def repack(repo_path):
 
 repack_args = ['git', 'repack', '-Adq']
 
-subprocess.check_call(
-repack_args, cwd=repo_path,
-stderr=subprocess.PIPE, stdout=subprocess.PIPE)
-
+try:
+subprocess.check_call(
+repack_args, cwd=repo_path,
+stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+logger.info(
+"Repack completed for repository: "
+"%s", repo_path)
+except subprocess.CalledProcessError:
+logger.info(
+"Repack failed for repository: "
+"%s", repo_path)
 
 def get_refs(repo_store, repo_name, exclude_prefixes=None):
 """Return all refs for a git repository."""
___
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:use-pip-cache into turnip:master

2021-03-16 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/turnip:use-pip-cache into 
turnip:master.

Commit message:
Actually use pip cache at build time

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

turnip's Makefile was building a pip cache, but inexplicably not actually using 
it at build time.  On my laptop, using the pip cache takes the build time on my 
laptop (removing ~/.cache/pip/ before each test) from 8m3s to 31s.

In the process, I switched to configuring pip using environment variables; this 
is more reliable, as environment variables are passed through to pip processes 
run by setuptools when handling setup_requires.

I suspect this is a large part of why turnip code asset deployments have been 
so slow.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/turnip:use-pip-cache into turnip:master.
diff --git a/Makefile b/Makefile
index e0362ee..26bf506 100644
--- a/Makefile
+++ b/Makefile
@@ -16,10 +16,17 @@ VENV_ARGS := -p python3
 DEPENDENCIES_URL := https://git.launchpad.net/~canonical-launchpad-branches/turnip/+git/dependencies
 PIP_SOURCE_DIR := dependencies
 
-PIP_ARGS ?= --quiet
+# virtualenv and pip fail if setlocale fails, so force a valid locale.
+PIP_ENV := LC_ALL=C.UTF-8
+# "make PIP_QUIET=0" causes pip to be verbose.
+PIP_QUIET := 1
+PIP_ENV += PIP_QUIET=$(PIP_QUIET)
+PIP_FIND_LINKS := file://$(PIP_CACHE)/
 ifneq ($(PIP_SOURCE_DIR),)
-override PIP_ARGS += --no-index --find-links=file://$(shell readlink -f $(PIP_SOURCE_DIR))/
+PIP_ENV += PIP_NO_INDEX=1
+PIP_FIND_LINKS += file://$(shell readlink -f $(PIP_SOURCE_DIR))/
 endif
+PIP_ENV += PIP_FIND_LINKS="$(PIP_FIND_LINKS)"
 
 # Create archives in labelled directories (e.g.
 # /$(PROJECT_NAME).tar.gz)
@@ -60,9 +67,9 @@ endif
 	(echo '[easy_install]'; \
 	 echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \
 		>$(ENV)/.pydistutils.cfg
-	$(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)
-	$(PIP) install $(PIP_ARGS) -r bootstrap-requirements.txt
-	$(PIP) install $(PIP_ARGS) -c requirements.txt \
+	$(PIP_ENV) $(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)
+	$(PIP_ENV) $(PIP) install -r bootstrap-requirements.txt
+	$(PIP_ENV) $(PIP) install -c requirements.txt \
 		-e '.[test,deploy]'
 
 bootstrap-test: PATH := /usr/sbin:/sbin:$(PATH)
@@ -131,7 +138,7 @@ stop:
 
 $(PIP_CACHE): $(ENV)
 	mkdir -p $(PIP_CACHE)
-	$(PIP) install $(PIP_ARGS) -d $(PIP_CACHE) \
+	$(PIP_ENV) $(PIP) install -d $(PIP_CACHE) \
 		-r bootstrap-requirements.txt \
 		-r requirements.txt
 
___
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