← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:charm-debian-importer-db-layer into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:charm-debian-importer-db-layer into launchpad:master.

Commit message:
charm: Update debian-importer charm to use the db layer

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I tested this change before landing the baseline charm, but I apparently forgot to commit it.  This brings it into line with our other charms.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-debian-importer-db-layer into launchpad:master.
diff --git a/charm/launchpad-debian-importer/charmcraft.yaml b/charm/launchpad-debian-importer/charmcraft.yaml
index 1634d67..01134d6 100644
--- a/charm/launchpad-debian-importer/charmcraft.yaml
+++ b/charm/launchpad-debian-importer/charmcraft.yaml
@@ -35,12 +35,14 @@ parts:
     after:
       - ols-layers
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "6a50917f5f6163069ae1661e3320abb5b48173a3"
+    source-commit: "42a4b4c4f62936b1d050c775e84f7364dfb5efc0"
     source-submodules: []
     source-type: git
     plugin: dump
     organize:
       launchpad-base: layers/layer/launchpad-base
+      launchpad-db: layers/layer/launchpad-db
+      launchpad-payload: layers/layer/launchpad-payload
     stage:
       - layers
     prime:
diff --git a/charm/launchpad-debian-importer/layer.yaml b/charm/launchpad-debian-importer/layer.yaml
index 88e2ce1..af86104 100644
--- a/charm/launchpad-debian-importer/layer.yaml
+++ b/charm/launchpad-debian-importer/layer.yaml
@@ -1,5 +1,5 @@
 includes:
-  - layer:launchpad-base
+  - layer:launchpad-db
 repo: https://git.launchpad.net/launchpad
 options:
   apt:
diff --git a/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py b/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
index f87e95b..f9c42dd 100644
--- a/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
+++ b/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
@@ -5,12 +5,9 @@ import os.path
 
 import yaml
 from charmhelpers.core import hookenv, host, templating
-from charms.launchpad.base import (
-    configure_cron,
-    configure_lazr,
-    get_service_config,
-)
-from charms.reactive import set_state, when, when_not
+from charms.launchpad.base import get_service_config
+from charms.launchpad.payload import configure_cron, configure_lazr
+from charms.reactive import remove_state, set_state, when, when_not
 from ols import base
 
 
@@ -24,7 +21,7 @@ def configure_logrotate(config):
     )
 
 
-@when("launchpad.base.configured")
+@when("launchpad.db.configured")
 @when_not("service.configured")
 def configure():
     config = get_service_config()
@@ -60,3 +57,9 @@ def configure():
 @when("service.configured")
 def check_is_running():
     hookenv.status_set("active", "Ready")
+
+
+@when("service.configured")
+@when_not("launchpad.db.configured")
+def deconfigure():
+    remove_state("service.configured")
diff --git a/charm/launchpad-debian-importer/templates/launchpad-debian-importer-lazr.conf b/charm/launchpad-debian-importer/templates/launchpad-debian-importer-lazr.conf
index 2152ea5..ec6a227 100644
--- a/charm/launchpad-debian-importer/templates/launchpad-debian-importer-lazr.conf
+++ b/charm/launchpad-debian-importer/templates/launchpad-debian-importer-lazr.conf
@@ -9,7 +9,7 @@
 {% from "macros.j2" import opt -%}
 
 [meta]
-extends: ../launchpad-base-lazr.conf
+extends: ../launchpad-db-lazr.conf
 
 {% for suite, components in debian_suites.items() -%}
 [gina_target.{{ suite }}]