Skip to content

Commit

Permalink
Merge "Closes-Bug: #1665162 - Puppet changes to prevent uninstall of …
Browse files Browse the repository at this point in the history
…ansible-provisioned bare metal compute"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 16, 2017
2 parents cc7a029 + e8bb35b commit 5aa59ab
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
7 changes: 7 additions & 0 deletions contrail/environment/modules/contrail/manifests/init.pp
Expand Up @@ -588,6 +588,10 @@
#
# [*ext_global_controller_port*]
# external global controller port
#
# [*ansible_provision*]
# To detect if ansible provision is being done alongside puppet
#
class contrail (
$host_ip = undef,
$uuid = undef,
Expand All @@ -604,6 +608,7 @@
$database_name_list = undef,
$collector_name_list = undef,
$openstack_name_list = undef,
$ansible_provision = false,
$tsn_ip_list = '',
$tsn_name_list = '',
$internal_vip = '',
Expand Down Expand Up @@ -962,6 +967,8 @@
# tsn Parameters
tsn_ip_list => hiera(contrail::tsn::tsn_ip_list, hiera(contrail::params::tsn_ip_list, $tsn_ip_list)),
tsn_name_list => hiera(contrail::tsn::tsn_name_list, hiera(contrail::params::tsn_name_list, $tsn_name_list)),
# Flag to check if ansible provision is being done alongside puppet
ansible_provision => hiera(contrail::ansible_provision, $ansible_provision),
# Sequencing Parameters (Never come as json input, generated by SM).
enable_provision_started => hiera(contrail::sequencing::enable_provision_started, hiera(contrail::params::enable_provision_started, $enable_provision_started)),
enable_keepalived => hiera(contrail::sequencing::enable_keepalived, hiera(contrail::params::enable_keepalived, $enable_keepalived)),
Expand Down
1 change: 1 addition & 0 deletions contrail/environment/modules/contrail/manifests/params.pp
Expand Up @@ -586,6 +586,7 @@
$database_name_list,
$collector_name_list,
$openstack_name_list,
$ansible_provision,
$tsn_name_list,
$internal_vip,
$external_vip,
Expand Down
Expand Up @@ -10,11 +10,12 @@
class contrail::profile::collector (
$enable_module = $::contrail::params::enable_collector,
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$ansible_provision = $::contrail::params::ansible_provision,
$host_roles = $::contrail::params::host_roles
) {
if ($enable_module and "collector" in $host_roles and $is_there_roles_to_delete == false) {
contain ::contrail::collector
} elsif ((!("collector" in $host_roles)) and ($contrail_roles["collector"] == true)) {
} elsif ((!("collector" in $host_roles)) and ($contrail_roles["collector"] == true) and ($ansible_provision == false)) {
notify { "uninstalling collector":; }
contain ::contrail::uninstall_collector
Notify["uninstalling collector"]->Class['::contrail::uninstall_collector']
Expand Down
Expand Up @@ -20,6 +20,7 @@
$openstack_debug = $::contrail::params::os_debug,
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$openstack_rabbit_servers = $::contrail::params::openstack_rabbit_hosts,
$ansible_provision = $::contrail::params::ansible_provision,
) {
if ($enable_module and "compute" in $host_roles and $is_there_roles_to_delete == false) {
contain ::contrail::profile::nova::compute
Expand All @@ -36,7 +37,7 @@
}
class { '::ceilometer::agent::compute': }
}
} elsif ((!("compute" in $host_roles)) and ($contrail_roles["compute"] == true)) {
} elsif ((!("compute" in $host_roles)) and ($contrail_roles["compute"] == true) and ($ansible_provision == false) ) {
notify { "uninstalling compute":; }
contain ::contrail::uninstall_compute
Notify["uninstalling compute"]->Class['::contrail::uninstall_compute']
Expand Down
Expand Up @@ -12,6 +12,7 @@
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$host_roles = $::contrail::params::host_roles,
$manage_neutron = $::contrail::params::manage_neutron,
$ansible_provision = $::contrail::params::ansible_provision,
) {

if ($enable_module and 'config' in $host_roles and $is_there_roles_to_delete == false) {
Expand All @@ -21,7 +22,7 @@
contain ::contrail::profile::neutron_server
Class['::contrail::config']->Class['::contrail::profile::neutron_server']
}
} elsif ((!('config' in $host_roles)) and ($contrail_roles['config'] == true)) {
} elsif ((!('config' in $host_roles)) and ($contrail_roles['config'] == true) and ($ansible_provision == false)) {
notify { 'uninstalling config':; }
contain ::contrail::uninstall_config
Notify['uninstalling config']->Class['::contrail::uninstall_config']
Expand Down
Expand Up @@ -10,14 +10,15 @@
class contrail::profile::controller (
$enable_module = $::contrail::params::enable_control,
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$ansible_provision = $::contrail::params::ansible_provision,
$host_roles = $::contrail::params::host_roles
) {

if ($enable_module and "control" in $host_roles and $is_there_roles_to_delete == false) {
contain ::contrail::control
#contrail expects neutron server to run on controls
include ::contrail::profile::neutron_server
} elsif ((!("control" in $host_roles)) and ($contrail_roles["control"] == true)) {
} elsif ((!("control" in $host_roles)) and ($contrail_roles["control"] == true) and ($ansible_provision == false)) {
notify { "uninstalling control":; }
contain ::contrail::uninstall_control
Notify["uninstalling control"]->Class['::contrail::uninstall_control']
Expand Down
Expand Up @@ -15,6 +15,7 @@
$enable_module = $::contrail::params::enable_database,
$host_roles = $::contrail::params::host_roles,
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$ansible_provision = $::contrail::params::ansible_provision,
$enable_ceilometer = $::contrail::params::enable_ceilometer
) {
if ($enable_module and "database" in $host_roles and $is_there_roles_to_delete == false) {
Expand All @@ -23,7 +24,7 @@
contain ::contrail::profile::mongodb
Class['::contrail::database']->Class['::contrail::profile::mongodb']
}
} elsif ((!("database" in $host_roles)) and ($contrail_roles["database"] == true)) {
} elsif ((!("database" in $host_roles)) and ($contrail_roles["database"] == true) and ($ansible_provision == false)) {
contain ::contrail::uninstall_database
notify { "uninstalling database":; } ->
Class['::contrail::uninstall_database']
Expand Down
Expand Up @@ -10,12 +10,13 @@
class contrail::profile::webui (
$enable_module = $::contrail::params::enable_webui,
$is_there_roles_to_delete = $::contrail::params::is_there_roles_to_delete,
$ansible_provision = $::contrail::params::ansible_provision,
$host_roles = $::contrail::params::host_roles
) {

if ($enable_module and 'webui' in $host_roles and $is_there_roles_to_delete == false) {
contain ::contrail::webui
} elsif ((!('webui' in $host_roles)) and ($contrail_roles['webui'] == true)) {
} elsif ((!('webui' in $host_roles)) and ($contrail_roles['webui'] == true) and ($ansible_provision == false)) {
notify { 'uninstalling webui':; }
contain ::contrail::uninstall_webui
Notify['uninstalling webui']->Class['::contrail::uninstall_webui']
Expand Down
Expand Up @@ -87,11 +87,6 @@
ensure => stopped,
}
->
file { '/etc/network/interfaces':
ensure => present,
source => '/etc/network/interfaces.orig',
}
->
# Main code for class starts here
# Ensure all needed packages are latest
package { [$vrouter_pkg, 'contrail-openstack-vrouter'] :
Expand Down Expand Up @@ -129,16 +124,11 @@
apply => "immediately",
subscribe => Class['::contrail::clear_compute'],
timeout => 0,
} ->
class {'::contrail::do_reboot_server':
reboot_flag => 'uninstall_compute_reboot',
}
contain ::contrail::delete_vnc_config
contain ::contrail::clear_compute
contain ::contrail::do_reboot_server

if ($enable_lbaas == true) {
File['/etc/network/interfaces']->
package{['haproxy', 'iproute']:
ensure => purged,
notify => ['Exec[apt_auto_remove_compute]']
Expand Down

0 comments on commit 5aa59ab

Please sign in to comment.