a
This commit is contained in:
		
					parent
					
						
							
								6066c28ef0
							
						
					
				
			
			
				commit
				
					
						b889dfadb4
					
				
			
		
					 2 changed files with 9 additions and 9 deletions
				
			
		
							
								
								
									
										10
									
								
								app/ceph.py
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								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())
 | 
			
		||||
    subprocess.check_output(command.split())
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue