From ee9e56a9d286d34b20bbe3de200872d1eee1af38 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 2 Sep 2013 22:43:51 -0700 Subject: Add config drive support for random_seed A new field in the metadata has emerged, one that provides a way to seed the linux random generator. Add support for writing the seed and rewrite parts of the on_boot code to use a little helper class. LP: #1198297 --- cloudinit/distros/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cloudinit/distros') diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 74e95797..49b129ae 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -52,6 +52,7 @@ class Distro(object): ci_sudoers_fn = "/etc/sudoers.d/90-cloud-init-users" hostname_conf_fn = "/etc/hostname" tz_zone_dir = "/usr/share/zoneinfo" + random_seed_fn = "/var/lib/random-seed" def __init__(self, name, cfg, paths): self._paths = paths @@ -169,6 +170,10 @@ class Distro(object): distros.extend(OSFAMILIES[family]) return distros + def set_random_seed(self, seed): + if self.random_seed_fn: + util.write_file(self.random_seed_fn, seed, mode=0600) + def update_hostname(self, hostname, fqdn, prev_hostname_fn): applying_hostname = hostname -- cgit v1.2.3