diff options
author | Jason Zions (MSFT) <jasonzio@microsoft.com> | 2019-03-26 18:53:50 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-03-26 18:53:50 +0000 |
commit | 0dc3a77f41f4544e4cb5a41637af7693410d4cdf (patch) | |
tree | a1985d3b9ad8e5ba0b835c7d4f79fad683980d88 /tests/data | |
parent | bb0b6f1d4e587d74a6e8fe17fa1c4dc3cf5287f7 (diff) | |
download | vyos-cloud-init-0dc3a77f41f4544e4cb5a41637af7693410d4cdf.tar.gz vyos-cloud-init-0dc3a77f41f4544e4cb5a41637af7693410d4cdf.zip |
Azure: Ensure platform random_seed is always serializable as JSON.
The Azure platform surfaces random bytes into /sys via Hyper-V.
Python 2.7 json.dump() raises an exception if asked to convert
a str with non-character content, and python 3.0 json.dump()
won't serialize a "bytes" value. As a result, c-i instance
data is often not written by Azure, making reboots slower (c-i
has to repeat work).
The random data is base64-encoded and then decoded into a string
(str or unicode depending on the version of Python in use). The
base64 string has just as many bits of entropy, so we're not
throwing away useful "information", but we can be certain
json.dump() will correctly serialize the bits.
Diffstat (limited to 'tests/data')
-rw-r--r-- | tests/data/azure/non_unicode_random_string | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/data/azure/non_unicode_random_string b/tests/data/azure/non_unicode_random_string new file mode 100644 index 00000000..b9ecefb9 --- /dev/null +++ b/tests/data/azure/non_unicode_random_string @@ -0,0 +1 @@ +OEM0d\x00\x00\x00\x01\x80VRTUALMICROSFT\x02\x17\x00\x06MSFT\x97\x00\x00\x00C\xb4{V\xf4X%\x061x\x90\x1c\xfen\x86\xbf~\xf5\x8c\x94&\x88\xed\x84\xf9B\xbd\xd3\xf1\xdb\xee:\xd9\x0fc\x0e\x83(\xbd\xe3'\xfc\x85,\xdf\xf4\x13\x99N\xc5\xf3Y\x1e\xe3\x0b\xa4H\x08J\xb9\xdcdb$
\ No newline at end of file |