Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cloudinit/config/cc_seed_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@
optionally be specified in encoded form, with the encoding specified in
``encoding``.

If the cloud provides its own random seed data, it will be appended to ``data``
before it is written to ``file``.

.. note::
when using a multiline value for ``data`` or specifying binary data, be
sure to follow yaml syntax and use the ``|`` and ``!binary`` yaml format
specifiers when appropriate

Instead of specifying a data string, a command can be run to generate/collect
the data to be written. The command should be specified as a list of args in
the ``command`` key. If a command is specified that cannot be run, no error
will be reported unless ``command_required`` is set to true.
If the ``command`` key is specified, the given command will be executed. This
will happen after ``file`` has been populated. That command's environment will
contain the value of the ``file`` key as ``RANDOM_SEED_FILE``. If a command is
specified that cannot be run, no error will be reported unless
``command_required`` is set to true.

For example, to use ``pollinate`` to gather data from a
remote entropy server and write it to ``/dev/urandom``, the following could be
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/modules/test_seed_random_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class TestSeedRandomData:
@pytest.mark.user_data(USER_DATA)
def test_seed_random_data(self, client):
seed_output = client.read_from_file("/root/seed")
assert seed_output.strip() == "MYUb34023nD:LFDK10913jk;dfnk:Df"
assert seed_output.startswith("MYUb34023nD:LFDK10913jk;dfnk:Df")