More config reworkings and checks on configs for downloading that are needed...
This commit is contained in:
parent
503da8aba9
commit
68d9451e4f
@ -79,6 +79,15 @@ class IgnoreMissingConfigParser(ConfigParser.RawConfigParser):
|
||||
return ConfigParser.RawConfigParser.getint(self, section, option)
|
||||
|
||||
|
||||
def make_id(section, option):
|
||||
joinwhat = []
|
||||
if section is not None:
|
||||
joinwhat.append(str(section))
|
||||
if option is not None:
|
||||
joinwhat.append(str(option))
|
||||
return "/".join(joinwhat)
|
||||
|
||||
|
||||
class StackConfigParser(IgnoreMissingConfigParser):
|
||||
def __init__(self):
|
||||
IgnoreMissingConfigParser.__init__(self)
|
||||
@ -86,16 +95,8 @@ class StackConfigParser(IgnoreMissingConfigParser):
|
||||
self.configs_fetched = dict()
|
||||
self.db_dsns = dict()
|
||||
|
||||
def _make_key(self, section, option):
|
||||
joinwhat = []
|
||||
if section is not None:
|
||||
joinwhat.append(str(section))
|
||||
if option is not None:
|
||||
joinwhat.append(str(option))
|
||||
return "/".join(joinwhat)
|
||||
|
||||
def _resolve_value(self, section, option, value_gotten, auto_pw):
|
||||
key = self._make_key(section, option)
|
||||
key = make_id(section, option)
|
||||
if section in PW_SECTIONS and key not in self.pws and value_gotten:
|
||||
self.pws[key] = value_gotten
|
||||
if section == 'host' and option == 'ip':
|
||||
@ -116,7 +117,7 @@ class StackConfigParser(IgnoreMissingConfigParser):
|
||||
return val
|
||||
|
||||
def get(self, section, option, auto_pw=True):
|
||||
key = self._make_key(section, option)
|
||||
key = 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))
|
||||
|
@ -14,6 +14,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import downloader as down
|
||||
from devstack import exceptions as excp
|
||||
from devstack import log as logging
|
||||
@ -98,17 +99,21 @@ class PkgInstallComponent(ComponentBase):
|
||||
uri_tuple = location_info["uri"]
|
||||
branch_tuple = location_info.get("branch")
|
||||
subdir = location_info.get("subdir")
|
||||
target_loc = None
|
||||
target_loc = base_dir
|
||||
if subdir:
|
||||
target_loc = sh.joinpths(base_dir, subdir)
|
||||
else:
|
||||
target_loc = base_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.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.make_id(cfg_section, cfg_key))
|
||||
raise excp.ConfigException(msg)
|
||||
self.tracewriter.download_happened(target_loc, uri)
|
||||
dirs_made = down.download(target_loc, uri, branch)
|
||||
#ensure this is always added so that
|
||||
|
Loading…
Reference in New Issue
Block a user