def test_DnsmasqFilter(self): usercmd = ['FLAGFILE=A', 'NETWORK_ID=foobar', 'dnsmasq', 'foo'] f = filters.DnsmasqFilter("/usr/bin/dnsmasq", "root") self.assertTrue(f.match(usercmd)) self.assertEqual(f.get_command(usercmd), ['/usr/bin/dnsmasq', 'foo']) env = f.get_environment(usercmd) self.assertEqual(env.get('FLAGFILE'), 'A') self.assertEqual(env.get('NETWORK_ID'), 'foobar')
# nova/network/linux_net.py: 'route', 'add', 'default', 'gw', old_gateway filters.CommandFilter("/sbin/route", "root"), # nova/network/linux_net.py: 'dhcp_release', dev, address, mac_address filters.CommandFilter("/usr/bin/dhcp_release", "root"), # nova/network/linux_net.py: 'kill', '-9', pid # nova/network/linux_net.py: 'kill', '-HUP', pid filters.KillFilter("/bin/kill", "root", ['-9', '-HUP'], ['/usr/sbin/dnsmasq']), # nova/network/linux_net.py: 'kill', pid filters.KillFilter("/bin/kill", "root", [''], ['/usr/sbin/radvd']), # nova/network/linux_net.py: dnsmasq call filters.DnsmasqFilter("/usr/sbin/dnsmasq", "root"), # nova/network/linux_net.py: 'radvd', '-C', '%s' % _ra_file(dev, 'conf'),.. filters.CommandFilter("/usr/sbin/radvd", "root"), # nova/network/linux_net.py: 'brctl', 'addbr', bridge # nova/network/linux_net.py: 'brctl', 'setfd', bridge, 0 # nova/network/linux_net.py: 'brctl', 'stp', bridge, 'off' # nova/network/linux_net.py: 'brctl', 'addif', bridge, interface filters.CommandFilter("/sbin/brctl", "root"), filters.CommandFilter("/usr/sbin/brctl", "root"), # nova/network/linux_net.py: 'ovs-vsctl', .... filters.CommandFilter("/usr/bin/ovs-vsctl", "root"), ]