diff --git a/app/ceph.py b/app/ceph.py index 19c6a2f..a921db6 100644 --- a/app/ceph.py +++ b/app/ceph.py @@ -11,6 +11,14 @@ def ceph(): @click.option("--ceph_url", required=True) @click.option("--ssh_username", required=True) def setup(ceph_url, ssh_username): + ssh_key = "" + with open("~/.ssh/id_rsa.pub") as pubkey: + ssh_key = pubkey.read() + + with open("~/.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 + subprocess.check_output(command.split()) + \ No newline at end of file diff --git a/get_ceph_config.sh b/get_ceph_config.sh deleted file mode 100644 index 3be46fc..0000000 --- a/get_ceph_config.sh +++ /dev/null @@ -1,8 +0,0 @@ -if [ $# -lt 2 ]; then - echo "arg1: username of ceph host (ssh) e.g root" - echo "arg2: url/ip of ceph host e.g ceph-test.llnu.ungleich.cloud" - exit 1 -fi - -mkdir -p /etc/ceph -sftp -b ./ceph_batch_cmd $1@$2:/etc/ceph \ No newline at end of file