summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2008-11-25 22:19:37 -0500
committerTodd Zullinger <tmz@pobox.com>2008-11-26 00:02:06 -0500
commit8a839d63a8efdb3bc9f173c304f444d097ba031c (patch)
tree568bea1be2ea824c7156501428ce9c2869f8fa03
parent060d3b006ac63124cecf0695509dbedf09e88d0e (diff)
downloadpuppet-host-package-8a839d63a8efdb3bc9f173c304f444d097ba031c.zip
puppet-host-package-8a839d63a8efdb3bc9f173c304f444d097ba031c.tar.gz
puppet-host-package-8a839d63a8efdb3bc9f173c304f444d097ba031c.tar.xz
Clean up variable names in rpm methodv0.1
-rwxr-xr-xpuppethost.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/puppethost.py b/puppethost.py
index b980e6a..1d83f7e 100755
--- a/puppethost.py
+++ b/puppethost.py
@@ -124,7 +124,7 @@ class PuppetHost(object):
self._cleanup(tmpdir)
raise
- specfile = '%s/puppet-%s.spec' % (tmpdir, self.hostname)
+ spec = '%s/puppet-%s.spec' % (tmpdir, self.hostname)
text = open(self.opts['template']).read()
text = text.replace('__HOSTNAME__', self.hostname)
@@ -132,14 +132,13 @@ class PuppetHost(object):
text = text.replace('__RELEASE__', self.opts['release'])
text = text.replace('__SSLDIR__', self.opts['destssldir'])
- spec = open(specfile, 'w')
- spec.write(text)
- spec.close()
+ specfp = open(spec, 'w')
+ specfp.write(text)
+ specfp.close()
- build_name_fmt = '%{N}-%{V}-%{R}.%{ARCH}.rpm'
- rpmfilecmd = 'rpm -q --qf "%s/%s" --specfile %s' % (
- rpmdir, build_name_fmt, specfile)
- status, rpm = commands.getstatusoutput(rpmfilecmd)
+ rpm_fmt = '%{N}-%{V}-%{R}.%{ARCH}.rpm'
+ cmd = 'rpm -q --qf "%s/%s" --specfile %s' % (rpmdir, rpm_fmt, spec)
+ status, rpm = commands.getstatusoutput(cmd)
if status:
self._cleanup(tmpdir)
raise PuppetHostError('Failed to get rpm filename:\n%s' % rpm)
@@ -151,13 +150,13 @@ class PuppetHost(object):
if self.opts['verbose']:
print 'Creating rpm...',
- rpmbuild = 'rpmbuild -bb'
- rpmbuild += ' --define "_build_name_fmt %s"' % build_name_fmt
+ cmd = 'rpmbuild -bb'
+ cmd += ' --define "_build_name_fmt %s"' % rpm_fmt
for i in ['_builddir', '_sourcedir', '_specdir', '_srcrpmdir']:
- rpmbuild += ' --define "%s %s"' % (i, tmpdir)
- rpmbuild += ' --define "_rpmdir %s" %s' % (rpmdir, specfile)
+ cmd += ' --define "%s %s"' % (i, tmpdir)
+ cmd += ' --define "_rpmdir %s" %s' % (rpmdir, spec)
- status, output = commands.getstatusoutput(rpmbuild)
+ status, output = commands.getstatusoutput(cmd)
if status or not os.path.exists(rpm):
self._cleanup(tmpdir)
raise PuppetHostError('Error building rpm:\n', output)