From f127fcd324212938dfb144c7bdac2533d4f7f8ce Mon Sep 17 00:00:00 2001 From: nitishkrishna Date: Thu, 17 Mar 2016 11:59:14 -0700 Subject: [PATCH] Closes-Bug: #1558719 - Compute Reboot was not being triggered for 3.0->3.0 upgrade Fix: Changed contrail-version fact to check for contrail-lib package instead of contrail-install-packages Beacuse 3.0 release code will run contrail_upgrade in fresh install, need to have different check for 3.0 onwards (check and unless for exec changed) Check for upgrade_needed was wrong (this is why contrail_upgrade was triggered for fresh install in 3.0 2723) Patch 2: Added back $needed_version check in if clause Change-Id: Iab774b345a87b9d0f191acbabbc8c12430a750b4 --- .../contrail/lib/facter/contrail-compute-custom-facts.rb | 2 +- .../modules/contrail/manifests/lib/contrail_upgrade.pp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrail/environment/modules/contrail/lib/facter/contrail-compute-custom-facts.rb b/contrail/environment/modules/contrail/lib/facter/contrail-compute-custom-facts.rb index b1d24738..2eacbb88 100755 --- a/contrail/environment/modules/contrail/lib/facter/contrail-compute-custom-facts.rb +++ b/contrail/environment/modules/contrail/lib/facter/contrail-compute-custom-facts.rb @@ -35,7 +35,7 @@ end Facter.add(:contrail_version) do setcode do - Facter::Util::Resolution.exec('dpkg -l contrail-install-packages | grep contrail-install-packages | awk \'{ printf $3}\'') + Facter::Util::Resolution.exec('dpkg -l contrail-lib | grep contrail-lib | awk \'{ printf $3}\'') end end Facter.add(:conductor_idx) do diff --git a/contrail/environment/modules/contrail/manifests/lib/contrail_upgrade.pp b/contrail/environment/modules/contrail/manifests/lib/contrail_upgrade.pp index 10c65fcd..9818a1f2 100644 --- a/contrail/environment/modules/contrail/manifests/lib/contrail_upgrade.pp +++ b/contrail/environment/modules/contrail/manifests/lib/contrail_upgrade.pp @@ -9,7 +9,7 @@ $needed_version = $::contrail::params::contrail_version # needed_version is not available om old SMs notify {"*** installed_version => $::contrail_version ***":;} - if $needed_version and (versioncmp($needed_version, $::contrail_version) > 0) { + if $needed_version and $::contrail_version and (versioncmp($needed_version, $::contrail_version) > 0) { notify {"*** need => $::needed_version ***":;} $upgrade_needed = 1 } else { @@ -44,8 +44,8 @@ logoutput => $contrail_logoutput, } -> exec { 'clear_out_files' : - command => 'rm -f /etc/contrail/contrail*.out && rm -f /opt/contrail/contrail_packages/exec-contrail-setup-sh.out && echo reset_provision >> /etc/contrail/contrail_common_exec.out', - unless => 'grep -qx reset_provision /etc/contrail/contrail_common_exec.out', + command => 'rm -f /etc/contrail/contrail*.out && rm -f /opt/contrail/contrail_packages/exec-contrail-setup-sh.out && echo reset_provision_3_0 >> /etc/contrail/contrail_common_exec.out', + unless => 'grep -qx reset_provision_3_0 /etc/contrail/contrail_common_exec.out', provider => shell, logoutput => $contrail_logoutput }