diff --git a/app/__pycache__/api.cpython-37.pyc b/app/__pycache__/api.cpython-37.pyc new file mode 100644 index 0000000..f72a3c4 Binary files /dev/null and b/app/__pycache__/api.cpython-37.pyc differ diff --git a/app/__pycache__/ceph.cpython-37.pyc b/app/__pycache__/ceph.cpython-37.pyc new file mode 100644 index 0000000..9f02800 Binary files /dev/null and b/app/__pycache__/ceph.cpython-37.pyc differ diff --git a/app/__pycache__/file.cpython-37.pyc b/app/__pycache__/file.cpython-37.pyc new file mode 100644 index 0000000..48d9412 Binary files /dev/null and b/app/__pycache__/file.cpython-37.pyc differ diff --git a/app/__pycache__/helper.cpython-37.pyc b/app/__pycache__/helper.cpython-37.pyc new file mode 100644 index 0000000..9b9c09e Binary files /dev/null and b/app/__pycache__/helper.cpython-37.pyc differ diff --git a/app/__pycache__/host.cpython-37.pyc b/app/__pycache__/host.cpython-37.pyc new file mode 100644 index 0000000..d4b1a80 Binary files /dev/null and b/app/__pycache__/host.cpython-37.pyc differ diff --git a/app/__pycache__/image.cpython-37.pyc b/app/__pycache__/image.cpython-37.pyc new file mode 100644 index 0000000..ddc892b Binary files /dev/null and b/app/__pycache__/image.cpython-37.pyc differ diff --git a/app/__pycache__/scheduler.cpython-37.pyc b/app/__pycache__/scheduler.cpython-37.pyc new file mode 100644 index 0000000..b6a9606 Binary files /dev/null and b/app/__pycache__/scheduler.cpython-37.pyc differ diff --git a/app/ceph.py b/app/ceph.py index 6ae26fc..22471e1 100644 --- a/app/ceph.py +++ b/app/ceph.py @@ -11,14 +11,13 @@ def ceph(): @click.option("--ceph_url", required=True) @click.option("--ssh_username", required=True) def setup(ceph_url, ssh_username): - ssh_key = "" - with open(os.path.expanduser("~/.ssh/id_rsa.pub")) as pubkey: - ssh_key = pubkey.read() - - with open(os.path.expanduser("~/.ssh/known_hosts"), "a") as known_hosts: - known_hosts.write(f"{ceph_url} {ssh_key}") - - os.makedirs("/etc/ceph", exist_ok=True) - command = f"sftp -b ./ceph_batch_cmd {ssh_username}@{ceph_url}:/etc/ceph" - subprocess.check_output(command.split()) - \ No newline at end of file + try: + os.makedirs("/etc/ceph", exist_ok=True) + command = f"sftp -b ./ceph_batch_cmd {ssh_username}@{ceph_url}:/etc/ceph" + subprocess.check_output(command.split()) + except Exception: + p = subprocess.check_output(f"ssh-keyscan {ceph_url}".split()) + keys = p.decode("utf-8").strip().split("\n") + with open(os.path.expanduser("~/.ssh/known_hosts", "a")) as known_hosts: + for key in keys: + known_hosts.write(key) \ No newline at end of file diff --git a/meow.txt b/meow.txt new file mode 100644 index 0000000..34ac041 --- /dev/null +++ b/meow.txt @@ -0,0 +1,3 @@ +ceph-test.llnu.ungleich.cloud ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjBr7qEyJ9lJnbFGe0ZKAwTqjYqsjMkuaWWMhhb8SuKDw2WVmxIo2c2U2WjFKiyYgVpnTxXEZKNyiKvqy0WCNdgd9PrbO3/Vb/npv+6LuQ7QBWYopXXFopxfyVF45KeHEBSbHLw+OHgfKNlZ+snUcwosO1G19Qk+Hteh+RWq/KZIOxReGi0ussLFaRbROdyhuI0A/rbCpXTWY/OQluDv4qODPDS7wD9SvV8MsfV+yeXYxjk6wer2a0COG8kOfS0IC7TTQNaj5fpFtLd7UrdseBoFFPYO2ZmaRV8wTKEui+3Ihlt5u0wh7D62tLa01wmETAKw5W7gPtZ6znMOKrLQZZ +ceph-test.llnu.ungleich.cloud ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFcDSX+T1yyCEbgPK9DEh1hiVAh8y+uHz6JOWU/+1HCpoSjsJwDvy0F1PSQEHuEDCBkpOer3UjvgOJzRo3/I0iE= +ceph-test.llnu.ungleich.cloud ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEZ2RrG3VcbFLH7PiGweKtJ7cGQOu39htlcKXt8uT6xb