| 
									
										
										
										
											2011-10-06 13:00:00 +02:00
										 |  |  | Commands needed: | 
					
						
							|  |  |  |    conf/cmd/remote_exec | 
					
						
							|  |  |  |    conf/cmd/copy | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | If ! conf/cmd/remote_exec: | 
					
						
							|  |  |  |    use builtin | 
					
						
							|  |  |  | If ! conf/cmd/copy: | 
					
						
							|  |  |  |    use builtin | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-06 13:20:05 +02:00
										 |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | --cmd-dir? | 
					
						
							|  |  |  | $__cdist_cmd_dir | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2011-10-06 13:00:00 +02:00
										 |  |  |    -> 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" ] | 
					
						
							| 
									
										
										
										
											2011-10-06 13:20:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] | 
					
						
							|  |  |  | os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] | 
					
						
							| 
									
										
										
										
											2011-10-06 13:00:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-06 13:34:28 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | __remote_exec=~/sudossh __remote_copy=... cdist config localhost | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ~/sudossh hostname $@... | 
					
						
							|  |  |  | ~/sudocopy a hostname:b | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ~/chrootssh | 
					
						
							|  |  |  | ~/chrootcopy | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | a) | 
					
						
							|  |  |  |    3 cmd verzeichnnise: cdist, sudo, chroot | 
					
						
							|  |  |  |    pro aufruf variable ändern | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | b) | 
					
						
							|  |  |  |    1 dir, mit zeug | 
					
						
							|  |  |  |    pro aufruf variablen ändern | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | conf/cmd/remote_exec  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-06 13:00:00 +02:00
										 |  |  | args for __remote_exec | 
					
						
							|  |  |  |    $1 = hostname | 
					
						
							|  |  |  |    $2 - ...  = stuff to be executed in /bin/sh on remote side | 
					
						
							| 
									
										
										
										
											2011-10-06 13:20:05 +02:00
										 |  |  |    $2 - $7 = env | 
					
						
							|  |  |  |    $7 - 12 = cmd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-06 13:00:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | args for __remote_copy | 
					
						
							|  |  |  |    $1 = file here | 
					
						
							|  |  |  |    $2 = hostname:destination | 
					
						
							| 
									
										
										
										
											2011-10-06 13:20:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | There needs to be an easy way to change those cmds! | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | Env-Passing: | 
					
						
							|  |  |  |    _a=b test -> test can access $_a | 
					
						
							|  |  |  |    _a=b test $_a -> $1 = "", because _a is *not* set within the shell | 
					
						
							|  |  |  |    _a=b; test -> can access $_a | 
					
						
							|  |  |  |    _a=b; test $_a -> $1 == "b" |