1
2
3
4
5
6
7
8
9
10
11
12
13
14 from ZenossSecurity import ZEN_VIEW
15 from Products.ZenMessaging.actions import sendUserAction
16 from Products.ZenMessaging.actions.constants import ActionTargetType, ActionName
17
19 """
20 Default implementation of IDeviceManager interface. This interface
21 is implemented by classes that have a device relationship to allow them
22 to manage their device relations.
23 """
24
28
30 """see IManageDevice"""
31 raise NotImplementedError
32
33 - def removeDevices(self, deviceNames=None, deleteStatus=False,
34 deleteHistory=False, deletePerf=False,REQUEST=None):
35 """see IManageDevice"""
36 from Products.ZenUtils.Utils import unused
37 unused(deleteHistory, deletePerf, deleteStatus)
38 if not deviceNames: return self()
39 if isinstance(deviceNames, basestring): deviceNames = (deviceNames,)
40 for devname in deviceNames:
41 self.devices._delObject(devname)
42 if sendUserAction and REQUEST:
43
44 if self.meta_type == 'PerformanceConf':
45 actionName = 'RemoveFromCollector'
46 objType = 'Collector'
47 objId = self.id
48 else:
49 actionName = ActionName.Remove
50 objType = self.meta_type
51 objId = self.getPrimaryId()
52 sendUserAction(ActionTargetType.Device,
53 actionName,
54 device=devname,
55 extra={objType:objId})
56 if REQUEST:
57 return self()
58