summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-09-02 22:52:28 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-09-02 22:52:28 -0700
commitaf2264dd823d2861a470b566c558ac764f255ef4 (patch)
treed8c99ea5b495bcfb3490a14d22af31a9d8b6f079 /cloudinit
parent73863ed53d87e0eb3c24449ef164089531bc9679 (diff)
downloadvyos-cloud-init-af2264dd823d2861a470b566c558ac764f255ef4.tar.gz
vyos-cloud-init-af2264dd823d2861a470b566c558ac764f255ef4.zip
Save only 512 bytes and use different file paths for debian/rhel
LP: #1198297
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/__init__.py5
-rw-r--r--cloudinit/distros/debian.py1
-rw-r--r--cloudinit/distros/rhel.py1
3 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 49b129ae..3c536f2b 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -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
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 8fe49cbe..db4afc76 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -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)
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index 30195384..96df9ae2 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -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)