ipmlement base_directory
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								ffd7f4b251
							
						
					
				
			
			
				commit
				
					
						c2873a8fa0
					
				
			
		
					 1 changed files with 16 additions and 0 deletions
				
			
		
							
								
								
									
										16
									
								
								bin/cdist
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								bin/cdist
									
										
									
									
									
								
							| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys # argv
 | 
					import sys # argv
 | 
				
			||||||
import subprocess # execute stuff
 | 
					import subprocess # execute stuff
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__cdist_version="2.0.0"
 | 
					__cdist_version="2.0.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +55,20 @@ def cdist_deploy_to(hostname):
 | 
				
			||||||
   logger("info", "Deploying to host", hostname)
 | 
					   logger("info", "Deploying to host", hostname)
 | 
				
			||||||
   init_deploy(hostname)
 | 
					   init_deploy(hostname)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def base_directory():
 | 
				
			||||||
 | 
					   """Returns the directory in which all cdist stuff is based in"""
 | 
				
			||||||
 | 
					   os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
 | 
				
			||||||
 | 
					   return os.getcwd()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def global_explorer_directory():
 | 
				
			||||||
 | 
					   """Returns path to directory containing the global explorers"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def list_global_explorers():
 | 
				
			||||||
 | 
					   """Return list of available explorers"""
 | 
				
			||||||
 | 
					   os.listdir(path=global_explorer_directory())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def explore(hostname, type=''):
 | 
				
			||||||
 | 
					   """Run explorers"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def init_deploy(hostname):
 | 
					def init_deploy(hostname):
 | 
				
			||||||
   logger("info", "Creating clean directory structure")
 | 
					   logger("info", "Creating clean directory structure")
 | 
				
			||||||
| 
						 | 
					@ -75,4 +90,5 @@ if __name__ == "__main__":
 | 
				
			||||||
   hostname=sys.argv[1]
 | 
					   hostname=sys.argv[1]
 | 
				
			||||||
   logger("info", "cdist", __cdist_version, ": Configuring host", hostname)
 | 
					   logger("info", "cdist", __cdist_version, ": Configuring host", hostname)
 | 
				
			||||||
   cdist_deploy_to(hostname)
 | 
					   cdist_deploy_to(hostname)
 | 
				
			||||||
 | 
					   print(base_directory())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue