diff options
author | Angus Salkeld <asalkeld@redhat.com> | 2013-11-01 17:13:18 +1100 |
---|---|---|
committer | Angus Salkeld <asalkeld@redhat.com> | 2013-11-01 17:14:29 +1100 |
commit | 090a5a9f4f47900bdab4d2fbe99b66b394566942 (patch) | |
tree | 85ac69bd22c30eea8d304340edb4e9786f36c99c | |
parent | 8cbb79aff2dd2eea409ba392135366f40c6b03a0 (diff) | |
download | heat-cfntools-090a5a9f4f47900bdab4d2fbe99b66b394566942.tar.gz |
Only run yum install once per package block
before we would get this:
yum install a
yum install a b
yum install a b c
Now we just get
yum install a b c
Change-Id: I2067922ab03de9488a0cd4e08c8d44c00296cd6a
Closes-bug: #1235796
-rw-r--r-- | heat_cfntools/cfntools/cfn_helper.py | 8 | ||||
-rw-r--r-- | heat_cfntools/tests/test_cfn_helper.py | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py index 5b1bf02..e699e6e 100644 --- a/heat_cfntools/cfntools/cfn_helper.py +++ b/heat_cfntools/cfntools/cfn_helper.py @@ -429,10 +429,10 @@ class PackagesHandler(object): installs.append(pkg) elif rc > 0: downgrades.append(pkg) - if installs: - RpmHelper.install(installs, rpms=False) - if downgrades: - RpmHelper.downgrade(downgrades) + if installs: + RpmHelper.install(installs, rpms=False) + if downgrades: + RpmHelper.downgrade(downgrades) def _handle_rpm_packages(self, packages): """Handle installation, upgrade, or downgrade of packages via rpm. diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py index 830ab5c..e42f774 100644 --- a/heat_cfntools/tests/test_cfn_helper.py +++ b/heat_cfntools/tests/test_cfn_helper.py @@ -87,10 +87,11 @@ class TestPackages(MockPopenTestCase): 'yum -y --showduplicates list available %s' % pack]) \ .AndReturn(FakePOpen(returncode=0)) install_list.append(pack) - self.mock_cmd_run( - ['su', 'root', '-c', - 'yum -y install %s' % ' '.join(install_list)]) \ - .AndReturn(FakePOpen(returncode=0)) + + self.mock_cmd_run( + ['su', 'root', '-c', + 'yum -y install %s' % ' '.join(install_list)]) \ + .AndReturn(FakePOpen(returncode=0)) self.m.ReplayAll() packages = { |