This commit is contained in:
ahmadbilalkhalid 2019-08-29 18:31:38 +05:00
parent fcd7e9220b
commit b771ffeae5
9 changed files with 13 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -11,14 +11,13 @@ def ceph():
@click.option("--ceph_url", required=True) @click.option("--ceph_url", required=True)
@click.option("--ssh_username", required=True) @click.option("--ssh_username", required=True)
def setup(ceph_url, ssh_username): def setup(ceph_url, ssh_username):
ssh_key = "" try:
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) os.makedirs("/etc/ceph", exist_ok=True)
command = f"sftp -b ./ceph_batch_cmd {ssh_username}@{ceph_url}:/etc/ceph" command = f"sftp -b ./ceph_batch_cmd {ssh_username}@{ceph_url}:/etc/ceph"
subprocess.check_output(command.split()) 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)

3
meow.txt Normal file
View file

@ -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