summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2008-11-25 19:45:38 -0500
committerTodd Zullinger <tmz@pobox.com>2008-11-25 19:45:38 -0500
commit9ef4071d9c1c25aa1c61b51d81d049ef480c3641 (patch)
tree294f899a1fb2c9ee0d50a6f8eba9b3bd9931ee53
parent082f3ddb1de5fcb6fed301157f747c11adcc1170 (diff)
downloadpuppet-host-package-9ef4071d9c1c25aa1c61b51d81d049ef480c3641.zip
puppet-host-package-9ef4071d9c1c25aa1c61b51d81d049ef480c3641.tar.gz
puppet-host-package-9ef4071d9c1c25aa1c61b51d81d049ef480c3641.tar.xz
Cleanup minor issues pointed out by pychecker
-rw-r--r--puppethost.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/puppethost.py b/puppethost.py
index a00d8d1..c2b1228 100644
--- a/puppethost.py
+++ b/puppethost.py
@@ -24,10 +24,12 @@ defaults = {
'ssldir': ssldir,
'template': '%s/template.spec' % ssldir,
}
+del ssldir
status, domain = commands.getstatusoutput('dnsdomainname')
if status == 0:
defaults['domain'] = domain
+del status
package_types = ['deb', 'rpm']
@@ -63,12 +65,12 @@ class PuppetHost(object):
raise PuppetHostError('Error generating cert for %s: %s' %
(self.hostname, output))
- def package(self, types = ['rpm']):
+ def package(self, packages = ['rpm']):
"""Create packages in requested formats"""
- for type in types:
- if type not in package_types or not hasattr(self, type):
- raise PuppetHostError('Bogus package type: %s' % type)
- try: getattr(self, type)()
+ for package in packages:
+ if package not in package_types or not hasattr(self, package):
+ raise PuppetHostError('Bogus package type: %s' % package)
+ try: getattr(self, package)()
except Exception, error:
print error
continue
@@ -77,14 +79,14 @@ class PuppetHost(object):
"""Create a .deb package"""
raise NotImplementedError('FIXME if you need debian packages.')
- def tar(self, dir = '', keep = False):
+ def tar(self, path = ''):
self._check_files()
- if not dir:
- dir = tempfile.mkdtemp('', 'puppet-host-')
+ if not path:
+ path = tempfile.mkdtemp('', 'puppet-host-')
name = 'puppet-%s-%s' % (self.hostname, self.version)
- tarball = '%s/%s.tar.gz' % (dir, name)
+ tarball = '%s/%s.tar.gz' % (path, name)
if os.path.exists(tarball) and not self.opts['force_tarball']:
raise PuppetHostError('%s exists, not overwriting' % tarball)
@@ -148,7 +150,6 @@ class PuppetHost(object):
def _check_files(self):
"""Check for the files we care about"""
- self.files
self.missing = [f for f in self.files.values()
if not os.path.exists(f)]
if self.missing:
@@ -200,10 +201,6 @@ class PuppetHost(object):
return self._version
def _main():
- import os
- import glob
- import optparse
-
usage = '%prog [options] hostname [hostname ...]'
parser = optparse.OptionParser(usage=usage)
parser.defaults = defaults