Merge ~andersson123/autopkgtest-cloud:update-deps-mojo-run-move-pkgs-to-basic into autopkgtest-cloud:master

Proposed by Tim Andersson
Status: Merged
Merged at revision: 04ef28c1b00f8e674a5903d3fe882bd81b7912e7
Proposed branch: ~andersson123/autopkgtest-cloud:update-deps-mojo-run-move-pkgs-to-basic
Merge into: autopkgtest-cloud:master
Diff against target: 81 lines (+18/-4)
4 files modified
charms/focal/autopkgtest-cloud-worker/layer.yaml (+1/-3)
charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py (+7/-0)
charms/focal/autopkgtest-web/layer.yaml (+2/-1)
charms/focal/autopkgtest-web/reactive/autopkgtest_web.py (+8/-0)
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Review via email: mp+456171@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote :

Needs testing, setting to WIP

Revision history for this message
Tim Andersson (andersson123) wrote :

I tested this and it works. Please review.

Revision history for this message
Paride Legovini (paride) wrote :

I like this, but I'm puzzled by the move of packages from "apt" to "basic". Do we actually need that? Looks like apt.needs_update and apt.queued_installs (which you leverage to trigger an upgrade) are part of the apt layer:

  https://github.com/stub42/layer-apt

so AIUI it's the apt layer performing the update/upgrade operation.

Does this work if we keep packages under apt?

review: Needs Information
Revision history for this message
Tim Andersson (andersson123) wrote :

I don't really have that information, I was just told by IS DevOps team that this is how you should do it:
https://chat.canonical.com/canonical/pl/gf9gcar9x781umexmnozxynhdw

I can test if it works with packages just under apt, however

Revision history for this message
Tim Andersson (andersson123) wrote :

Yeah, I tested it, and unfortunately, they must be under basic.packages.

I'm not sure why.

I'll leave the MP as is.

Revision history for this message
Paride Legovini (paride) wrote :

Admittedly I'm not that confident about all the moving parts here, but this looks good.

review: Approve
Revision history for this message
Tim Andersson (andersson123) wrote :

awesome, thanks paride :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-cloud-worker/layer.yaml b/charms/focal/autopkgtest-cloud-worker/layer.yaml
2index 4aeb04d..692d9af 100644
3--- a/charms/focal/autopkgtest-cloud-worker/layer.yaml
4+++ b/charms/focal/autopkgtest-cloud-worker/layer.yaml
5@@ -10,9 +10,6 @@ options:
6 - gir1.2-glib-2.0
7 - python3-gi
8 - python3-pygit2
9- include_system_packages: true
10- apt:
11- packages:
12 - bsd-mailx
13 - dctrl-tools
14 - distro-info
15@@ -32,3 +29,4 @@ options:
16 - python3-openstackclient
17 - python3-swiftclient
18 - ssmtp
19+ include_system_packages: true
20diff --git a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
21index 2095e42..f39705d 100644
22--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
23+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
24@@ -184,6 +184,13 @@ def daemon_reload():
25 clear_flag("autopkgtest.daemon-reload-needed")
26
27
28+@hook("upgrade-charm")
29+def install_apt_packages():
30+ """Install packages defined in layer.yaml"""
31+ set_flag("apt.needs_update")
32+ clear_flag("apt.queued_installs")
33+
34+
35 @hook("install")
36 def enable_persistent_journal():
37 try:
38diff --git a/charms/focal/autopkgtest-web/layer.yaml b/charms/focal/autopkgtest-web/layer.yaml
39index 1afa35d..5c81bdb 100644
40--- a/charms/focal/autopkgtest-web/layer.yaml
41+++ b/charms/focal/autopkgtest-web/layer.yaml
42@@ -6,7 +6,7 @@ includes:
43 - 'interface:rabbitmq'
44 - 'interface:apache-website'
45 options:
46- apt:
47+ basic:
48 packages:
49 - amqp-tools
50 - distro-info
51@@ -21,3 +21,4 @@ options:
52 - python3-flask-openid
53 - python3-swiftclient
54 - python3-werkzeug
55+ include_system_packages: true
56diff --git a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
57index 842348b..db60fcb 100644
58--- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
59+++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
60@@ -8,6 +8,7 @@ from charmhelpers.core.hookenv import charm_dir, config
61 from charms.layer import status
62 from charms.reactive import (
63 clear_flag,
64+ hook,
65 set_flag,
66 when,
67 when_all,
68@@ -25,6 +26,13 @@ SWIFT_WEB_CREDENTIALS_PATH = os.path.expanduser(
69 )
70
71
72+@hook("upgrade-charm")
73+def install_apt_packages():
74+ """Install packages defined in layer.yaml"""
75+ set_flag("apt.needs_update")
76+ clear_flag("apt.queued_installs")
77+
78+
79 @when_not("autopkgtest-web.autopkgtest_web_symlinked")
80 def symlink_autopkgtest_cloud():
81 try:

Subscribers

People subscribed via source and target branches