-
Notifications
You must be signed in to change notification settings - Fork 21
/
contrail_upgrade.pp
53 lines (51 loc) · 2.03 KB
/
contrail_upgrade.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## TODO: Change function name to avoid '-' hyphen in function name
## TODO: take care of sed comamnds in update_interface_file1
#
define contrail::lib::contrail_upgrade(
$contrail_upgrade = false,
$contrail_logoutput = false,
) {
$needed_version = $::contrail::params::contrail_version
# needed_version is not available om old SMs
notify {"*** installed_version => $::contrail_version ***":;}
if $needed_version and $::contrail_version and (versioncmp($needed_version, $::contrail_version) > 0) {
notify {"*** need => $::needed_version ***":;}
$upgrade_needed = 1
} else {
$upgrade_needed = 0
}
notify { "*** $::contrail_version => ${needed_version} or ${contrail_upgrade} or ${upgrade_needed}":;}
if (($contrail_upgrade == true) or ($upgrade_needed == 1)) {
notify {"*** UPGRADING ***":;} ->
exec { 'update_interface_file1':
command => "sed -i 's/^\"//g' /etc/network/interfaces",
provider => shell,
logoutput => $contrail_logoutput
} ->
exec { 'update_interface_file2':
command => "sed -i 's/\"//g' /etc/network/interfaces",
provider => shell,
logoutput => $contrail_logoutput
} ->
exec { 'storage_lm_boot_flag' :
command => "/bin/true # comment to satisfy puppet syntax requirements
set -x
ifconfig livemnfsvgw
RETVAL=\$?
if [ \${RETVAL} -eq 0 ]
then
openstack-config --set /etc/nova/nova.conf DEFAULT resume_guests_state_on_host_boot True
fi
#ensure we return success always
exit 0
",
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_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
}
}
}