+ session_file_path = "{}/{}/session".format(SYSIMG_PATH, PLCONF_DIR)
+ session_file = file(session_file_path, "w")
+ session_file.write(str(NODE_SESSION))
+ session_file.close()
+ session_file = None
+ log.write("Updated /etc/planetlab/session\n")
+ except IOError as e:
+ log.write("Unable to write out /etc/planetlab/session, continuing anyway\n")
+
+ # update configuration files
+ log.write("Updating configuration files.\n")
+ # avoid using conf_files initscript as we're moving to systemd on some platforms
+
+ if (vars['ONE_PARTITION'] != '1'):
+ try:
+ # used to call /usr/bin/env python here, but as nodemanager
+ # now exists both in python2 and python3, we use a shebang
+ # in conf_files instead
+ cmd = "/usr/share/NodeManager/conf_files.py --noscripts"
+ utils.sysexec_chroot(SYSIMG_PATH, cmd, log)
+ except IOError as e:
+ log.write("conf_files failed with \n {}".format(e))
+
+ # update node packages
+ #log.write("Running node update.\n")
+ #if os.path.exists(SYSIMG_PATH + "/usr/bin/NodeUpdate.py"):
+ # cmd = "/usr/bin/NodeUpdate.py start noreboot"
+ #else:
+ # for backwards compatibility
+ # cmd = "/usr/local/planetlab/bin/NodeUpdate.py start noreboot"
+ #utils.sysexec_chroot(SYSIMG_PATH, cmd, log)
+ log.write("NodeUpdate skipped\n")
+
+ # Re-generate initrd right before kexec call
+ # this is not required anymore on recent depls.
+ if vars['virt'] == 'vs':
+ MakeInitrd.Run(vars, log)
+
+ # the following step should be done by NM
+ UpdateNodeConfiguration.Run(vars, log)
+
+ log.write("Updating ssh public host key with PLC.\n")
+ ssh_host_key = ""
+ try:
+ ssh_host_key_file = file("{}/etc/ssh/ssh_host_rsa_key.pub".format(SYSIMG_PATH), "r")
+ ssh_host_key = ssh_host_key_file.read().strip()