Merge lp:~hloeung/ubuntu-repository-cache/cron-more-info into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: James Simpson
Approved revision: 361
Merged at revision: 360
Proposed branch: lp:~hloeung/ubuntu-repository-cache/cron-more-info
Merge into: lp:ubuntu-repository-cache
Diff against target: 25 lines (+7/-0)
2 files modified
lib/ubuntu_repository_cache/service.py (+3/-0)
templates/cron/ubuntu-repository-cache_rsync.cron (+4/-0)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/cron-more-info
Reviewer Review Type Date Requested Status
James Simpson Approve
Canonical IS Reviewers Pending
Review via email: mp+427522@code.launchpad.net

Commit message

Add additional info to make cron emails easier to tell which provider and region

Description of the change

We can work out by the DNS hostname which cloud provider, but it's harder tell which region.

To post a comment you must log in.
Revision history for this message
James Simpson (jsimpso) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 360

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/ubuntu_repository_cache/service.py'
2--- lib/ubuntu_repository_cache/service.py 2022-07-22 03:31:50 +0000
3+++ lib/ubuntu_repository_cache/service.py 2022-07-27 23:38:36 +0000
4@@ -283,6 +283,9 @@
5 cron_context['MirrorSeries'] = config['mirror-series'].strip()
6 cron_context['ConfigPath'] = urc_config_path
7 cron_context['CharmEnvPath'] = os.path.join(hookenv.charm_dir(), 'bin', 'charm-env')
8+ # Add Juju model name and AZ so it's easier to work out which region sent out cron emails.
9+ cron_context['JujuModelName'] = os.environ.get('JUJU_MODEL_NAME')
10+ cron_context['JujuAvailabilityZone'] = os.environ.get('JUJU_AVAILABILITY_ZONE')
11 templating.render('cron/ubuntu-repository-cache_rsync.cron', cron_filename, cron_context)
12 templating.render('cron/ubuntu-repository-cache-config', urc_config_path, cron_context)
13 else:
14
15=== modified file 'templates/cron/ubuntu-repository-cache_rsync.cron'
16--- templates/cron/ubuntu-repository-cache_rsync.cron 2020-10-13 04:38:51 +0000
17+++ templates/cron/ubuntu-repository-cache_rsync.cron 2022-07-27 23:38:36 +0000
18@@ -1,3 +1,7 @@
19+JUJU_MODEL_NAME={{ JujuModelName }}
20+{%- if JujuAvailabilityZone %}
21+JUJU_AVAILABILITY_ZONE={{ JujuAvailabilityZone }}
22+{%- endif %}
23 # This cronjob will make the leader sync its view of the metadata with upstream
24 # It will then trigger a juju-run to let its peers synchronise.
25 {{ Minutes }} * * * * root . {{ ConfigPath }} && run-one {{ CharmEnvPath }} --charm ubuntu-repository-cache python3 -m ubuntu_repository_cache.metadata_sync

Subscribers

People subscribed via source and target branches