Exemplo n.º 1
0
 def download(self):
     locations = self._get_download_locations()
     base_dir = self.app_dir
     for location_info in locations:
         uri_tuple = location_info["uri"]
         branch_tuple = location_info.get("branch")
         sub_dir = location_info.get("subdir")
         target_loc = base_dir
         if sub_dir:
             target_loc = sh.joinpths(base_dir, sub_dir)
         branch = None
         if branch_tuple:
             (cfg_section, cfg_key) = branch_tuple
             branch = self.cfg.get(cfg_section, cfg_key)
             if not branch:
                 msg = "No branch entry found at config location [%s]" % (cfg_helpers.make_id(cfg_section, cfg_key))
                 raise excp.ConfigException(msg)
         (cfg_section, cfg_key) = uri_tuple
         uri = self.cfg.get(cfg_section, cfg_key)
         if not uri:
             msg = "No uri entry found at config location [%s]" % (cfg_helpers.make_id(cfg_section, cfg_key))
             raise excp.ConfigException(msg)
         # Activate da download!
         self.tracewriter.download_happened(target_loc, uri)
         dirs_made = self._do_download(uri, target_loc, branch)
         # Here we ensure this is always added so that
         # if a keep old happens then this of course
         # won't be recreated, but if u uninstall without keeping old
         # then this won't be deleted this time around
         # adding it in is harmless and will make sure its removed.
         if target_loc not in dirs_made:
             dirs_made.append(target_loc)
         self.tracewriter.dirs_made(*dirs_made)
     return len(locations)
Exemplo n.º 2
0
 def set(self, section, option, value):
     key = cfg_helpers.make_id(section, option)
     LOG.audit("Setting config value '%s' for param %r" % (value, key))
     self.configs_fetched[key] = value
     if not self.has_section(section):
         self.add_section(section)
     IgnoreMissingConfigParser.set(self, section, option, value)
Exemplo n.º 3
0
 def get(self, section, option):
     key = cfg_helpers.make_id(section, option)
     if key in self.configs_fetched:
         value = self.configs_fetched.get(key)
         LOG.debug("Fetched cached value '%s' for param %r" % (value, key))
     else:
         LOG.debug("Fetching value for param %r" % (key))
         gotten_value = self._get_bashed(section, option)
         value = self._resolve_value(section, option, gotten_value)
         LOG.debug("Fetched %r for %r %s" % (value, key, CACHE_MSG))
         self.configs_fetched[key] = value
     return value
Exemplo n.º 4
0
 def get(self, section, option):
     key = cfg_helpers.make_id(section, option)
     if key in self.configs_fetched:
         value = self.configs_fetched.get(key)
         LOG.debug("Fetched cached value [%s] for param [%s]" % (value, key))
     else:
         LOG.debug("Fetching value for param [%s]" % (key))
         gotten_value = self._get_bashed(section, option)
         value = self._resolve_value(section, option, gotten_value)
         LOG.debug("Fetched [%s] for [%s] %s" % (value, key, CACHE_MSG))
         self.configs_fetched[key] = value
     return value
Exemplo n.º 5
0
 def download(self):
     locations = self._get_download_locations()
     base_dir = self.app_dir
     for location_info in locations:
         uri_tuple = location_info["uri"]
         branch_tuple = location_info.get("branch")
         sub_dir = location_info.get("subdir")
         target_loc = base_dir
         if sub_dir:
             target_loc = sh.joinpths(base_dir, sub_dir)
         branch = None
         if branch_tuple:
             (cfg_section, cfg_key) = branch_tuple
             branch = self.cfg.get(cfg_section, cfg_key)
             if not branch:
                 msg = "No branch entry found at config location [%s]" % \
                     (cfg_helpers.make_id(cfg_section, cfg_key))
                 raise excp.ConfigException(msg)
         (cfg_section, cfg_key) = uri_tuple
         uri = self.cfg.get(cfg_section, cfg_key)
         if not uri:
             msg = "No uri entry found at config location [%s]" % \
                 (cfg_helpers.make_id(cfg_section, cfg_key))
             raise excp.ConfigException(msg)
         # Activate da download!
         self.tracewriter.download_happened(target_loc, uri)
         dirs_made = self._do_download(uri, target_loc, branch)
         # Here we ensure this is always added so that
         # if a keep old happens then this of course
         # won't be recreated, but if u uninstall without keeping old
         # then this won't be deleted this time around
         # adding it in is harmless and will make sure its removed.
         if target_loc not in dirs_made:
             dirs_made.append(target_loc)
         self.tracewriter.dirs_made(*dirs_made)
     return len(locations)
Exemplo n.º 6
0
 def set(self, section, option, value):
     key = cfg_helpers.make_id(section, option)
     LOG.audit("Setting config value '%s' for param %r" % (value, key))
     self.configs_fetched[key] = value
     IgnoreMissingConfigParser.set(self, section, option, value)
Exemplo n.º 7
0
 def set(self, section, option, value):
     key = cfg_helpers.make_id(section, option)
     LOG.audit("Setting config value [%s] for param [%s]" % (value, key))
     self.configs_fetched[key] = value
     IgnoreMissingConfigParser.set(self, section, option, value)