aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorshnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-03-27 12:29:47 +0000
committershnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-03-27 12:29:47 +0000
commite0428c848ea45a5734a1de96b978c7cd3e6be6c2 (patch)
tree65551414085060334afe8f9ceddc34b3a24bf95c /src/lib
parent59d860d122f069034c26d1a910786e54bdb81a96 (diff)
downloadsos-e0428c848ea45a5734a1de96b978c7cd3e6be6c2.tar.gz
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
Diffstat (limited to 'src/lib')
-rwxr-xr-xsrc/lib/sos/policyredhat.py10
1 files changed, 8 insertions, 2 deletions
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