summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2008-11-25 22:13:06 -0500
committerTodd Zullinger <tmz@pobox.com>2008-11-26 00:02:02 -0500
commit08410a381980061e29b442edcf5a45356d3a4284 (patch)
tree9780da5a8ed439f4df7783c9c6d57008f7f56f84
parentd055cb2475b48a0f6bf903faaa2b964e807867f0 (diff)
downloadpuppet-host-package-08410a381980061e29b442edcf5a45356d3a4284.zip
puppet-host-package-08410a381980061e29b442edcf5a45356d3a4284.tar.gz
puppet-host-package-08410a381980061e29b442edcf5a45356d3a4284.tar.xz
Use socket.getfqdn() to set domain name
-rwxr-xr-xpuppethost.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/puppethost.py b/puppethost.py
index 7b1a7f7..15f0478 100755
--- a/puppethost.py
+++ b/puppethost.py
@@ -5,6 +5,7 @@ import os
import glob
import time
import shutil
+import socket
import OpenSSL
import tarfile
import commands
@@ -27,10 +28,10 @@ defaults = {
}
del ssldir
-status, domain = commands.getstatusoutput('dnsdomainname')
-if status == 0:
- defaults['domain'] = domain
-del status
+try:
+ defaults['domain'] = socket.getfqdn().split('.', 1)[1]
+except:
+ pass
config = os.path.expanduser('~/.puppethost')
if os.path.exists(config):