This patch fixes importing of Red Hat distros that don't have a
.discinfo file.
From 54fdbbc9fdabcc0fe4b1e8f52b4e4885bef26dc9 Mon Sep 17 00:00:00 2001
From: Bill Peck <bpeck(a)redhat.com>
Date: Wed, 10 Dec 2008 14:07:03 -0500
Subject: [PATCH] make get_creation datestamp more robust
---
cobbler/action_import.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index 704effa..f1a8303 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -961,11 +961,15 @@ class RedHatImporter ( BaseImporter ) :
Based on a RedHat tree find the creation timestamp
"""
base = self.get_rootdir()
+ datestamp = float(0)
if os.path.exists("%s/.discinfo" % base):
discinfo = open("%s/.discinfo" % base, "r")
- datestamp = discinfo.read().split("\n")[0]
+ try:
+ datestamp = float(discinfo.read().split("\n")[0])
+ except ValueError:
+ pass
discinfo.close()
- return float(datestamp)
+ return datestamp
def set_variance(self, flavor, major, minor, arch):
--
1.6.0.4