From 5252152361e0902658f4eb3ded732228a4f96128 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 2 Sep 2013 22:56:48 -0700 Subject: Raise when no seed filename provided LP: #1198297 --- cloudinit/distros/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cloudinit') 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 -- cgit v1.2.3