diff options
author | Todd Zullinger <tmz@pobox.com> | 2008-11-26 11:19:28 -0500 |
---|---|---|
committer | Todd Zullinger <tmz@pobox.com> | 2008-11-26 11:26:32 -0500 |
commit | cf3bf1ce8951455c50de7b1f22aa17e693cc0785 (patch) | |
tree | 37cda5d88381c413f3895487eb65a9c3f770c14c | |
parent | ac857ef91ee4138fa868264115efb72ee8b8c261 (diff) | |
download | puppet-host-package-cf3bf1ce8951455c50de7b1f22aa17e693cc0785.tar.gz puppet-host-package-cf3bf1ce8951455c50de7b1f22aa17e693cc0785.tar.xz puppet-host-package-cf3bf1ce8951455c50de7b1f22aa17e693cc0785.zip |
Improve verbose output a littlev0.3
-rwxr-xr-x | puppethost.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/puppethost.py b/puppethost.py index f524c37..eae1e8e 100755 --- a/puppethost.py +++ b/puppethost.py @@ -2,6 +2,7 @@ """Create a host-specific package for bootstrapping a puppet.""" import os +import sys import glob import time import shutil @@ -65,7 +66,8 @@ class PuppetHost(object): raise PuppetHostError('%s exists, not overwriting' % cert) if self.opts['verbose']: - print 'Generating %s' % cert + print 'Generating certificate (%s)...' % cert, + sys.stdout.flush() cmd = 'puppetca --generate --ssldir %s %s' % (ssldir, self.hostname) status, output = commands.getstatusoutput(cmd) @@ -73,6 +75,9 @@ class PuppetHost(object): raise PuppetHostError('Error generating cert for %s: %s' % (self.hostname, output)) + if self.opts['verbose']: + print 'done' + def package(self, packages = ['rpm']): """Create packages in requested formats""" for package in packages: @@ -100,7 +105,8 @@ class PuppetHost(object): raise PuppetHostError('%s exists, not overwriting' % tarball) if self.opts['verbose']: - print 'Creating tarball...', + print 'Creating tarball (%s)...' % tarball, + sys.stdout.flush() tar = tarfile.open(tarball, 'w:gz') tar.dereference = True @@ -111,7 +117,7 @@ class PuppetHost(object): self.tarfile = tarball if self.opts['verbose']: - print tarball + print 'done' def rpm(self): """Create a .rpm package""" @@ -148,7 +154,8 @@ class PuppetHost(object): raise PuppetHostError('%s exists, not overwriting' % rpm) if self.opts['verbose']: - print 'Creating rpm...', + print 'Creating rpm (%s)...' % rpm, + sys.stdout.flush() cmd = 'rpmbuild -bb' cmd += ' --define "_build_name_fmt %s"' % rpm_fmt @@ -162,7 +169,7 @@ class PuppetHost(object): raise PuppetHostError('Error building rpm:\n', output) if self.opts['verbose']: - print rpm + print 'done' self._cleanup(tmpdir) self.rpmfile = rpm |