Save only 512 bytes and use different file paths for debian/rhel

This commit is contained in:
Joshua Harlow 2013-09-02 22:52:28 -07:00
parent 590606e263
commit d6c51fc7fa
3 changed files with 5 additions and 2 deletions

View File

@ -52,7 +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"
random_seed_fn = None
def __init__(self, name, cfg, paths):
self._paths = paths
@ -172,7 +172,8 @@ class Distro(object):
def set_random_seed(self, seed):
if self.random_seed_fn:
util.write_file(self.random_seed_fn, seed, mode=0600)
# Ensure we only write 512 bytes worth
util.write_file(self.random_seed_fn, seed[0:512], mode=0600)
def update_hostname(self, hostname, fqdn, prev_hostname_fn):
applying_hostname = hostname

View File

@ -44,6 +44,7 @@ class Distro(distros.Distro):
network_conf_fn = "/etc/network/interfaces"
tz_conf_fn = "/etc/timezone"
tz_local_fn = "/etc/localtime"
random_seed_fn = "/var/lib/urandom/random-seed"
def __init__(self, name, cfg, paths):
distros.Distro.__init__(self, name, cfg, paths)

View File

@ -49,6 +49,7 @@ class Distro(distros.Distro):
network_script_tpl = '/etc/sysconfig/network-scripts/ifcfg-%s'
resolve_conf_fn = "/etc/resolv.conf"
tz_local_fn = "/etc/localtime"
random_seed_fn = "/var/lib/random-seed"
def __init__(self, name, cfg, paths):
distros.Distro.__init__(self, name, cfg, paths)