forked from ungleich-public/cdist
		
	move save_cache into local
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								4758daa037
							
						
					
				
			
			
				commit
				
					
						14a3bf7262
					
				
			
		
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -44,8 +44,7 @@ class ConfigInstall(object):
 | 
				
			||||||
        # Add switch to disable code execution
 | 
					        # Add switch to disable code execution
 | 
				
			||||||
        self.dry_run = False
 | 
					        self.dry_run = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def cleanup(self):
 | 
					    def save_cache(self):
 | 
				
			||||||
        # FIXME: move to local?
 | 
					 | 
				
			||||||
        destination = os.path.join(self.context.local.cache_path, self.context.target_host)
 | 
					        destination = os.path.join(self.context.local.cache_path, self.context.target_host)
 | 
				
			||||||
        self.log.debug("Saving " + self.context.local.out_path + " to " + destination)
 | 
					        self.log.debug("Saving " + self.context.local.out_path + " to " + destination)
 | 
				
			||||||
        if os.path.exists(destination):
 | 
					        if os.path.exists(destination):
 | 
				
			||||||
| 
						 | 
					@ -67,7 +66,7 @@ class ConfigInstall(object):
 | 
				
			||||||
        self.manifest.run_initial_manifest(self.context.initial_manifest)
 | 
					        self.manifest.run_initial_manifest(self.context.initial_manifest)
 | 
				
			||||||
        self.iterate_until_finished()
 | 
					        self.iterate_until_finished()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.cleanup()
 | 
					        self.context.local.save_cache()
 | 
				
			||||||
        self.log.info("Finished successful run in %s seconds", time.time() - start_time)
 | 
					        self.log.info("Finished successful run in %s seconds", time.time() - start_time)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,6 +160,14 @@ class Local(object):
 | 
				
			||||||
        self._create_conf_path_and_link_conf_dirs()
 | 
					        self._create_conf_path_and_link_conf_dirs()
 | 
				
			||||||
        self._link_types_for_emulator()
 | 
					        self._link_types_for_emulator()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def save_cache(self):
 | 
				
			||||||
 | 
					        destination = os.path.join(self.local.cache_path, self.target_host)
 | 
				
			||||||
 | 
					        self.log.debug("Saving " + self.out_path + " to " + destination)
 | 
				
			||||||
 | 
					        if os.path.exists(destination):
 | 
				
			||||||
 | 
					            shutil.rmtree(destination)
 | 
				
			||||||
 | 
					        shutil.move(self.out_path, destination)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _create_context_dirs(self):
 | 
					    def _create_context_dirs(self):
 | 
				
			||||||
        self.mkdir(self.out_path)
 | 
					        self.mkdir(self.out_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue