Merge lp:~smoser/cloud-init/trunk.disable_pollinate into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Scott Moser
Status: Merged
Merged at revision: 1178
Proposed branch: lp:~smoser/cloud-init/trunk.disable_pollinate
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 102 lines (+42/-7)
4 files modified
ChangeLog (+1/-0)
cloudinit/config/cc_seed_random.py (+1/-1)
doc/examples/cloud-config-seed-random.txt (+32/-0)
tests/unittests/test_handler/test_handler_seed_random.py (+8/-6)
To merge this branch: bzr merge lp:~smoser/cloud-init/trunk.disable_pollinate
Reviewer Review Type Date Requested Status
Ryan Harper Approve
Dustin Kirkland  Pending
Review via email: mp+288362@code.launchpad.net

Commit message

No longer run pollinate by default in seed_random

The user can still choose to run pollinate here to seed their
random data. And in an environment with network datasource, that
would be expected to work. However, we do not want to run it any
more from cloud-init because
a.) pollinate's own init system jobs should get it ran before ssh,
    which is the primary purpose of wanting cloud-init to run it.
b.) with a local datasource, there is no network guarantee when
    init_modules run, so pollinate -q would often cause issues then.
c.) cloud-init would run pollinate and log the failure causing
    many cloud-init specific failures that it could do nothing about.

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

LGMT

review: Approve
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

<kirkland> so I'm fine with that cloud-init merge on two conditions
<kirkland> (1) that we verify that pollinate does in fact run before ssh is started
<kirkland> (2) that we verify and provide (perhaps in pollinate.1) instructions on how to modify pollinate's command line arguments or /etc/default/pollinate from cloud-init
<kirkland> as long as those two are okay, then we're good

1178. By Scott Moser

add doc

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2016-03-04 11:27:18 +0000
3+++ ChangeLog 2016-03-08 16:21:09 +0000
4@@ -85,6 +85,7 @@
5 unless it is already a file (LP: #1543025).
6 - Enable password changing via a hashed string [Alex Sirbu]
7 - Added BigStep datasource [Alex Sirbu]
8+ - No longer run pollinate in seed_random (LP: #1554152)
9
10 0.7.6:
11 - open 0.7.6
12
13=== modified file 'cloudinit/config/cc_seed_random.py'
14--- cloudinit/config/cc_seed_random.py 2015-02-11 01:09:34 +0000
15+++ cloudinit/config/cc_seed_random.py 2016-03-08 16:21:09 +0000
16@@ -83,7 +83,7 @@
17 len(seed_data), seed_path)
18 util.append_file(seed_path, seed_data)
19
20- command = mycfg.get('command', ['pollinate', '-q'])
21+ command = mycfg.get('command', None)
22 req = mycfg.get('command_required', False)
23 try:
24 env = os.environ.copy()
25
26=== added file 'doc/examples/cloud-config-seed-random.txt'
27--- doc/examples/cloud-config-seed-random.txt 1970-01-01 00:00:00 +0000
28+++ doc/examples/cloud-config-seed-random.txt 2016-03-08 16:21:09 +0000
29@@ -0,0 +1,32 @@
30+#cloud-config
31+#
32+# random_seed is a dictionary.
33+#
34+# The config module will write seed data from the datasource
35+# to 'file' described below.
36+#
37+# Entries in this dictionary are:
38+# file: the file to write random data to (default is /dev/urandom)
39+# data: this data will be written to 'file' before data from
40+# the datasource
41+# encoding: this will be used to decode 'data' provided.
42+# allowed values are 'encoding', 'raw', 'base64', 'b64'
43+# 'gzip', or 'gz'. Default is 'raw'
44+#
45+# command: execute this command to seed random.
46+# the command will have RANDOM_SEED_FILE in its environment
47+# set to the value of 'file' above.
48+# command_required: default False
49+# if true, and 'command' is not available to be run
50+# then exception is raised and cloud-init will record failure.
51+# Otherwise, only debug error is mentioned.
52+#
53+# Note: command could be ['pollinate',
54+# '--server=http://local.pollinate.server']
55+# which would have pollinate populate /dev/urandom from provided server
56+seed_random:
57+ file: '/dev/urandom'
58+ data: 'my random string'
59+ encoding: 'raw'
60+ command: ['sh', '-c', 'dd if=/dev/urandom of=$RANDOM_SEED_FILE']
61+ command_required: True
62
63=== modified file 'tests/unittests/test_handler/test_handler_seed_random.py'
64--- tests/unittests/test_handler/test_handler_seed_random.py 2016-03-03 22:20:10 +0000
65+++ tests/unittests/test_handler/test_handler_seed_random.py 2016-03-08 16:21:09 +0000
66@@ -170,28 +170,30 @@
67 contents = util.load_file(self._seed_file)
68 self.assertEquals('tiny-tim-was-here-so-was-josh', contents)
69
70- def test_seed_command_not_provided_pollinate_available(self):
71+ def test_seed_command_provided_and_available(self):
72 c = self._get_cloud('ubuntu', {})
73 self.whichdata = {'pollinate': '/usr/bin/pollinate'}
74- cc_seed_random.handle('test', {}, c, LOG, [])
75+ cfg = {'random_seed': {'command': ['pollinate', '-q']}}
76+ cc_seed_random.handle('test', cfg, c, LOG, [])
77
78 subp_args = [f['args'] for f in self.subp_called]
79 self.assertIn(['pollinate', '-q'], subp_args)
80
81- def test_seed_command_not_provided_pollinate_not_available(self):
82+ def test_seed_command_not_provided(self):
83 c = self._get_cloud('ubuntu', {})
84 self.whichdata = {}
85 cc_seed_random.handle('test', {}, c, LOG, [])
86
87 # subp should not have been called as which would say not available
88- self.assertEquals(self.subp_called, list())
89+ self.assertFalse(self.subp_called)
90
91 def test_unavailable_seed_command_and_required_raises_error(self):
92 c = self._get_cloud('ubuntu', {})
93 self.whichdata = {}
94+ cfg = {'random_seed': {'command': ['THIS_NO_COMMAND'],
95+ 'command_required': True}}
96 self.assertRaises(ValueError, cc_seed_random.handle,
97- 'test', {'random_seed': {'command_required': True}},
98- c, LOG, [])
99+ 'test', cfg, c, LOG, [])
100
101 def test_seed_command_and_required(self):
102 c = self._get_cloud('ubuntu', {})