]> git.apps.os.sepia.ceph.com Git - teuthology.git/commit
task/ssh_keys: use remote.write_file instead misc.create_file 1557/head
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Sat, 5 Sep 2020 09:23:56 +0000 (11:23 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Sun, 6 Sep 2020 17:58:19 +0000 (19:58 +0200)
commit203e966f93fde7ed891d0b37c71a0d2a3830fb13
tree76e003d0848c74f350fdf1f75cee5d2e91423727
parentca86159dda758f4c4890c0983a2c987ed8572c8c
task/ssh_keys: use remote.write_file instead misc.create_file

Because misc.create_file with data arguments creates file,
changes permissions, and later appends the data using
misc.append_lines_to_file, this logic makes the algorythm
above to fail if the file created without write permissions.

    2020-09-05T10:00:32.003 INFO:teuthology.task.ssh_keys:pushing keys to smithi086.front.sepia.ceph.com for ubuntu
    2020-09-05T10:00:32.003 INFO:teuthology.orchestra.run.smithi086:> rm -f -- /home/ubuntu/.ssh/id_rsa
    2020-09-05T10:00:32.046 INFO:teuthology.orchestra.run.smithi086:> touch /home/ubuntu/.ssh/id_rsa && chmod 500 -- /home/ubuntu/.ssh/id_rsa
    2020-09-05T10:00:32.095 INFO:teuthology.orchestra.run.smithi086:> set -ex
    2020-09-05T10:00:32.096 INFO:teuthology.orchestra.run.smithi086:> dd of=/home/ubuntu/.ssh/id_rsa conv=notrunc oflag=append
    2020-09-05T10:00:32.140 INFO:teuthology.orchestra.run.smithi086.stderr:+ dd of=/home/ubuntu/.ssh/id_rsa conv=notrunc oflag=append
    2020-09-05T10:00:32.142 INFO:teuthology.orchestra.run.smithi086.stderr:dd: failed to open '/home/ubuntu/.ssh/id_rsa': Permission denied
    2020-09-05T10:00:32.142 DEBUG:teuthology.orchestra.run:got remote process result: 1

However we have more advanced remote.write_file function now,
which does not have such issues and moreover creates file
with the data provided in a single hop without trying to
download the file locally.

Related-to: 243ff3bbf218102b24ed992e3931bf8c76cdaadd
Related-to: 45aba9cf8d72fd30ca607200694c638cfd240fd8
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/task/ssh_keys.py