forked from ungleich-public/cdist
		
	add ideas about remote exec/copy
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								2157f2a2d0
							
						
					
				
			
			
				commit
				
					
						aa1c13898a
					
				
			
		
					 1 changed files with 45 additions and 0 deletions
				
			
		
							
								
								
									
										45
									
								
								doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
Commands needed:
 | 
			
		||||
   conf/cmd/remote_exec
 | 
			
		||||
   conf/cmd/copy
 | 
			
		||||
 | 
			
		||||
If ! conf/cmd/remote_exec:
 | 
			
		||||
   use builtin
 | 
			
		||||
If ! conf/cmd/copy:
 | 
			
		||||
   use builtin
 | 
			
		||||
 | 
			
		||||
   -> Depend on session!
 | 
			
		||||
 | 
			
		||||
Builtin:
 | 
			
		||||
        cdist.exec.run_or_fail(["scp", "-qr", source, 
 | 
			
		||||
                                self.remote_user + "@" + 
 | 
			
		||||
                                self.target_host + ":" + 
 | 
			
		||||
                                destination])
 | 
			
		||||
 | 
			
		||||
self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host]
 | 
			
		||||
 | 
			
		||||
        self.remote_user = remote_user
 | 
			
		||||
        self.remote_prefix = remote_prefix
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
What is in a session?
 | 
			
		||||
 | 
			
		||||
   base_dir
 | 
			
		||||
   target_host
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
remote_user 
 | 
			
		||||
   pseudo-static, can be hardcoded again
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Result:
 | 
			
		||||
 | 
			
		||||
os.environ['__remote_exec'] = ["ssh", "-l", "root" ]
 | 
			
		||||
os.environ['__remote_copy'] = ["scp", "-o" "User=root" ]
 | 
			
		||||
 | 
			
		||||
args for __remote_exec
 | 
			
		||||
   $1 = hostname
 | 
			
		||||
   $2 - ...  = stuff to be executed in /bin/sh on remote side
 | 
			
		||||
 | 
			
		||||
args for __remote_copy
 | 
			
		||||
   $1 = file here
 | 
			
		||||
   $2 = hostname:destination
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue