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):
|
def _get_download_locations(self):
|
||||||
return list()
|
return list()
|
||||||
|
|
||||||
def download(self):
|
def _get_real_download_locations(self):
|
||||||
locations = self._get_download_locations()
|
real_locations = list()
|
||||||
base_dir = self.app_dir
|
for info in self._get_download_locations():
|
||||||
for location_info in locations:
|
section, key = info["uri"]
|
||||||
uri_tuple = location_info["uri"]
|
uri = self.cfg.get(section, key)
|
||||||
branch_tuple = location_info.get("branch")
|
target_directory = self.app_dir
|
||||||
sub_dir = location_info.get("subdir")
|
if 'subdir' in info:
|
||||||
target_loc = base_dir
|
target_directory = sh.joinpths(target_directory, info["subdir"])
|
||||||
if sub_dir:
|
|
||||||
target_loc = sh.joinpths(base_dir, sub_dir)
|
|
||||||
branch = None
|
branch = None
|
||||||
if branch_tuple:
|
if 'branch' in info:
|
||||||
(cfg_section, cfg_key) = branch_tuple
|
section, key = info['branch']
|
||||||
branch = self.cfg.get(cfg_section, cfg_key)
|
branch = self.cfg.get(section, key)
|
||||||
if not branch:
|
real_locations.append({
|
||||||
msg = "No branch entry found at config location %r" % \
|
'uri': uri,
|
||||||
(cfg_helpers.make_id(cfg_section, cfg_key))
|
'target': target_directory,
|
||||||
raise excp.ConfigException(msg)
|
'branch': branch,
|
||||||
(cfg_section, cfg_key) = uri_tuple
|
})
|
||||||
uri = self.cfg.get(cfg_section, cfg_key)
|
return real_locations
|
||||||
if not uri:
|
|
||||||
msg = "No uri entry found at config location %r" % \
|
def download(self):
|
||||||
(cfg_helpers.make_id(cfg_section, cfg_key))
|
download_am = 0
|
||||||
raise excp.ConfigException(msg)
|
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!
|
# Activate da download!
|
||||||
self.tracewriter.download_happened(target_loc, uri)
|
self.tracewriter.download_happened(target_loc, uri)
|
||||||
dirs_made = self._do_download(uri, target_loc, branch)
|
dirs_made = self._do_download(uri, target_loc, branch)
|
||||||
|
download_am += 1
|
||||||
# Here we ensure this is always added so that
|
# Here we ensure this is always added so that
|
||||||
# if a keep old happens then this of course
|
# if a keep old happens then this of course
|
||||||
# won't be recreated, but if u uninstall without keeping old
|
# 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:
|
if target_loc not in dirs_made:
|
||||||
dirs_made.append(target_loc)
|
dirs_made.append(target_loc)
|
||||||
self.tracewriter.dirs_made(*dirs_made)
|
self.tracewriter.dirs_made(*dirs_made)
|
||||||
return len(locations)
|
return download_am
|
||||||
|
|
||||||
def _do_download(self, uri, target_dir, branch):
|
def _do_download(self, uri, target_dir, branch):
|
||||||
return down.GitDownloader(self.distro, uri, target_dir, branch).download()
|
return down.GitDownloader(self.distro, uri, target_dir, branch).download()
|
||||||
@ -287,7 +292,6 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
|||||||
LOG.info("Configuring file %r", fn)
|
LOG.info("Configuring file %r", fn)
|
||||||
(source_fn, contents) = self._get_source_config(fn)
|
(source_fn, contents) = self._get_source_config(fn)
|
||||||
LOG.debug("Replacing parameters in file %r", source_fn)
|
LOG.debug("Replacing parameters in file %r", source_fn)
|
||||||
LOG.debug("Replacements = %s", parameters)
|
|
||||||
contents = utils.param_replace(contents, parameters)
|
contents = utils.param_replace(contents, parameters)
|
||||||
LOG.debug("Applying side-effects of param replacement for template %r", source_fn)
|
LOG.debug("Applying side-effects of param replacement for template %r", source_fn)
|
||||||
contents = self._config_adjust(contents, fn)
|
contents = self._config_adjust(contents, fn)
|
||||||
@ -314,9 +318,7 @@ class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
|
|||||||
return len(links)
|
return len(links)
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
conf_am = self._configure_files()
|
return self._configure_files() + self._configure_symlinks()
|
||||||
conf_am += self._configure_symlinks()
|
|
||||||
return conf_am
|
|
||||||
|
|
||||||
|
|
||||||
class PythonInstallComponent(PkgInstallComponent):
|
class PythonInstallComponent(PkgInstallComponent):
|
||||||
|
@ -161,8 +161,8 @@ def execute(*cmd, **kwargs):
|
|||||||
else:
|
else:
|
||||||
result = obj.communicate()
|
result = obj.communicate()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
error_description = "%s: [%s, %s]" % (e.message, e.errno, e.strerror)
|
raise excp.ProcessExecutionError(description="%s: [%s, %s]" % (e, e.errno, e.strerror),
|
||||||
raise excp.ProcessExecutionError(description=error_description, cmd=str_cmd)
|
cmd=str_cmd)
|
||||||
if (stdin_fh != subprocess.PIPE
|
if (stdin_fh != subprocess.PIPE
|
||||||
and obj.stdin and close_stdin):
|
and obj.stdin and close_stdin):
|
||||||
obj.stdin.close()
|
obj.stdin.close()
|
||||||
|
@ -330,9 +330,9 @@ def param_replace(text, replacements, ignore_missing=False):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
if ignore_missing:
|
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:
|
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)
|
possible_params = find_params(text)
|
||||||
LOG.debug("Possible replacements are: %r" % (", ".join(possible_params)))
|
LOG.debug("Possible replacements are: %r" % (", ".join(possible_params)))
|
||||||
@ -341,24 +341,24 @@ def param_replace(text, replacements, ignore_missing=False):
|
|||||||
def replacer(match):
|
def replacer(match):
|
||||||
org_txt = match.group(0)
|
org_txt = match.group(0)
|
||||||
param_name = match.group(1)
|
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
|
# any tokens that were there
|
||||||
if org_txt.startswith('#'):
|
if org_txt.startswith('#'):
|
||||||
LOG.debug("Ignoring comment line")
|
|
||||||
return org_txt
|
return org_txt
|
||||||
replacer = replacements.get(param_name)
|
replacer = replacements.get(param_name)
|
||||||
if replacer is None and ignore_missing:
|
if replacer is None and ignore_missing:
|
||||||
replacer = org_txt
|
replacer = org_txt
|
||||||
elif replacer is None and not ignore_missing:
|
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)
|
raise excp.NoReplacementException(msg)
|
||||||
else:
|
else:
|
||||||
replacer = str(replacer)
|
replacer = str(replacer)
|
||||||
LOG.debug("Replacing [%s] with [%s]" % (org_txt, replacer))
|
LOG.debug("Replacing %r with %r" % (org_txt, replacer))
|
||||||
return replacer
|
return replacer
|
||||||
|
|
||||||
replaced_text = PARAM_SUB_REGEX.sub(replacer, text)
|
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
|
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"
|
PKGS="python-pip gcc python-netifaces git python-pep8 pylint python-progressbar python"
|
||||||
PIPS="termcolor pyyaml"
|
PIPS="termcolor pyyaml"
|
||||||
PIP="pip-python -q"
|
PIP="pip-python -q"
|
||||||
YUM="yum install -q"
|
YUM="yum install -q -y"
|
||||||
WGET="wget -q"
|
WGET="wget -q"
|
||||||
# Now do it!
|
# Now do it!
|
||||||
echo "Preparing DEVSTACKpy for RHEL 6"
|
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"
|
PKGS="python-pip gcc python-netifaces git python-pep8 pylint python-yaml python python-progressbar"
|
||||||
PIPS="termcolor"
|
PIPS="termcolor"
|
||||||
PIP="pip-python -q"
|
PIP="pip-python -q"
|
||||||
YUM="yum install -q"
|
YUM="yum install -q -y"
|
||||||
# Now do it!
|
# Now do it!
|
||||||
echo "Preparing DEVSTACKpy for Fedora 16"
|
echo "Preparing DEVSTACKpy for Fedora 16"
|
||||||
echo "Installing packages: $PKGS"
|
echo "Installing packages: $PKGS"
|
||||||
|
Loading…
Reference in New Issue
Block a user