Пример #1
0
    def replace_placeholders(self):
        
            tmp_plcholders_map=self.get_placeholders_mapping().items()
            tmp_script_map=self.get_script_order()
            for key, value in  tmp_plcholders_map:
                    for script in tmp_script_map:
                        
                        current_script =  self.run_base_dir + path_sep + script.script_file.replace("/",path_sep)
                        
                        


                        if key == '<dbkit_path>':
                            x = 1
						# Populate the current dir inside the SCRIPT_DIR env.
                        if os.path.isdir(current_script):
                            os.environ["SCRIPT_DIR"] = current_script
                        elif   os.path.isfile(current_script):
                            os.environ["SCRIPT_DIR"] = os.path.dirname(current_script)
                        replaced_value = os.environ.get(value)

                        if not replaced_value:
                            continue
                        while len(config.rec_param_holders(replaced_value)) > 0:    
                            replaced_value = config.replace_string_params(replaced_value,config.rec_param_holders(replaced_value))
                            
                        
                        
                        os.environ[value] = replaced_value
                        replaced_key = key
                        logging.debug("replacing {} with {} in file {} ".format(replaced_key,replaced_value,current_script))
                        self.replace_string_in_path(current_script,replaced_key,replaced_value)
                        logging.debug("replacing {} with {} in file {} ".format(replaced_key,replaced_value,self.activation_dir))
                        self.replace_string_in_path(self.activation_dir,replaced_key,replaced_value)
Пример #2
0
    def replace_placeholders(self):

        tmp_plcholders_map = self.get_placeholders_mapping().items()
        tmp_script_map = self.get_script_order()
        for key, value in tmp_plcholders_map:
            for script in tmp_script_map:

                current_script = self.run_base_dir + path_sep + script.script_file.replace(
                    "/", path_sep)

                if key == '<dbkit_path>':
                    x = 1
# Populate the current dir inside the SCRIPT_DIR env.
                if os.path.isdir(current_script):
                    os.environ["SCRIPT_DIR"] = current_script
                elif os.path.isfile(current_script):
                    os.environ["SCRIPT_DIR"] = os.path.dirname(current_script)
                replaced_value = os.environ.get(value)

                if not replaced_value:
                    continue
                while len(config.rec_param_holders(replaced_value)) > 0:
                    replaced_value = config.replace_string_params(
                        replaced_value,
                        config.rec_param_holders(replaced_value))

                os.environ[value] = replaced_value
                replaced_key = key
                logging.debug("replacing {} with {} in file {} ".format(
                    replaced_key, replaced_value, current_script))
                self.replace_string_in_path(current_script, replaced_key,
                                            replaced_value)
                logging.debug("replacing {} with {} in file {} ".format(
                    replaced_key, replaced_value, self.activation_dir))
                self.replace_string_in_path(self.activation_dir, replaced_key,
                                            replaced_value)
Пример #3
0
 def __init__(self,component_name,component_base_dir,run_base_dir,activation_dir,utility,placehodlers_map,input_data,error_handling):
     self.name = component_name
     self.base_dir = component_base_dir + path_sep + self.name
     self.run_base_dir = run_base_dir 
     if not os.path.isdir(self.base_dir):
         logging.error("Path {} of compnent {} cannot be found ".format(self.base_dir,self.name))
         self.fatal()
     self.utility = utility
     self.placehodlers_map=placehodlers_map
     self.input_data = input_data
     self.activation_dir = activation_dir
     ## Find all input parameters of the utility string
     self.util_params = []
     for util in self.utility:
         self.util_params = self.util_params + config.rec_param_holders(util)
     self.script_order = config.get_script_order(self.base_dir + path_sep + "script_order.cfg")
     self.error_handling = error_handling
Пример #4
0
 def __init__(self, component_name, component_base_dir, run_base_dir,
              activation_dir, utility, placehodlers_map, input_data,
              error_handling):
     self.name = component_name
     self.base_dir = component_base_dir + path_sep + self.name
     self.run_base_dir = run_base_dir
     if not os.path.isdir(self.base_dir):
         logging.error("Path {} of compnent {} cannot be found ".format(
             self.base_dir, self.name))
         self.fatal()
     self.utility = utility
     self.placehodlers_map = placehodlers_map
     self.input_data = input_data
     self.activation_dir = activation_dir
     ## Find all input parameters of the utility string
     self.util_params = []
     for util in self.utility:
         self.util_params = self.util_params + config.rec_param_holders(
             util)
     self.script_order = config.get_script_order(self.base_dir + path_sep +
                                                 "script_order.cfg")
     self.error_handling = error_handling