Code review comment for ~jasonzio/cloud-init:randomSeed

Revision history for this message
Jason Zions (jasonzio) wrote :

You're correct, Scott, this is a specific fix in Azure for the python2 issue. The true heart of the issue is "JSON cannot store a random sequence of octets that do not form a legal UTF-8 string", but that is precisely the desired contract for random_seed.

I suggest cloud-init change its internal contract for random_seed to be "datasource provides a base64-encoded string of random octets". cc_random_seed.py should rely upon that and do a base64.b64decode on that value before writing it to /dev/urandom. Instance data persist/restore would work unchanged, since they'd now be dealing with a JSON-safe string. Only the two datasources that provide random_seed would have to change, and that change would look almost exactly like the one I made to the Azure source.

« Back to merge proposal