From e0428c848ea45a5734a1de96b978c7cd3e6be6c2 Mon Sep 17 00:00:00 2001 From: shnavid Date: Tue, 27 Mar 2007 12:29:47 +0000 Subject: Beautified console output. Added a random suffix to sosreport tree to avoid overwriting an existing tree with same name. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@103 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/lib/sos/policyredhat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py index f5582356..08e0f9b3 100755 --- a/src/lib/sos/policyredhat.py +++ b/src/lib/sos/policyredhat.py @@ -22,6 +22,7 @@ import sys import string from tempfile import gettempdir from sos.helpers import * +import random SOME_PATH = "/tmp/SomePath" @@ -89,14 +90,17 @@ class SosPolicy: namestr = name + "." + ticketNumber else: namestr = name + ourtempdir = gettempdir() tarballName = os.path.join(ourtempdir, namestr + ".tar.bz2") + namestr = namestr + "-" + str(random.randint(1, 999999)) + aliasdir = os.path.join(ourtempdir, namestr) tarcmd = "/bin/tar -jcf %s %s" % (tarballName, namestr) - print "Creating tar file..." + print "Creating compressed tar archive..." if not os.access(string.split(tarcmd)[0], os.X_OK): print "Unable to create tarball" return @@ -112,6 +116,8 @@ class SosPolicy: os.chdir(curwd) os.system("/bin/mv %s %s" % (aliasdir, self.cInfo['dstroot'])) - print "Your tarball is located at %s" % tarballName + sys.stdout.write("\n") + print "Your sosreport has been generated and saved in %s" % tarballName + sys.stdout.write("\n") return -- cgit