fuel_plugin: Working version on Montreal POD
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / manifests / uninstall_ovs.pp
1 # == Class: ovsdpdk::uninstall_ovs
2 #
3 # Provides uninstallation of openvswitch package (if present) together with removing of kernel module
4 #
5 class ovsdpdk::uninstall_ovs (
6   $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
7   $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
8   $install_packages         = $::ovsdpdk::params::install_packages,
9 ) inherits ovsdpdk {
10
11   #Due to dependencies to other packages, we won't purge vanilla OVS
12   #package { $remove_packages: ensure => 'purged' }
13
14   if $compute == 'True' {
15     exec { "/usr/sbin/service ${openvswitch_service_name} stop":
16       user   => root,
17       path   => ["/usr/bin", "/bin", "/sbin"],
18     }
19
20     exec { "/usr/sbin/service ${openvswitch_agent} stop":
21       user   => root,
22       path   => ["/usr/bin", "/bin", "/sbin"],
23     }
24
25     exec { '/sbin/modprobe -r openvswitch':
26       onlyif  => "/bin/grep -q '^openvswitch' '/proc/modules'",
27       user    => root,
28       require => Exec["/usr/sbin/service ${openvswitch_service_name} stop"],
29     }
30   }
31
32   if $controller == 'True' {
33     exec { '/usr/sbin/service neutron-server stop':
34       user   => root,
35       path   => ["/usr/bin", "/bin", "/sbin"],
36       onlyif => "ps aux | grep -vws grep | grep -ws neutron-server",
37     }
38   }
39
40   package { $install_packages: ensure => 'installed' }
41
42 }
43