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