def __consume_config(self, config_name):
     if config_name in self.configs:
         _config = op_yaml.read_yaml(path=self.configs[config_name])
         for k, v in _config.iteritems():
             _configPath = op_string.resolve_string(
                 data=self.core_variables, string=v)
             self.configs.update({k: _configPath})
 def __consume_core_config(self):
     self.core_variables.update({"_script_source": ROOT_DIR})
     _configSource = os.path.join(ROOT_DIR, "configs")
     self.core_variables.update({"_config_source": _configSource})
     _config = op_yaml.read_yaml(
         path=os.path.join(_configSource, "core.yaml"))
     for k, v in _config["configs"].iteritems():
         self.configs.update({
             k:
             op_string.resolve_string(data=self.core_variables, string=v)
         })
     for k, v in _config["sources"].iteritems():
         self.core_variables.update({
             k:
             op_string.resolve_string(data=self.core_variables, string=v)
         })
 def __consume_template_config(self, key_name):
     if key_name in self.configs:
         _configPath = self.configs.get(key_name)
         for item in op_yaml.read_yaml(path=_configPath):
             for k, v in item.items():
                 _configPath = op_string.resolve_string(
                     data=self.core_variables, string=v)
                 self.core_variables.update({k: _configPath})
 def __consume_miscellaneous_config(self):
     config_name = "miscellaneous"
     if config_name in self.configs:
         _config = op_yaml.read_yaml(path=self.configs[config_name])
         for k, v in _config.iteritems():
             _configPath = op_string.resolve_string(
                 data=self.core_variables, string=v)
             self.configs.update({k: _configPath})
             self.__consume_template_config(key_name=k)
 def __consume_application_config(self):
     self.__consume_config(config_name="application")
     _applicationConfig = self.configs.get("application")
     if _applicationConfig:
         for k, v in op_yaml.read_yaml(
                 path=self.configs["application"]).items():
             _configPath = op_string.resolve_string(
                 data=self.core_variables, string=v)
             self.configs.update({k: _configPath})
             self.__initialise_application(config_path=_configPath)
Example #6
0
def parse_application_environment_config(envs, config, key):
    import platform
    _config = {}
    if "environment" in config:
        if key in config["environment"]:
            for k, v in config["environment"][key].iteritems():
                _variables = []
                for i in v:
                    _variables.append(op_string.resolve_string(data=envs, string=i))
                _config.update({k: _variables})
    return _config
Example #7
0
 def __check_flags(self):
     _resolved = []
     if hasattr(self, "flags"):
         for f in self.flags:
             _resolved.append(
                 op_string.resolve_string(
                     data=self.environment.core_variables, string=f))
         if len(_resolved) > 0:
             return " ".join(_resolved)
         return " ".join(self.flags)
     return ""
Example #8
0
    def __add_single_application_product(self, product, sub_products=None):
        _executable = app_tools.set_executable(
            platform=self.environment.platform, application_name=product)
        _directory = op_string.resolve_string(
            data=self.environment.core_variables,
            string=self.config_data["location"][self.environment.platform])

        self.productName = product
        if sub_products:
            self.subProducts = sub_products
        self.icon = op_string.resolve_string(
            data=self.environment.core_variables,
            string=self.config_data.get("icon"))
        self.executable = _directory.replace(os.sep, "/")
        self.config_data["location"][self.environment.platform] = _directory
        self.versions = app_tools.get_all_application_versions(
            application_path=os.path.join(_directory, _executable))
        self._set_flags(base_name=product)

        if product not in self.environment.apps:
            self.environment.apps.append(product)