Commit 23cbd1c4 authored by thiolliere's avatar thiolliere
Browse files

factorise code: don't need write_file

parent 9f89d7cc
......@@ -42,7 +42,7 @@ def run(machine, name, timezone, wifi_pwd, kalite, zim_install):
facts_path = facts_dir + "/device_list.fact"
machine.exec_cmd("sudo mkdir --mode 0755 -p %s" % facts_dir)
machine.write_file(facts_path, json.dumps(device_list, indent=4))
machine.exec_cmd("sudo sh -c 'cat > {} <<END_OF_CMD3267\n{}\nEND_OF_CMD3267'".format(facts_path, json.dumps(device_list, indent=4)))
extra_vars = "ideascube_project_name=%s" % name
extra_vars += " timezone=%s" % timezone
......
......@@ -294,13 +294,6 @@ END_OF_CMD""" % second_partition_start
self._logger.step("Resize filesystem")
self.exec_cmd("sudo resize2fs /dev/mmcblk0p2")
def write_file(self, path, content):
# Use cat and then move because `sudo cat` doesn't give priviledge on redirection
# TODO do not force use of sudo: argument: sudo=False
tmp = "/tmp/" + generate_random_name()
self.exec_cmd("cat > {} <<END_OF_CMD\n{}\nEND_OF_CMD".format(tmp, content))
self.exec_cmd("sudo mv {} '{}'".format(tmp, path))
def _reboot(self):
self._logger.std("reboot qemu")
self._shutdown()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment