1 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # == Class: ovsdpdk::uninstall_ovs
17 # Provides uninstallation of openvswitch package (if present) together with removing of kernel module
19 class ovsdpdk::uninstall_ovs (
20 $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
21 $openvswitch_agent = $::ovsdpdk::params::openvswitch_agent,
22 $install_packages = $::ovsdpdk::params::install_packages,
25 #Due to dependencies to other packages, we won't purge vanilla OVS
26 #package { $remove_packages: ensure => 'purged' }
28 if $compute == 'True' {
29 exec { "/usr/sbin/service ${openvswitch_service_name} stop":
31 path => ["/usr/bin", "/bin", "/sbin"],
34 exec { "/usr/sbin/service ${openvswitch_agent} stop":
36 path => ["/usr/bin", "/bin", "/sbin"],
39 exec { '/sbin/modprobe -r openvswitch':
40 onlyif => "/bin/grep -q '^openvswitch' '/proc/modules'",
42 require => Exec["/usr/sbin/service ${openvswitch_service_name} stop"],
46 if $controller == 'True' {
47 exec { '/usr/sbin/service neutron-server stop':
49 path => ["/usr/bin", "/bin", "/sbin"],
50 onlyif => "ps aux | grep -vws grep | grep -ws neutron-server",
54 package { $install_packages: ensure => 'installed' }