summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-09-02 22:56:48 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-09-02 22:56:48 -0700
commit5252152361e0902658f4eb3ded732228a4f96128 (patch)
tree2c7656878691e4c8043731f370812b95b95f5eaa /cloudinit
parentaf2264dd823d2861a470b566c558ac764f255ef4 (diff)
downloadvyos-cloud-init-5252152361e0902658f4eb3ded732228a4f96128.tar.gz
vyos-cloud-init-5252152361e0902658f4eb3ded732228a4f96128.zip
Raise when no seed filename provided
LP: #1198297
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 3c536f2b..8cffb0ee 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -171,9 +171,11 @@ class Distro(object):
return distros
def set_random_seed(self, seed):
- if self.random_seed_fn:
- # Ensure we only write 512 bytes worth
- util.write_file(self.random_seed_fn, seed[0:512], mode=0600)
+ if not self.random_seed_fn:
+ raise IOError("No random seed filename provided for %s"
+ % (self.name))
+ # 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