Merge lp:~vila/uci-vms/1328170-final-msg-option into lp:~canonical-ci-engineering/uci-vms/trunk

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: 68
Proposed branch: lp:~vila/uci-vms/1328170-final-msg-option
Merge into: lp:~canonical-ci-engineering/uci-vms/trunk
Diff against target: 69 lines (+24/-5)
4 files modified
NEWS.rst (+6/-0)
ucivms/config.py (+5/-0)
ucivms/tests/test_vms.py (+6/-0)
ucivms/vms.py (+7/-5)
To merge this branch: bzr merge lp:~vila/uci-vms/1328170-final-msg-option
Reviewer Review Type Date Requested Status
Canonical CI Engineering Pending
Review via email: mp+222834@code.launchpad.net

Commit message

Add 'vm.final_message' config option for VM daughter classes with specific needs

Description of the change

uci-engine defines a new class of VM for nova instances and needs a way to specify the cloud-init final message.

This proposal adds a 'vm.final_message' config option to address that.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.rst'
2--- NEWS.rst 2014-06-06 12:29:55 +0000
3+++ NEWS.rst 2014-06-11 16:19:57 +0000
4@@ -4,6 +4,12 @@
5
6 Overview of changes to uci-vms in reverse chronological order.
7
8+0.1.2
9+=====
10+
11+ * Add 'vm.final_message' so VM daughter classes with specific needs can
12+ override (LP: #1328170).
13+
14 0.1.1
15 =====
16
17
18=== modified file 'ucivms/config.py'
19--- ucivms/config.py 2014-06-05 11:35:09 +0000
20+++ ucivms/config.py 2014-06-11 16:19:57 +0000
21@@ -306,3 +306,8 @@
22 default='~ubuntu/bin',
23 help_string='''\
24 Where {vm.uploaded_scripts} are uploaded on the guest.'''))
25+register(options.Option('vm.final_message',
26+ default=None,
27+ help_string='''\
28+The cloud-init final message, a release-specific message is used if
29+none is provided to address compatibility with Ubuntu precise.'''))
30
31=== modified file 'ucivms/tests/test_vms.py'
32--- ucivms/tests/test_vms.py 2014-05-20 12:41:16 +0000
33+++ ucivms/tests/test_vms.py 2014-06-11 16:19:57 +0000
34@@ -284,6 +284,12 @@
35 self.assertEqual('uci-vms finished installing in $UPTIME seconds.',
36 self.ci_data.cloud_config['final_message'])
37
38+ def test_final_message_explicit(self):
39+ self.conf.store._load_from_string('vm.final_message = hello there')
40+ self.ci_data.populate()
41+ self.assertEqual('hello there',
42+ self.ci_data.cloud_config['final_message'])
43+
44 def test_poweroff_precise(self):
45 self.conf.store._load_from_string('vm.release = precise')
46 self.ci_data.populate()
47
48=== modified file 'ucivms/vms.py'
49--- ucivms/vms.py 2014-06-05 11:35:09 +0000
50+++ ucivms/vms.py 2014-06-11 16:19:57 +0000
51@@ -301,11 +301,13 @@
52 self.set('manage_etc_hosts', None, True)
53 self.set('chpasswd', None, dict(expire=False))
54 # Configurable options
55- if self.conf.get('vm.release') == 'precise':
56- # Curse cloud-init lack of compatibility
57- msg = 'uci-vms finished installing in $UPTIME seconds.'
58- else:
59- msg = 'uci-vms finished installing in ${uptime} seconds.'
60+ msg = self.conf.get('vm.final_message')
61+ if msg is None:
62+ if self.conf.get('vm.release') == 'precise':
63+ # Curse cloud-init lack of compatibility
64+ msg = 'uci-vms finished installing in $UPTIME seconds.'
65+ else:
66+ msg = 'uci-vms finished installing in ${uptime} seconds.'
67 self.set('final_message', None, msg)
68 self.set('password', 'vm.password')
69 self.set_list_of_paths('ssh_authorized_keys', 'vm.ssh_authorized_keys')

Subscribers

People subscribed via source and target branches