From 045ab4d6b4eb58c34a80786736bb802d0d95a18d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 2 Jul 2018 09:45:10 +0200 Subject: aktualizr: Get latest for PRO-H#2 sprint. --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index ca0bfb6..a2d03f2 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -25,7 +25,7 @@ SRC_URI = " \ file://aktualizr-secondary.socket \ file://aktualizr-serialcan.service \ " -SRCREV = "767098f45e2e05d5bbd817f9b3b3aa44844da8ec" +SRCREV = "61ee18b24271bc97c0f996745860b0c9495c5145" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 4067c543901526d1d039ba97af6550de48b5b423 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Fri, 15 Jun 2018 09:48:32 +0200 Subject: aktualizr: support check-discovery and fix secondary tests. Cherry-pick of 78422f6ca6e5cca90e33ad49aa1b39bb25c527b3 from master. Original commit message follows: Compatibility with latest aktualizr Note that the HsmTests still sometimes fail --- lib/oeqa/selftest/cases/updater.py | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 190d85d..08fb696 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py @@ -554,7 +554,7 @@ class SecondaryTests(OESelftestTestCase): def test_secondary_listening(self): print('Checking aktualizr-secondary service is listening') - stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030') + stdout, stderr, retcode = self.qemu_command('aktualizr-check-discovery') self.assertEqual(retcode, 0, "Unable to connect to secondary") diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index a2d03f2..a6e7dd2 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -15,6 +15,9 @@ RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES RDEPENDS_${PN}_append_class-target = " ${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'u-boot-fw-utils', '')}" RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' aktualizr-uboot-env-rollback', '', d)} " +RDEPENDS_${PN}_append_class-target = " ${PN}-tools " +RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " + PV = "1.0+git${SRCPV}" PR = "7" @@ -85,7 +88,7 @@ do_install_append_class-native () { install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} } -PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-secondary " +PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " FILES_${PN} = " \ ${bindir}/aktualizr \ @@ -116,6 +119,10 @@ FILES_${PN}-host-tools = " \ ${libdir}/sota/sota_uboot_env.toml \ " +FILES_${PN}-tools = " \ + ${bindir}/aktualizr-check-discovery \ + " + FILES_${PN}-secondary = " \ ${bindir}/aktualizr-secondary \ ${libdir}/sota/sota_secondary.toml \ -- cgit v1.2.3-54-g00ecf From 2b7245586e41d59ebb6b24e63bc5668246e42a9d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 6 Jul 2018 15:54:44 +0200 Subject: aktualizr: bump to latest (72abac76184c84b9a5beb0dfbb103a13b9bfb2ae). --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index a6e7dd2..a591aab 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -28,7 +28,7 @@ SRC_URI = " \ file://aktualizr-secondary.socket \ file://aktualizr-serialcan.service \ " -SRCREV = "61ee18b24271bc97c0f996745860b0c9495c5145" +SRCREV = "72abac76184c84b9a5beb0dfbb103a13b9bfb2ae" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 86119ed65491d27c8e6ab87046427328800db1e4 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Wed, 20 Jun 2018 13:26:57 +0200 Subject: Test --running-mode=once --- lib/oeqa/selftest/cases/updater.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 08fb696..ed4d8d7 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py @@ -193,6 +193,49 @@ class AutoProvTests(OESelftestTestCase): 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode()) +class ManualControlTests(OESelftestTestCase): + + def setUpLocal(self): + layer = "meta-updater-qemux86-64" + result = runCmd('bitbake-layers show-layers') + if re.search(layer, result.output) is None: + # Assume the directory layout for finding other layers. We could also + # make assumptions by using 'show-layers', but either way, if the + # layers we need aren't where we expect them, we are out of like. + path = os.path.abspath(os.path.dirname(__file__)) + metadir = path + "/../../../../../" + self.meta_qemu = metadir + layer + runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) + else: + self.meta_qemu = None + self.append_config('MACHINE = "qemux86-64"') + self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') + self.append_config('SYSTEMD_AUTO_ENABLE_aktualizr = "disable"') + self.qemu, self.s = qemu_launch(machine='qemux86-64') + + def tearDownLocal(self): + qemu_terminate(self.s) + if self.meta_qemu: + runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) + + def qemu_command(self, command): + return qemu_send_command(self.qemu.ssh_port, command) + + def test_manual_running_mode_once(self): + """ + Disable the systemd service then run aktualizr manually + """ + sleep(20) + stdout, stderr, retcode = self.qemu_command('aktualizr-info') + self.assertIn(b'Fetched metadata: no', stdout, + 'Aktualizr should not have run yet' + stderr.decode() + stdout.decode()) + + stdout, stderr, retcode = self.qemu_command('aktualizr --running-mode=once') + + stdout, stderr, retcode = self.qemu_command('aktualizr-info') + self.assertIn(b'Fetched metadata: yes', stdout, + 'Aktualizr should have run' + stderr.decode() + stdout.decode()) + class RpiTests(OESelftestTestCase): def setUpLocal(self): -- cgit v1.2.3-54-g00ecf From bb987eea86932bbae9437d3ad2d656a023f1abfa Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 17 Jul 2018 09:31:53 +0200 Subject: aktualizr: bump to latest for PRO-H#3 sprint. --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index a591aab..6096c7b 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -28,7 +28,7 @@ SRC_URI = " \ file://aktualizr-secondary.socket \ file://aktualizr-serialcan.service \ " -SRCREV = "72abac76184c84b9a5beb0dfbb103a13b9bfb2ae" +SRCREV = "e9faff35ffa8c31cbf3c5fb1c3c6ed4f5f50e500" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 76bba03abd7a2c75d0d419d99b5ebdf7ade1818b Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 17 Jul 2018 09:34:06 +0200 Subject: aktualizr: retry garage-sign version check and handle errors better. --- recipes-sota/aktualizr/garage-sign-version.inc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc index f2d04e8..1b89a3d 100644 --- a/recipes-sota/aktualizr/garage-sign-version.inc +++ b/recipes-sota/aktualizr/garage-sign-version.inc @@ -11,8 +11,21 @@ python () { url = url_file.read().decode().strip(' \t\n') + '/health/version' except (KeyError, ValueError, RuntimeError): return - r = urllib.request.urlopen(url) - if r.code != 200: + connected = False + tries = 3 + for i in range(tries): + try: + r = urllib.request.urlopen(url) + if r.code == 200: + connected = True + break + else: + print('Bad return code from server ' + url + ': ' + str(r.code) + + ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') + except urllib.error.URLError as e: + print('Error connecting to server ' + url + ': ' + str(e) + + ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') + if not connected: return resp = r.read().decode('utf-8') j = json.loads(resp) -- cgit v1.2.3-54-g00ecf