← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~tushar5526/launchpad:update-charm-to-exclude-ppas-from-secrets into launchpad:master

 

Tushar Gupta has proposed merging ~tushar5526/launchpad:update-charm-to-exclude-ppas-from-secrets into launchpad:master.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~tushar5526/launchpad/+git/launchpad/+merge/480927
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~tushar5526/launchpad:update-charm-to-exclude-ppas-from-secrets into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/config.yaml b/charm/launchpad-ppa-publisher/config.yaml
index 1c1940b..dfa07c2 100644
--- a/charm/launchpad-ppa-publisher/config.yaml
+++ b/charm/launchpad-ppa-publisher/config.yaml
@@ -78,3 +78,9 @@ options:
     type: string
     default:
     description: Endpoint for the signing service.
+  excluded_ppas:
+    type: string
+    description: |
+      YAML-encoded list of PPA references that should be excluded from the
+      main publisher run. 
+    default: ""
\ No newline at end of file
diff --git a/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py b/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
index 2b8b7af..af17792 100644
--- a/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
+++ b/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
@@ -3,6 +3,7 @@
 
 import os
 
+import yaml
 from charmhelpers.core import hookenv, host, templating
 from charms.launchpad.base import configure_email, get_service_config
 from charms.launchpad.payload import configure_cron, configure_lazr
@@ -64,6 +65,7 @@ def configure():
     config["ppa_archive_private_root"] = ppa_archive_private()
     config["ppa_signing_keys_root"] = ppa_keys_root
     config["oval_data_root"] = oval_data_root
+    config["excluded_ppas"] = yaml.safe_load(config["excluded_ppas"])
 
     host.mkdir(data_dir, owner=base.user(), group=base.user(), perms=0o775)
     host.mkdir(
diff --git a/charm/launchpad-ppa-publisher/templates/crontab.j2 b/charm/launchpad-ppa-publisher/templates/crontab.j2
index dbe2998..2f13a55 100644
--- a/charm/launchpad-ppa-publisher/templates/crontab.j2
+++ b/charm/launchpad-ppa-publisher/templates/crontab.j2
@@ -9,7 +9,13 @@ PPAROOT={{ ppa_archive_root }}
 P3AROOT={{ ppa_archive_private_root }}
 
 {% if active -%}
-* * * * * umask 022; nice -n 5 ionice -c 2 -n 7 {{ code_dir }}/cronscripts/publishing/cron.publish-ppa "-d ubuntu" "--all-derived" "-d debian" >> {{ logs_dir }}/cron.ppa.log 2>&1
+
+{% if excluded_ppas %}
+{% set excluded_ppas_options = excluded_ppas | join(' --exclude ') %} 
+{% set excluded_ppas_options = "--exclude " ~ excluded_ppas_options %}
+{% endif %}
+
+* * * * * umask 022; nice -n 5 ionice -c 2 -n 7 {{ code_dir }}/cronscripts/publishing/cron.publish-ppa "-d ubuntu {{ excluded_ppas_options }}" "--all-derived {{ excluded_ppas_options }}" "-d debian {{ excluded_ppas_options }}" >> {{ logs_dir }}/cron.ppa.log 2>&1
 
 17,47 * * * * nice -n 15 {{ code_dir }}/cronscripts/parse-ppa-apache-access-logs.py -q --log-file=INFO:{{ logs_dir }}/parse-ppa-apache-access-logs.log
 

Follow ups