]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
mon.py: Use short hostname.
authorGary Lowell <glowell@inktank.com>
Tue, 19 Mar 2013 06:01:37 +0000 (23:01 -0700)
committerGary Lowell <glowell@inktank.com>
Tue, 19 Mar 2013 06:01:37 +0000 (23:01 -0700)
Depending on the system configuration, gethostname can return
either a short name or the fqdn.  Trim the return from
socket.gethostname() to just the hostname.

Signed-off-by: Gary Lowell <gary.lowell@inktank.com>
ceph_deploy/mon.py

index 6ca11d8bf33d5e513ec2d925a7dbbef69a0b89e0..d0e020b73d78f2e3b31c976a0b1a8014d696e00b 100644 (file)
@@ -18,7 +18,7 @@ def create_mon(cluster, monitor_keyring, init):
     import socket
     import subprocess
 
-    hostname = socket.gethostname()
+    hostname = socket.gethostname().split('.')[0]
     path = '/var/lib/ceph/mon/ceph-{hostname}'.format(
         hostname=hostname,
         )
@@ -152,7 +152,7 @@ def destroy_mon(cluster):
     import subprocess
     import socket
 
-    hostname = socket.gethostname()
+    hostname = socket.gethostname().split('.')[0]
     path = '/var/lib/ceph/mon/ceph-{hostname}'.format(
         hostname=hostname,
         )