diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-09-02 22:43:51 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2013-09-02 22:43:51 -0700 |
commit | ee9e56a9d286d34b20bbe3de200872d1eee1af38 (patch) | |
tree | f72d0daa8da912ae236bef9a3c2190be706742e2 /cloudinit/distros/__init__.py | |
parent | 1d27cd75eaaeef7b72f3be77de24da815c82a825 (diff) | |
download | vyos-cloud-init-ee9e56a9d286d34b20bbe3de200872d1eee1af38.tar.gz vyos-cloud-init-ee9e56a9d286d34b20bbe3de200872d1eee1af38.zip |
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
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r-- | cloudinit/distros/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
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 |