Merge lp:~blake-rouse/maas/run-curtin-debug into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 4209
Proposed branch: lp:~blake-rouse/maas/run-curtin-debug
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 108 lines (+43/-1)
4 files modified
src/maasserver/forms_settings.py (+10/-0)
src/maasserver/models/config.py (+2/-0)
src/maasserver/preseed.py (+15/-1)
src/maasserver/tests/test_preseed.py (+16/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/run-curtin-debug
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+268368@code.launchpad.net

Commit message

Add configuration option to tell curtin to install with higher verbosity.

This allows a user to set curtin_verbose to True over the API to get more detailed curtin installation logs.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/forms_settings.py'
2--- src/maasserver/forms_settings.py 2015-08-14 13:48:59 +0000
3+++ src/maasserver/forms_settings.py 2015-08-18 18:04:23 +0000
4@@ -319,6 +319,16 @@
5 (IMPORT_RESOURCES_SERVICE_PERIOD.total_seconds() / 60.0))
6 }
7 },
8+ 'curtin_verbose': {
9+ 'default': False,
10+ 'form': forms.BooleanField,
11+ 'form_kwargs': {
12+ 'required': False,
13+ 'label': (
14+ "Run the fast-path installer with higher verbosity. This "
15+ "provides more detail in the installation logs.")
16+ }
17+ },
18 }
19
20
21
22=== modified file 'src/maasserver/models/config.py'
23--- src/maasserver/models/config.py 2015-08-14 13:48:59 +0000
24+++ src/maasserver/models/config.py 2015-08-18 18:04:23 +0000
25@@ -68,6 +68,8 @@
26 # Third Party
27 'enable_third_party_drivers': True,
28 'enable_disk_erasing_on_release': False,
29+ # Curtin.
30+ 'curtin_verbose': False,
31 # # /settings
32 }
33
34
35=== modified file 'src/maasserver/preseed.py'
36--- src/maasserver/preseed.py 2015-08-14 13:48:59 +0000
37+++ src/maasserver/preseed.py 2015-08-18 18:04:23 +0000
38@@ -244,6 +244,19 @@
39 return []
40
41
42+def compose_curtin_verbose_preseed():
43+ """Return the curtin options for the preseed that will tell curtin
44+ to run with high verbosity.
45+ """
46+ if Config.objects.get_config("curtin_verbose"):
47+ return [yaml.safe_dump({
48+ "verbosity": 3,
49+ "showtrace": True,
50+ })]
51+ else:
52+ return []
53+
54+
55 def get_curtin_userdata(node):
56 """Return the curtin user-data.
57
58@@ -257,6 +270,7 @@
59 network_config = compose_curtin_network_preseed_for(node)
60 swap_config = compose_curtin_swap_preseed(node)
61 kernel_config = compose_curtin_kernel_preseed(node)
62+ verbose_config = compose_curtin_verbose_preseed()
63
64 # Get the storage configration if curtin supports custom storage.
65 storage_config = compose_curtin_storage_config(node)
66@@ -271,7 +285,7 @@
67 return pack_install(
68 configs=(
69 [main_config] + reporter_config + storage_config +
70- network_config + swap_config + kernel_config),
71+ network_config + swap_config + kernel_config + verbose_config),
72 args=[installer_url])
73
74
75
76=== modified file 'src/maasserver/tests/test_preseed.py'
77--- src/maasserver/tests/test_preseed.py 2015-08-14 13:48:59 +0000
78+++ src/maasserver/tests/test_preseed.py 2015-08-18 18:04:23 +0000
79@@ -44,6 +44,7 @@
80 compose_curtin_maas_reporter,
81 compose_curtin_network_preseed,
82 compose_curtin_swap_preseed,
83+ compose_curtin_verbose_preseed,
84 compose_enlistment_preseed_url,
85 compose_preseed_url,
86 GENERIC_FILENAME,
87@@ -863,6 +864,21 @@
88 ])
89
90
91+class TestComposeCurtinVerbose(MAASServerTestCase):
92+
93+ def test__returns_empty_when_false(self):
94+ Config.objects.set_config("curtin_verbose", False)
95+ self.assertEqual([], compose_curtin_verbose_preseed())
96+
97+ def test__returns_verbosity_config(self):
98+ Config.objects.set_config("curtin_verbose", True)
99+ preseed = compose_curtin_verbose_preseed()
100+ self.assertEquals({
101+ "verbosity": 3,
102+ "showtrace": True,
103+ }, yaml.load(preseed[0]))
104+
105+
106 class TestComposeCurtinNetworkPreseed(MAASServerTestCase):
107
108 def test__returns_list_of_yaml_strings(self):