summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/CloudConfig')
-rw-r--r--cloudinit/CloudConfig/__init__.py6
-rw-r--r--cloudinit/CloudConfig/cc_bootcmd.py2
-rw-r--r--cloudinit/CloudConfig/cc_byobu.py43
-rw-r--r--cloudinit/CloudConfig/cc_chef.py10
-rw-r--r--cloudinit/CloudConfig/cc_grub_dpkg.py3
-rw-r--r--cloudinit/CloudConfig/cc_mcollective.py29
-rw-r--r--cloudinit/CloudConfig/cc_mounts.py9
-rw-r--r--cloudinit/CloudConfig/cc_phone_home.py5
-rw-r--r--cloudinit/CloudConfig/cc_resizefs.py3
-rw-r--r--cloudinit/CloudConfig/cc_set_hostname.py11
-rw-r--r--cloudinit/CloudConfig/cc_ssh.py52
-rw-r--r--cloudinit/CloudConfig/cc_timezone.py1
-rw-r--r--cloudinit/CloudConfig/cc_update_etc_hosts.py53
-rw-r--r--cloudinit/CloudConfig/cc_update_hostname.py2
14 files changed, 153 insertions, 76 deletions
diff --git a/cloudinit/CloudConfig/__init__.py b/cloudinit/CloudConfig/__init__.py
index 91853dfd..82f422fc 100644
--- a/cloudinit/CloudConfig/__init__.py
+++ b/cloudinit/CloudConfig/__init__.py
@@ -25,9 +25,9 @@ import os
import subprocess
import time
-per_instance="once-per-instance"
-per_always="always"
-per_once="once"
+per_instance= cloudinit.per_instance
+per_always = cloudinit.per_always
+per_once = cloudinit.per_once
class CloudConfig():
cfgfile = None
diff --git a/cloudinit/CloudConfig/cc_bootcmd.py b/cloudinit/CloudConfig/cc_bootcmd.py
index 9eccfd78..11e9938c 100644
--- a/cloudinit/CloudConfig/cc_bootcmd.py
+++ b/cloudinit/CloudConfig/cc_bootcmd.py
@@ -18,6 +18,8 @@
import cloudinit.util as util
import subprocess
import tempfile
+from cloudinit.CloudConfig import per_always
+frequency = per_always
def handle(name,cfg,cloud,log,args):
if not cfg.has_key("bootcmd"):
diff --git a/cloudinit/CloudConfig/cc_byobu.py b/cloudinit/CloudConfig/cc_byobu.py
index 1a4545af..406a1f67 100644
--- a/cloudinit/CloudConfig/cc_byobu.py
+++ b/cloudinit/CloudConfig/cc_byobu.py
@@ -27,19 +27,40 @@ def handle(name,cfg,cloud,log,args):
if not value: return
- if value == "user":
- user = util.get_cfg_option_str(cfg,"user","ubuntu")
- cmd = [ 'sudo', '-Hu', user, 'byobu-launcher-install' ]
- elif value == "system":
- shcmd="echo '%s' | debconf-set-selections && %s" % \
- ( "byobu byobu/launch-by-default boolean true",
- "dpkg-reconfigure byobu --frontend=noninteractive" )
- cmd = [ "/bin/sh", "-c", shcmd ]
- else:
+ if value == "user" or value == "system":
+ value = "enable-%s" % value
+
+ valid = ( "enable-user", "enable-system", "enable",
+ "disable-user", "disable-system", "disable" )
+ if not value in valid:
log.warn("Unknown value %s for byobu_by_default" % value)
- return
- log.debug("enabling byobu for %s" % value)
+ mod_user = value.endswith("-user")
+ mod_sys = value.endswith("-system")
+ if value.startswith("enable"):
+ bl_inst = "install"
+ dc_val = "byobu byobu/launch-by-default boolean true"
+ mod_sys = True
+ else:
+ if value == "disable":
+ mod_user = True
+ mod_sys = True
+ bl_inst = "uninstall"
+ dc_val = "byobu byobu/launch-by-default boolean false"
+
+ shcmd = ""
+ if mod_user:
+ user = util.get_cfg_option_str(cfg,"user","ubuntu")
+ shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst)
+ shcmd += " || X=$(($X+1)); "
+ if mod_sys:
+ shcmd += "echo \"%s\" | debconf-set-selections" % dc_val
+ shcmd += " && dpkg-reconfigure byobu --frontend=noninteractive"
+ shcmd += " || X=$(($X+1)); "
+
+ cmd = [ "/bin/sh", "-c", "%s %s %s" % ("X=0;", shcmd, "exit $X" ) ]
+
+ log.debug("setting byobu to %s" % value)
try:
subprocess.check_call(cmd)
diff --git a/cloudinit/CloudConfig/cc_chef.py b/cloudinit/CloudConfig/cc_chef.py
index 8b2cfc2a..5f13c77d 100644
--- a/cloudinit/CloudConfig/cc_chef.py
+++ b/cloudinit/CloudConfig/cc_chef.py
@@ -32,8 +32,9 @@ def handle(name,cfg,cloud,log,args):
chef_cfg = cfg['chef']
# Install chef packages from selected source
+ install_type = util.get_cfg_option_str(chef_cfg, "install_type", "packages")
if not os.path.isfile('/usr/bin/chef-client'):
- if chef_cfg['install_type'] == "gems":
+ if install_type == "gems":
if chef_cfg.has_key('version'):
chef_version = chef_cfg['version']
else:
@@ -48,10 +49,12 @@ def handle(name,cfg,cloud,log,args):
if chef_cfg.has_key('validation_cert'):
with open('/etc/chef/validation.pem', 'w') as validation_cert_fh:
validation_cert_fh.write(chef_cfg['validation_cert'])
-
+
+ validation_name = chef_cfg.get('validation_name','chef-validator')
# create the chef config from template
util.render_to_file('chef_client.rb', '/etc/chef/client.rb',
- {'server_url': chef_cfg['server_url'], 'validation_name': chef_cfg['validation_name'] || 'chef-validator'})
+ {'server_url': chef_cfg['server_url'],
+ 'validation_name': chef_cfg['validation_name']})
chef_args = ['-d']
# set the firstboot json
@@ -65,6 +68,7 @@ def handle(name,cfg,cloud,log,args):
chef_args.append('-j /etc/chef/firstboot.json')
# and finally, run chef
+ log.debug("running chef-client %s" % chef_args)
subprocess.check_call(['/usr/bin/chef-client'] + chef_args)
def install_chef_from_gems(ruby_version, chef_version = None):
diff --git a/cloudinit/CloudConfig/cc_grub_dpkg.py b/cloudinit/CloudConfig/cc_grub_dpkg.py
index dafb43cf..b26e90e8 100644
--- a/cloudinit/CloudConfig/cc_grub_dpkg.py
+++ b/cloudinit/CloudConfig/cc_grub_dpkg.py
@@ -31,7 +31,8 @@ def handle(name,cfg,cloud,log,args):
idevs_empty=util.get_cfg_option_str(cfg["grub-dpkg"],
"grub-pc/install_devices_empty",None)
- if os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda"):
+ if (( os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda") ) or
+ ( os.path.exists("/dev/xvda1") and not os.path.exists("/dev/xvda") )):
if idevs == None: idevs=""
if idevs_empty == None: idevs_empty="true"
else:
diff --git a/cloudinit/CloudConfig/cc_mcollective.py b/cloudinit/CloudConfig/cc_mcollective.py
index 9aae2d64..c7912aa4 100644
--- a/cloudinit/CloudConfig/cc_mcollective.py
+++ b/cloudinit/CloudConfig/cc_mcollective.py
@@ -24,6 +24,10 @@ import fileinput
import StringIO
import ConfigParser
import cloudinit.CloudConfig as cc
+import cloudinit.util as util
+
+pubcert_file = "/etc/mcollective/ssl/server-public.pem"
+pricert_file = "/etc/mcollective/ssl/server-private.pem"
# Our fake header section
class FakeSecHead(object):
@@ -50,24 +54,35 @@ def handle(name,cfg,cloud,log,args):
# Read server.cfg values from original file in order to be able to mix the rest up
mcollective_config.readfp(FakeSecHead(open('/etc/mcollective/server.cfg')))
for cfg_name, cfg in mcollective_cfg['conf'].iteritems():
- # Iterate throug the config items, we'll use ConfigParser.set
- # to overwrite or create new items as needed
- for o, v in cfg.iteritems():
- mcollective_config.set(cfg_name,o,v)
+ if cfg_name == 'public-cert':
+ util.write_file(pubcert_file, cfg, mode=0644)
+ mcollective_config.set(cfg_name,
+ 'plugin.ssl_server_public', pubcert_file)
+ mcollective_config.set(cfg_name,'securityprovider','ssl')
+ elif cfg_name == 'private-cert':
+ util.write_file(pricert_file, cfg, mode=0600)
+ mcollective_config.set(cfg_name,
+ 'plugin.ssl_server_private', pricert_file)
+ mcollective_config.set(cfg_name,'securityprovider','ssl')
+ else:
+ # Iterate throug the config items, we'll use ConfigParser.set
+ # to overwrite or create new items as needed
+ for o, v in cfg.iteritems():
+ mcollective_config.set(cfg_name,o,v)
# We got all our config as wanted we'll rename
# the previous server.cfg and create our new one
os.rename('/etc/mcollective/server.cfg','/etc/mcollective/server.cfg.old')
outputfile = StringIO.StringIO()
mcollective_config.write(outputfile)
# Now we got the whole file, write to disk except first line
- final_configfile = open('/etc/mcollective/server.cfg', 'wb')
# Note below, that we've just used ConfigParser because it generally
# works. Below, we remove the initial 'nullsection' header
# and then change 'key = value' to 'key: value'. The global
# search and replace of '=' with ':' could be problematic though.
# this most likely needs fixing.
- final_configfile.write(outputfile.getvalue().replace('[nullsection]\n','').replace(' =',':'))
- final_configfile.close()
+ util.write_file('/etc/mcollective/server.cfg',
+ outputfile.getvalue().replace('[nullsection]\n','').replace(' =',':'),
+ mode=0644)
# Start mcollective
subprocess.check_call(['service', 'mcollective', 'start'])
diff --git a/cloudinit/CloudConfig/cc_mounts.py b/cloudinit/CloudConfig/cc_mounts.py
index 8ee4f718..592a030a 100644
--- a/cloudinit/CloudConfig/cc_mounts.py
+++ b/cloudinit/CloudConfig/cc_mounts.py
@@ -32,12 +32,13 @@ def is_mdname(name):
return False
def handle(name,cfg,cloud,log,args):
- # these are our default set of mounts
- defmnts = [ [ "ephemeral0", "/mnt", "auto", "defaults,nobootwait", "0", "2" ],
- [ "swap", "none", "swap", "sw", "0", "0" ] ]
-
# fs_spec, fs_file, fs_vfstype, fs_mntops, fs-freq, fs_passno
defvals = [ None, None, "auto", "defaults,nobootwait", "0", "2" ]
+ defvals = cfg.get("mount_default_fields", defvals)
+
+ # these are our default set of mounts
+ defmnts = [ [ "ephemeral0", "/mnt", "auto", defvals[3], "0", "2" ],
+ [ "swap", "none", "swap", "sw", "0", "0" ] ]
cfgmnt = [ ]
if cfg.has_key("mounts"):
diff --git a/cloudinit/CloudConfig/cc_phone_home.py b/cloudinit/CloudConfig/cc_phone_home.py
index be6abfa8..f291e1d4 100644
--- a/cloudinit/CloudConfig/cc_phone_home.py
+++ b/cloudinit/CloudConfig/cc_phone_home.py
@@ -20,7 +20,7 @@ import cloudinit.util as util
from time import sleep
frequency = per_instance
-post_list_all = [ 'pub_key_dsa', 'pub_key_rsa', 'instance_id', 'hostname' ]
+post_list_all = [ 'pub_key_dsa', 'pub_key_rsa', 'pub_key_ecdsa', 'instance_id', 'hostname' ]
# phone_home:
# url: http://my.foo.bar/$INSTANCE/
@@ -29,7 +29,7 @@ post_list_all = [ 'pub_key_dsa', 'pub_key_rsa', 'instance_id', 'hostname' ]
#
# phone_home:
# url: http://my.foo.bar/$INSTANCE_ID/
-# post: [ pub_key_dsa, pub_key_rsa, instance_id
+# post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id
#
def handle(name,cfg,cloud,log,args):
if len(args) != 0:
@@ -61,6 +61,7 @@ def handle(name,cfg,cloud,log,args):
pubkeys = {
'pub_key_dsa': '/etc/ssh/ssh_host_dsa_key.pub',
'pub_key_rsa': '/etc/ssh/ssh_host_rsa_key.pub',
+ 'pub_key_ecdsa': '/etc/ssh/ssh_host_ecdsa_key.pub',
}
for n, path in pubkeys.iteritems():
diff --git a/cloudinit/CloudConfig/cc_resizefs.py b/cloudinit/CloudConfig/cc_resizefs.py
index e396b283..883c269b 100644
--- a/cloudinit/CloudConfig/cc_resizefs.py
+++ b/cloudinit/CloudConfig/cc_resizefs.py
@@ -42,6 +42,9 @@ def handle(name,cfg,cloud,log,args):
dev=os.makedev(os.major(st_dev),os.minor(st_dev))
os.mknod(devpth, 0400 | stat.S_IFBLK, dev)
except:
+ if util.islxc():
+ log.debug("inside lxc, ignoring mknod failure in resizefs")
+ return
log.warn("Failed to make device node to resize /")
raise
diff --git a/cloudinit/CloudConfig/cc_set_hostname.py b/cloudinit/CloudConfig/cc_set_hostname.py
index 49368019..bc190049 100644
--- a/cloudinit/CloudConfig/cc_set_hostname.py
+++ b/cloudinit/CloudConfig/cc_set_hostname.py
@@ -23,21 +23,16 @@ def handle(name,cfg,cloud,log,args):
log.debug("preserve_hostname is set. not setting hostname")
return(True)
+ ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud)
try:
- hostname_prefix = util.get_cfg_option_str(cfg, "hostname_prefix", None)
- hostname_attr = util.get_cfg_option_str(cfg, "hostname_attribute", "hostname")
- hostname_function = getattr(cloud, 'get_' + hostname_attr, None)
- if hostname_fucntion is None: hostname_fucntion = cloud.get_hostname
- hostname = util.get_cfg_option_str(cfg,"hostname", hostname_function)
- if hostname_prefix: hostname = hostname_prefix + "-" + hostname
set_hostname(hostname, log)
except Exception as e:
util.logexc(log)
- log.warn("failed to set hostname\n")
+ log.warn("failed to set hostname to %s\n", hostname)
return(True)
def set_hostname(hostname, log):
- subprocess.Popen(['hostname', hostname]).communicate()
+ util.subp(['hostname', hostname])
util.write_file("/etc/hostname","%s\n" % hostname, 0644)
log.debug("populated /etc/hostname with %s on first boot", hostname)
diff --git a/cloudinit/CloudConfig/cc_ssh.py b/cloudinit/CloudConfig/cc_ssh.py
index c4603d2b..50b6a73c 100644
--- a/cloudinit/CloudConfig/cc_ssh.py
+++ b/cloudinit/CloudConfig/cc_ssh.py
@@ -16,11 +16,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cloudinit.util as util
+import cloudinit.SshUtil as sshutil
import os
import glob
import subprocess
+DISABLE_ROOT_OPTS="no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command=\"echo \'Please login as the user \\\"$USER\\\" rather than the user \\\"root\\\".\';echo;sleep 10\""
+
+
+global_log = None
+
def handle(name,cfg,cloud,log,args):
+ global global_log
+ global_log = log
+
# remove the static keys from the pristine image
for f in glob.glob("/etc/ssh/ssh_host_*_key*"):
try: os.unlink(f)
@@ -32,14 +41,18 @@ def handle(name,cfg,cloud,log,args):
"rsa_private" : ("/etc/ssh/ssh_host_rsa_key", 0600),
"rsa_public" : ("/etc/ssh/ssh_host_rsa_key.pub", 0644),
"dsa_private" : ("/etc/ssh/ssh_host_dsa_key", 0600),
- "dsa_public" : ("/etc/ssh/ssh_host_dsa_key.pub", 0644)
+ "dsa_public" : ("/etc/ssh/ssh_host_dsa_key.pub", 0644),
+ "ecdsa_private" : ("/etc/ssh/ssh_host_ecdsa_key", 0600),
+ "ecdsa_public" : ("/etc/ssh/ssh_host_ecdsa_key.pub", 0644),
}
for key,val in cfg["ssh_keys"].items():
if key2file.has_key(key):
util.write_file(key2file[key][0],val,key2file[key][1])
- priv2pub = { 'rsa_private':'rsa_public', 'dsa_private':'dsa_public' }
+ priv2pub = { 'rsa_private':'rsa_public', 'dsa_private':'dsa_public',
+ 'ecdsa_private': 'ecdsa_public', }
+
cmd = 'o=$(ssh-keygen -yf "%s") && echo "$o" root@localhost > "%s"'
for priv,pub in priv2pub.iteritems():
if pub in cfg['ssh_keys'] or not priv in cfg['ssh_keys']: continue
@@ -50,19 +63,23 @@ def handle(name,cfg,cloud,log,args):
# if not, generate them
genkeys ='ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ""; '
genkeys+='ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ""; '
+ genkeys+='ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -t ecdsa -N ""; '
subprocess.call(('sh', '-c', "{ %s } </dev/null" % (genkeys)))
try:
user = util.get_cfg_option_str(cfg,'user')
disable_root = util.get_cfg_option_bool(cfg, "disable_root", True)
+ disable_root_opts = util.get_cfg_option_str(cfg, "disable_root_opts",
+ DISABLE_ROOT_OPTS)
keys = cloud.get_public_ssh_keys()
if cfg.has_key("ssh_authorized_keys"):
cfgkeys = cfg["ssh_authorized_keys"]
keys.extend(cfgkeys)
- apply_credentials(keys,user,disable_root)
+ apply_credentials(keys,user,disable_root, disable_root_opts)
except:
+ util.logexc(log)
log.warn("applying credentials failed!\n")
send_ssh_keys_to_console()
@@ -70,36 +87,15 @@ def handle(name,cfg,cloud,log,args):
def send_ssh_keys_to_console():
subprocess.call(('/usr/lib/cloud-init/write-ssh-key-fingerprints',))
-def apply_credentials(keys, user, disable_root):
+def apply_credentials(keys, user, disable_root, disable_root_opts=DISABLE_ROOT_OPTS, log=global_log):
keys = set(keys)
if user:
- setup_user_keys(keys, user, '')
+ sshutil.setup_user_keys(keys, user, '', log)
if disable_root:
- key_prefix = 'command="echo \'Please login as the user \\\"%s\\\" rather than the user \\\"root\\\".\';echo;sleep 10" ' % user
+ key_prefix = disable_root_opts.replace('$USER', user)
else:
key_prefix = ''
- setup_user_keys(keys, 'root', key_prefix)
-
-def setup_user_keys(keys, user, key_prefix):
- import pwd
- saved_umask = os.umask(077)
-
- pwent = pwd.getpwnam(user)
-
- ssh_dir = '%s/.ssh' % pwent.pw_dir
- if not os.path.exists(ssh_dir):
- os.mkdir(ssh_dir)
- os.chown(ssh_dir, pwent.pw_uid, pwent.pw_gid)
-
- authorized_keys = '%s/.ssh/authorized_keys' % pwent.pw_dir
- fp = open(authorized_keys, 'a')
- fp.write(''.join(['%s%s\n' % (key_prefix, key) for key in keys]))
- fp.close()
-
- os.chown(authorized_keys, pwent.pw_uid, pwent.pw_gid)
-
- os.umask(saved_umask)
-
+ sshutil.setup_user_keys(keys, 'root', key_prefix, log)
diff --git a/cloudinit/CloudConfig/cc_timezone.py b/cloudinit/CloudConfig/cc_timezone.py
index f221819e..a26df8f9 100644
--- a/cloudinit/CloudConfig/cc_timezone.py
+++ b/cloudinit/CloudConfig/cc_timezone.py
@@ -25,7 +25,6 @@ frequency = per_instance
tz_base = "/usr/share/zoneinfo"
def handle(name,cfg,cloud,log,args):
- print args
if len(args) != 0:
timezone = args[0]
else:
diff --git a/cloudinit/CloudConfig/cc_update_etc_hosts.py b/cloudinit/CloudConfig/cc_update_etc_hosts.py
index 856cbae1..6012b8a3 100644
--- a/cloudinit/CloudConfig/cc_update_etc_hosts.py
+++ b/cloudinit/CloudConfig/cc_update_etc_hosts.py
@@ -17,25 +17,64 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cloudinit.util as util
from cloudinit.CloudConfig import per_always
+import StringIO
frequency = per_always
def handle(name,cfg,cloud,log,args):
- if not util.get_cfg_option_bool(cfg,"manage_etc_hosts",False):
- log.debug("manage_etc_hosts is not set. not modifying /etc/hosts")
+ ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud)
+
+ use_template = util.get_cfg_option_bool(cfg,"manage_etc_hosts", False)
+ if not use_template:
+ # manage_etc_hosts not true, update the 127.0.1.1 entry via update_etc_hosts
+ log.debug("manage_etc_hosts is not set, checking sanity of /etc/hosts")
+ update_etc_hosts(hostname, fqdn, log)
return
+ # manage_etc_hosts is set, render from template file
try:
- hostname = util.get_cfg_option_str(cfg,"hostname",cloud.get_hostname())
- if not hostname:
- hostname = cloud.get_hostname()
-
if not hostname:
log.info("manage_etc_hosts was set, but no hostname found")
return
- util.render_to_file('hosts', '/etc/hosts', { 'hostname' : hostname })
+ util.render_to_file('hosts', '/etc/hosts', \
+ { 'hostname' : hostname, 'fqdn' : fqdn })
except Exception as e:
log.warn("failed to update /etc/hosts")
raise
+
+def update_etc_hosts(hostname, fqdn, log):
+ with open('/etc/hosts', 'r') as etchosts:
+ header = "# Added by cloud-init\n"
+ hosts_line = "127.0.1.1\t%s %s\n" % (fqdn, hostname)
+ need_write = False
+ need_change = True
+ new_etchosts = StringIO.StringIO()
+ for line in etchosts:
+ split_line = [s.strip() for s in line.split()]
+ if len(split_line) < 2:
+ new_etchosts.write(line)
+ continue
+ if line == header:
+ continue
+ ip, hosts = split_line[0], split_line[1:]
+ if ip == "127.0.1.1":
+ if sorted([hostname, fqdn]) == sorted(hosts):
+ need_change = False
+ if need_change == True:
+ line = "%s%s" % (header, hosts_line)
+ need_change = False
+ need_write = True
+ new_etchosts.write(line)
+ etchosts.close()
+ if need_change == True:
+ new_etchosts.write("%s%s" % (header, hosts_line))
+ need_write = True
+ if need_write == True:
+ new_etcfile = open ('/etc/hosts','wb')
+ new_etcfile.write(new_etchosts.getvalue())
+ new_etcfile.close()
+ new_etchosts.close()
+ return
+
diff --git a/cloudinit/CloudConfig/cc_update_hostname.py b/cloudinit/CloudConfig/cc_update_hostname.py
index 9ef02251..3f55c73b 100644
--- a/cloudinit/CloudConfig/cc_update_hostname.py
+++ b/cloudinit/CloudConfig/cc_update_hostname.py
@@ -27,8 +27,8 @@ def handle(name,cfg,cloud,log,args):
log.debug("preserve_hostname is set. not updating hostname")
return
+ ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud)
try:
- hostname = util.get_cfg_option_str(cfg,"hostname",cloud.get_hostname())
prev ="%s/%s" % (cloud.get_cpath('data'),"previous-hostname")
update_hostname(hostname, prev, log)
except Exception as e: