1
2
3
4
5
6
7
8
9
10
11
12
13
14 from Linkable import Linkable
15 from ManagedEntity import ManagedEntity
16 from DeviceComponent import DeviceComponent
17
18
19 -class OSComponent(DeviceComponent, ManagedEntity, Linkable):
20 """
21 Logical Operating System component like a Process, IpInterface, etc.
22 """
23 isUserCreatedFlag = False
24
25 _relations = ManagedEntity._relations + Linkable._relations
26
29
32
34 """Return our device object for DeviceResultInt.
35 """
36 os = self.os()
37 if os: return os.device()
38
40 """
41 Delete OSComponent
42 """
43 url = None
44 if REQUEST is not None:
45 url = self.device().os.absolute_url()
46 self.getPrimaryParent()._delObject(self.id)
47 '''
48 eventDict = {
49 'eventClass': Change_Remove,
50 'device': self.device().id,
51 'component': self.id or '',
52 'summary': 'Deleted by user: %s' % 'user',
53 'severity': Event.Info,
54 }
55 self.dmd.ZenEventManager.sendEvent(eventDict)
56 '''
57 if REQUEST is not None:
58 REQUEST['RESPONSE'].redirect(url)
59
61 """
62 Update OSComponent
63 """
64 url = None
65 if REQUEST is not None:
66 url = self.device().os.absolute_url()
67 self.getPrimaryParent()._updateObject(self, datamap)
68 '''
69 eventDict = {
70 'eventClass': Change_Set,
71 'device': self.device().id,
72 'component': self.id or '',
73 'summary': 'Updated by user: %s' % 'user',
74 'severity': Event.Info,
75 }
76 self.dmd.ZenEventManager.sendEvent(eventDict)
77 '''
78 if REQUEST is not None:
79 REQUEST['RESPONSE'].redirect(url)
80
82 """ Implement the Linkable interface for
83 naming endpoints. See Linkable.py.
84 """
85 return "%s/%s" % (self.device().getId(), self.id)
86
93
95 """ Override the device's zProperty and return
96 an icon based on the class name
97 """
98 return "/zport/dmd/img/icons/%s.png" % self.meta_type.lower()
99
101 """ Gets a link to this object, plus an icon """
102 template = ("<a href='%s' class='prettylink'>"
103 "<div class='device-icon-container'> "
104 "<img class='device-icon' src='%s'/> "
105 "</div>%s</a>")
106 icon = self.getIconPath()
107 href = self.getPrimaryUrlPath()
108 name = self.id
109 return template % (href, icon, name)
110