diff options
author | Todd Zullinger <tmz@pobox.com> | 2008-11-28 08:59:24 -0500 |
---|---|---|
committer | Todd Zullinger <tmz@pobox.com> | 2008-11-28 08:59:24 -0500 |
commit | 5f531185a3f64897875d4ba38b426de2c68ec1a1 (patch) | |
tree | 8237ab214511cfa4f89fb797a1c3ef9e59b7eb7c /puppethost.py | |
parent | 09464391c18647ce94f1285b667e8c0e7c913083 (diff) | |
download | puppet-host-package-5f531185a3f64897875d4ba38b426de2c68ec1a1.tar.gz puppet-host-package-5f531185a3f64897875d4ba38b426de2c68ec1a1.tar.xz puppet-host-package-5f531185a3f64897875d4ba38b426de2c68ec1a1.zip |
Set version to today's date for generated certs
This saves us from having to extract the date from the certificate
when we have just generated it.
Diffstat (limited to 'puppethost.py')
-rw-r--r-- | puppethost.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/puppethost.py b/puppethost.py index ef09c3c..c1e060a 100644 --- a/puppethost.py +++ b/puppethost.py @@ -20,6 +20,7 @@ version = '.'.join(map(str, version_info)) import os import sys +import time import shutil import socket import tarfile @@ -80,6 +81,8 @@ class PuppetHost(object): self.hostname = hostname self.opts = opts + + self.datefmt = '%Y%m%d' self.debfile = '' self.rpmfile = '' self.tarfile = '' @@ -105,6 +108,8 @@ class PuppetHost(object): if self.opts['verbose']: print 'done' + self._version = time.strftime(self.datefmt) + def package(self, packages = ['rpm']): """Create packages in requested formats""" for package in packages: @@ -246,8 +251,7 @@ class PuppetHost(object): self._version = x509.get_notBefore()[:8] except: # pyOpenSSL < 0.7 lacks load_certificate()... do it the hard way - import time - format = '%Y%m%d' + format = self.datefmt cmd = 'openssl x509 -in %s -text -noout' % cert status, output = commands.getstatusoutput(cmd) if status == 0: |