Merge remote-tracking branch 'yahoo/master'
This commit is contained in:
commit
6b231348d6
@ -158,33 +158,38 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
||||
def _get_download_locations(self):
|
||||
return list()
|
||||
|
||||
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)
|
||||
def _get_real_download_locations(self):
|
||||
real_locations = list()
|
||||
for info in self._get_download_locations():
|
||||
section, key = info["uri"]
|
||||
uri = self.cfg.get(section, key)
|
||||
target_directory = self.app_dir
|
||||
if 'subdir' in info:
|
||||
target_directory = sh.joinpths(target_directory, info["subdir"])
|
||||
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 %r" % \
|
||||
(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 %r" % \
|
||||
(cfg_helpers.make_id(cfg_section, cfg_key))
|
||||
raise excp.ConfigException(msg)
|
||||
if 'branch' in info:
|
||||
section, key = info['branch']
|
||||
branch = self.cfg.get(section, key)
|
||||
real_locations.append({
|
||||
'uri': uri,
|
||||
'target': target_directory,
|
||||
'branch': branch,
|
||||
})
|
||||
return real_locations
|
||||
|
||||
def download(self):
|
||||
download_am = 0
|
||||
for info in self._get_real_download_locations():
|
||||
# Extract da download!
|
||||
uri = info['uri']
|
||||
target_loc = info['target']
|
||||
branch = info['branch']
|
||||
if not uri or not target_loc:
|
||||
continue
|
||||
# Activate da download!
|
||||
self.tracewriter.download_happened(target_loc, uri)
|
||||
dirs_made = self._do_download(uri, target_loc, branch)
|
||||
download_am += 1
|
||||
# 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
|
||||
@ -193,7 +198,7 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
||||
if target_loc not in dirs_made:
|
||||
dirs_made.append(target_loc)
|
||||
self.tracewriter.dirs_made(*dirs_made)
|
||||
return len(locations)
|
||||
return download_am
|
||||
|
||||
def _do_download(self, uri, target_dir, branch):
|
||||
return down.GitDownloader(self.distro, uri, target_dir, branch).download()
|
||||
@ -287,7 +292,6 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
||||
LOG.info("Configuring file %r", fn)
|
||||
(source_fn, contents) = self._get_source_config(fn)
|
||||
LOG.debug("Replacing parameters in file %r", source_fn)
|
||||
LOG.debug("Replacements = %s", parameters)
|
||||
contents = utils.param_replace(contents, parameters)
|
||||
LOG.debug("Applying side-effects of param replacement for template %r", source_fn)
|
||||
contents = self._config_adjust(contents, fn)
|
||||
@ -314,9 +318,7 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
||||
return len(links)
|
||||
|
||||
def configure(self):
|
||||
conf_am = self._configure_files()
|
||||
conf_am += self._configure_symlinks()
|
||||
return conf_am
|
||||
return self._configure_files() + self._configure_symlinks()
|
||||
|
||||
|
||||
class PythonInstallComponent(PkgInstallComponent):
|
||||
|
@ -161,8 +161,8 @@ def execute(*cmd, **kwargs):
|
||||
else:
|
||||
result = obj.communicate()
|
||||
except OSError as e:
|
||||
error_description = "%s: [%s, %s]" % (e.message, e.errno, e.strerror)
|
||||
raise excp.ProcessExecutionError(description=error_description, cmd=str_cmd)
|
||||
raise excp.ProcessExecutionError(description="%s: [%s, %s]" % (e, e.errno, e.strerror),
|
||||
cmd=str_cmd)
|
||||
if (stdin_fh != subprocess.PIPE
|
||||
and obj.stdin and close_stdin):
|
||||
obj.stdin.close()
|
||||
|
@ -330,9 +330,9 @@ def param_replace(text, replacements, ignore_missing=False):
|
||||
return ""
|
||||
|
||||
if ignore_missing:
|
||||
LOG.debug("Performing parameter replacements (ignoring missing) on text [%s]" % (text))
|
||||
LOG.debug("Performing parameter replacements (ignoring missing) on text %r" % (text))
|
||||
else:
|
||||
LOG.debug("Performing parameter replacements (not ignoring missing) on text [%s]" % (text))
|
||||
LOG.debug("Performing parameter replacements (not ignoring missing) on text %r" % (text))
|
||||
|
||||
possible_params = find_params(text)
|
||||
LOG.debug("Possible replacements are: %r" % (", ".join(possible_params)))
|
||||
@ -341,24 +341,24 @@ def param_replace(text, replacements, ignore_missing=False):
|
||||
def replacer(match):
|
||||
org_txt = match.group(0)
|
||||
param_name = match.group(1)
|
||||
# Check if it's a comment, if so just return what it was and ignore
|
||||
# Check if it's a comment,
|
||||
# if so just return what it was and ignore
|
||||
# any tokens that were there
|
||||
if org_txt.startswith('#'):
|
||||
LOG.debug("Ignoring comment line")
|
||||
return org_txt
|
||||
replacer = replacements.get(param_name)
|
||||
if replacer is None and ignore_missing:
|
||||
replacer = org_txt
|
||||
elif replacer is None and not ignore_missing:
|
||||
msg = "No replacement found for parameter %s" % (org_txt)
|
||||
msg = "No replacement found for parameter %r" % (org_txt)
|
||||
raise excp.NoReplacementException(msg)
|
||||
else:
|
||||
replacer = str(replacer)
|
||||
LOG.debug("Replacing [%s] with [%s]" % (org_txt, replacer))
|
||||
LOG.debug("Replacing %r with %r" % (org_txt, replacer))
|
||||
return replacer
|
||||
|
||||
replaced_text = PARAM_SUB_REGEX.sub(replacer, text)
|
||||
LOG.debug("Replacement/s resulted in text [%s]" % (replaced_text))
|
||||
LOG.debug("Replacement/s resulted in text %r" % (replaced_text))
|
||||
return replaced_text
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ elif [[ `cat /etc/issue | grep -i "red hat enterprise.*release.*6.*"` ]] ; then
|
||||
PKGS="python-pip gcc python-netifaces git python-pep8 pylint python-progressbar python"
|
||||
PIPS="termcolor pyyaml"
|
||||
PIP="pip-python -q"
|
||||
YUM="yum install -q"
|
||||
YUM="yum install -q -y"
|
||||
WGET="wget -q"
|
||||
# Now do it!
|
||||
echo "Preparing DEVSTACKpy for RHEL 6"
|
||||
@ -44,7 +44,7 @@ elif [[ `cat /etc/issue | grep -i "fedora.*release.*16"` ]] ; then
|
||||
PKGS="python-pip gcc python-netifaces git python-pep8 pylint python-yaml python python-progressbar"
|
||||
PIPS="termcolor"
|
||||
PIP="pip-python -q"
|
||||
YUM="yum install -q"
|
||||
YUM="yum install -q -y"
|
||||
# Now do it!
|
||||
echo "Preparing DEVSTACKpy for Fedora 16"
|
||||
echo "Installing packages: $PKGS"
|
||||
|
Loading…
Reference in New Issue
Block a user