Use on-demand yum metadata caching in cfn-init
Use on-demand yum metadata caching to avoid downloading 50MB (Fedora 19) of extra metadata that is not necessary for correct cfn-init operation. Reduces time to orchestration by about 23% and cpu utilization by about 50%. Full detailed analsys in the launchpad bug. Change-Id: Id51d6d506d6051b5e83f550ef318f86d84f3c7a7 Closes-Bug: 1235824
This commit is contained in:
parent
1f275c2111
commit
e8d2522397
|
@ -212,11 +212,6 @@ class RpmHelper(object):
|
|||
if rpmutils_present:
|
||||
_rpm_util = rpmupdates.Updates([], [])
|
||||
|
||||
@classmethod
|
||||
def prepcache(cls):
|
||||
"""Prepare the yum cache."""
|
||||
CommandRunner("yum -y makecache").run()
|
||||
|
||||
@classmethod
|
||||
def compare_rpm_versions(cls, v1, v2):
|
||||
"""Compare two RPM version strings.
|
||||
|
@ -290,7 +285,7 @@ class RpmHelper(object):
|
|||
e.g., httpd-2.2.22
|
||||
e.g., httpd-2.2.22-1.fc16
|
||||
"""
|
||||
cmd_str = "yum -C -y --showduplicates list available %s" % pkg
|
||||
cmd_str = "yum -y --showduplicates list available %s" % pkg
|
||||
command = CommandRunner(cmd_str).run()
|
||||
return command.status == 0
|
||||
|
||||
|
@ -417,8 +412,6 @@ class PackagesHandler(object):
|
|||
# collect pkgs for batch processing at end
|
||||
installs = []
|
||||
downgrades = []
|
||||
# update yum cache
|
||||
RpmHelper.prepcache()
|
||||
for pkg_name, versions in packages.iteritems():
|
||||
ver = RpmHelper.newest_rpm_version(versions)
|
||||
pkg = "%s-%s" % (pkg_name, ver) if ver else pkg_name
|
||||
|
|
Loading…
Reference in New Issue