a
This commit is contained in:
		
					parent
					
						
							
								f395af457a
							
						
					
				
			
			
				commit
				
					
						bb2ead7ace
					
				
			
		
					 4 changed files with 10 additions and 23 deletions
				
			
		
							
								
								
									
										21
									
								
								app/ceph.py
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								app/ceph.py
									
										
									
									
									
								
							| 
						 | 
					@ -1,21 +0,0 @@
 | 
				
			||||||
import click
 | 
					 | 
				
			||||||
import pysftp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@click.group()
 | 
					 | 
				
			||||||
def ceph():
 | 
					 | 
				
			||||||
    pass
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ceph.command("setup")
 | 
					 | 
				
			||||||
@click.option("--ceph_url", required=True)
 | 
					 | 
				
			||||||
@click.option("--ssh_username", required=True)
 | 
					 | 
				
			||||||
@click.option("--ssh_key_path", required=True, help="For Example, ~/.ssh/id_rsa")
 | 
					 | 
				
			||||||
def setup(ceph_url, ssh_username, ssh_key_path):
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    cnopts = pysftp.CnOpts()
 | 
					 | 
				
			||||||
    cnopts.hostkeys = None    # disable host key checking.
 | 
					 | 
				
			||||||
    with pysftp.Connection(host=ceph_url, username=ssh_username,
 | 
					 | 
				
			||||||
                           private_key=ssh_key_path,
 | 
					 | 
				
			||||||
                           cnopts=cnopts) as sftp:
 | 
					 | 
				
			||||||
        sftp.get_r('/etc/ceph', '/etc/ceph', preserve_mtime=True)
 | 
					 | 
				
			||||||
							
								
								
									
										2
									
								
								ceph_bath_cmd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ceph_bath_cmd
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					lcd /etc/ceph
 | 
				
			||||||
 | 
					get *
 | 
				
			||||||
							
								
								
									
										8
									
								
								get_ceph_config.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								get_ceph_config.sh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					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 $1@$2:/etc/ceph
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,6 @@ from app.scheduler import scheduler
 | 
				
			||||||
from app.host import host
 | 
					from app.host import host
 | 
				
			||||||
from app.image import image
 | 
					from app.image import image
 | 
				
			||||||
from app.file import file_scan
 | 
					from app.file import file_scan
 | 
				
			||||||
from app.ceph import ceph
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@click.group()
 | 
					@click.group()
 | 
				
			||||||
| 
						 | 
					@ -17,7 +16,6 @@ entry_point.add_command(scheduler)
 | 
				
			||||||
entry_point.add_command(host)
 | 
					entry_point.add_command(host)
 | 
				
			||||||
entry_point.add_command(image)
 | 
					entry_point.add_command(image)
 | 
				
			||||||
entry_point.add_command(file_scan)
 | 
					entry_point.add_command(file_scan)
 | 
				
			||||||
entry_point.add_command(ceph)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue