Merge lp:~ltrager/maas/lp1571007 into lp:~maas-committers/maas/trunk

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: no longer in the source branch.
Merged at revision: 4968
Proposed branch: lp:~ltrager/maas/lp1571007
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 76 lines (+18/-4)
4 files modified
src/provisioningserver/boot/utils.py (+10/-2)
src/provisioningserver/import_images/boot_resources.py (+5/-1)
src/provisioningserver/import_images/download_descriptions.py (+2/-1)
src/provisioningserver/import_images/download_resources.py (+1/-0)
To merge this branch: bzr merge lp:~ltrager/maas/lp1571007
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+293056@code.launchpad.net

Commit message

Add more logging to the boot image download process

Description of the change

I've added some more logging to the boot download process. I've added logging when boot resources and image descriptions are being downloaded. If a bootloaded fails to download from a mirror the URL the URL tried is now logged and no exception is raised.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Looks good. I think you ought to slightly change the exception handling, but I'm not going to block you on it.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.1 MiB)

The attempt to merge lp:~ltrager/maas/lp1571007 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [93.3 kB]
Hit:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [92.2 kB]
Fetched 185 kB in 0s (416 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-all python3-apt python3-bson python3-convoy python3-coverage python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-mock python3-netaddr python3-netifaces python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.3.dfsg.P4-8).
bind9utils is already the newest version (1:9.10.3.dfsg.P4-8).
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.3.dfsg.P4-8).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/boot/utils.py'
2--- src/provisioningserver/boot/utils.py 2016-03-28 13:54:47 +0000
3+++ src/provisioningserver/boot/utils.py 2016-04-27 18:26:38 +0000
4@@ -23,6 +23,7 @@
5 import urllib.parse
6 import urllib.request
7
8+from provisioningserver.import_images.helpers import maaslog
9 from provisioningserver.utils.fs import tempdir
10 from provisioningserver.utils.shell import call_and_check
11
12@@ -46,8 +47,15 @@
13 # Build a new opener so that the environment is checked for proxy
14 # URLs. Using urllib2.urlopen() means that we'd only be using the
15 # proxies as defined when urlopen() was called the first time.
16- response = urllib.request.build_opener().open(url)
17- return response.read()
18+ try:
19+ response = urllib.request.build_opener().open(url)
20+ return response.read()
21+ except urllib.error.URLError as e:
22+ maaslog.error("Unable to download %s: %s", url, str(e.reason))
23+ raise
24+ except BaseException as e:
25+ maaslog.error("Unable to download %s: %s", url, str(e))
26+ raise
27
28
29 def get_md5sum(data):
30
31=== modified file 'src/provisioningserver/import_images/boot_resources.py'
32--- src/provisioningserver/import_images/boot_resources.py 2016-03-28 13:54:47 +0000
33+++ src/provisioningserver/import_images/boot_resources.py 2016-04-27 18:26:38 +0000
34@@ -95,7 +95,11 @@
35 """
36 for _, boot_method in BootMethodRegistry:
37 if arches.intersection(boot_method.bootloader_arches) != set():
38- boot_method.install_bootloader(destination)
39+ try:
40+ boot_method.install_bootloader(destination)
41+ except BaseException:
42+ maaslog.error(
43+ "Unable to download the %s bootloader.", boot_method.name)
44
45
46 def make_arg_parser(doc):
47
48=== modified file 'src/provisioningserver/import_images/download_descriptions.py'
49--- src/provisioningserver/import_images/download_descriptions.py 2016-04-12 17:36:35 +0000
50+++ src/provisioningserver/import_images/download_descriptions.py 2016-04-27 18:26:38 +0000
51@@ -1,4 +1,4 @@
52-# Copyright 2014-2015 Canonical Ltd. This software is licensed under the
53+# Copyright 2014-2016 Canonical Ltd. This software is licensed under the
54 # GNU Affero General Public License version 3 (see the file LICENSE).
55
56 """Download boot resource descriptions from Simplestreams repo.
57@@ -192,6 +192,7 @@
58 :param keyring: Optional keyring for verifying the repo's signatures.
59 :return: A `BootImageMapping` describing available boot resources.
60 """
61+ maaslog.info("Downloading image descriptions from %s", path)
62 mirror, rpath = path_from_mirror_url(path, None)
63 policy = get_signing_policy(rpath, keyring)
64 reader = UrlMirrorReader(mirror, policy=policy)
65
66=== modified file 'src/provisioningserver/import_images/download_resources.py'
67--- src/provisioningserver/import_images/download_resources.py 2015-12-01 18:12:59 +0000
68+++ src/provisioningserver/import_images/download_resources.py 2016-04-27 18:26:38 +0000
69@@ -225,6 +225,7 @@
70 :param keyring_file: Optional path to a keyring file for verifying
71 signatures.
72 """
73+ maaslog.info("Downloading boot resources from %s", path)
74 writer = RepoWriter(snapshot_path, store, product_mapping)
75 (mirror, rpath) = path_from_mirror_url(path, None)
76 policy = get_signing_policy(rpath, keyring_file)