1
2
3
4
5
6
7
8
9
10
11
12
13
14 from ManagedEntity import ManagedEntity
15 from DeviceComponent import DeviceComponent
16 from Products.ZenRelations.RelSchema import ToMany
17
18
20 """
21 Logical Operating System component like a Process, IpInterface, etc.
22 """
23 isUserCreatedFlag = False
24
25 _relations = ManagedEntity._relations + (
26 ("links", ToMany(ToMany, "Products.ZenModel.Link", "endpoints")),
27 )
28
30 """
31 Sets self.isUserCreatedFlag to True. This indicated that the
32 component was created by a user rather than via modelling.
33 """
34 self.isUserCreatedFlag = True
35
36
38 """
39 Returns the value of isUserCreated. See setUserCreatedFlag() above.
40 """
41 return self.isUserCreatedFlag
42
43
45 """
46 Return our device object for DeviceResultInt.
47 """
48 os = self.os()
49 if os: return os.device()
50
51
53 """
54 Delete OSComponent
55 """
56 url = None
57 if REQUEST is not None:
58 url = self.device().os.absolute_url()
59 self.getPrimaryParent()._delObject(self.id)
60 '''
61 eventDict = {
62 'eventClass': Change_Remove,
63 'device': self.device().id,
64 'component': self.id or '',
65 'summary': 'Deleted by user: %s' % 'user',
66 'severity': Event.Info,
67 }
68 self.dmd.ZenEventManager.sendEvent(eventDict)
69 '''
70 if REQUEST is not None:
71 REQUEST['RESPONSE'].redirect(url)
72
73
75 """
76 Update OSComponent
77 """
78 url = None
79 if REQUEST is not None:
80 url = self.device().os.absolute_url()
81 self.getPrimaryParent()._updateObject(self, datamap)
82 '''
83 eventDict = {
84 'eventClass': Change_Set,
85 'device': self.device().id,
86 'component': self.id or '',
87 'summary': 'Updated by user: %s' % 'user',
88 'severity': Event.Info,
89 }
90 self.dmd.ZenEventManager.sendEvent(eventDict)
91 '''
92 if REQUEST is not None:
93 REQUEST['RESPONSE'].redirect(url)
94
95
97 """
98 Override the device's zProperty and return an icon based on the class
99 name
100 """
101 return "/zport/dmd/img/icons/%s.png" % self.meta_type.lower()
102
103
105 """
106 Gets a link to this object, plus an icon
107 """
108 template = ("<a href='%s' class='prettylink'>"
109 "<div class='device-icon-container'> "
110 "<img class='device-icon' src='%s'/> "
111 "</div>%s</a>")
112 icon = self.getIconPath()
113 href = self.getPrimaryUrlPath()
114 name = self.titleOrId()
115 return template % (href, icon, name)
116