pass exec_path from context to local, making it obsolete to manually add the argument to the _link_types_for_emulator
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								081d3aea37
							
						
					
				
			
			
				commit
				
					
						6771a13758
					
				
			
		
					 3 changed files with 10 additions and 8 deletions
				
			
		| 
						 | 
					@ -79,7 +79,6 @@ class ConfigInstall(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def stage_prepare(self):
 | 
					    def stage_prepare(self):
 | 
				
			||||||
        """Do everything for a deploy, minus the actual code stage"""
 | 
					        """Do everything for a deploy, minus the actual code stage"""
 | 
				
			||||||
        self.local.link_emulator(self.context.exec_path)
 | 
					 | 
				
			||||||
        self.explorer.run_global_explorers(self.local.global_explorer_out_path)
 | 
					        self.explorer.run_global_explorers(self.local.global_explorer_out_path)
 | 
				
			||||||
        self.manifest.run_initial_manifest(self.context.initial_manifest)
 | 
					        self.manifest.run_initial_manifest(self.context.initial_manifest)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ class Context(object):
 | 
				
			||||||
            self.temp_dir = tempfile.mkdtemp()
 | 
					            self.temp_dir = tempfile.mkdtemp()
 | 
				
			||||||
            self.out_path = os.path.join(self.temp_dir, "out")
 | 
					            self.out_path = os.path.join(self.temp_dir, "out")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.local = local.Local(self.target_host, conf_dirs, self.out_path)
 | 
					        self.local = local.Local(self.target_host, conf_dirs, self.out_path, self.exec_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.initial_manifest = (initial_manifest or
 | 
					        self.initial_manifest = (initial_manifest or
 | 
				
			||||||
            os.path.join(self.local.manifest_path, "init"))
 | 
					            os.path.join(self.local.manifest_path, "init"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,11 +37,13 @@ class Local(object):
 | 
				
			||||||
    Directly accessing the local side from python code is a bug.
 | 
					    Directly accessing the local side from python code is a bug.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    def __init__(self, target_host, conf_dirs, out_path, cache_dir=None):
 | 
					    def __init__(self, target_host, conf_dirs, out_path, exec_path, cache_dir=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.target_host = target_host
 | 
					        self.target_host = target_host
 | 
				
			||||||
        self.add_conf_dirs = conf_dirs
 | 
					 | 
				
			||||||
        self.out_path = out_path
 | 
					        self.out_path = out_path
 | 
				
			||||||
 | 
					        self.exec_path = exec_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self._add_conf_dirs = conf_dirs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._init_log()
 | 
					        self._init_log()
 | 
				
			||||||
        self._init_permissions()
 | 
					        self._init_permissions()
 | 
				
			||||||
| 
						 | 
					@ -88,8 +90,8 @@ class Local(object):
 | 
				
			||||||
            self.conf_dirs.append(user_conf_dir)
 | 
					            self.conf_dirs.append(user_conf_dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Add user supplied directories
 | 
					        # Add user supplied directories
 | 
				
			||||||
        if self.add_conf_dirs:
 | 
					        if self._add_conf_dirs:
 | 
				
			||||||
            self.conf_dirs.extend(self.add_conf_dirs)
 | 
					            self.conf_dirs.extend(self._add_conf_dirs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _init_cache_dir(self, cache_dir):
 | 
					    def _init_cache_dir(self, cache_dir):
 | 
				
			||||||
        if cache_dir:
 | 
					        if cache_dir:
 | 
				
			||||||
| 
						 | 
					@ -146,6 +148,7 @@ class Local(object):
 | 
				
			||||||
    def create_files_dirs(self):
 | 
					    def create_files_dirs(self):
 | 
				
			||||||
        self._create_context_dirs()
 | 
					        self._create_context_dirs()
 | 
				
			||||||
        self._create_conf_path_and_link_conf_dirs()
 | 
					        self._create_conf_path_and_link_conf_dirs()
 | 
				
			||||||
 | 
					        self._link_types_for_emulator()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _create_context_dirs(self):
 | 
					    def _create_context_dirs(self):
 | 
				
			||||||
        self.mkdir(self.out_path)
 | 
					        self.mkdir(self.out_path)
 | 
				
			||||||
| 
						 | 
					@ -185,9 +188,9 @@ class Local(object):
 | 
				
			||||||
                    except OSError as e:
 | 
					                    except OSError as e:
 | 
				
			||||||
                        raise cdist.Error("Linking %s %s to %s failed: %s" % (sub_dir, src, dst, e.__str__()))
 | 
					                        raise cdist.Error("Linking %s %s to %s failed: %s" % (sub_dir, src, dst, e.__str__()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def link_emulator(self, exec_path):
 | 
					    def _link_types_for_emulator(self):
 | 
				
			||||||
        """Link emulator to types"""
 | 
					        """Link emulator to types"""
 | 
				
			||||||
        src = os.path.abspath(exec_path)
 | 
					        src = os.path.abspath(self.exec_path)
 | 
				
			||||||
        for cdist_type in core.CdistType.list_types(self.type_path):
 | 
					        for cdist_type in core.CdistType.list_types(self.type_path):
 | 
				
			||||||
            dst = os.path.join(self.bin_path, cdist_type.name)
 | 
					            dst = os.path.join(self.bin_path, cdist_type.name)
 | 
				
			||||||
            self.log.debug("Linking emulator: %s to %s", src, dst)
 | 
					            self.log.debug("Linking emulator: %s to %s", src, dst)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue