You can subscribe to this list here.
2007 |
Jan
|
Feb
(65) |
Mar
(276) |
Apr
(544) |
May
(638) |
Jun
(225) |
Jul
(204) |
Aug
(294) |
Sep
(532) |
Oct
(506) |
Nov
(324) |
Dec
(359) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(208) |
Feb
(225) |
Mar
(248) |
Apr
(388) |
May
(222) |
Jun
(47) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ze...> - 2007-04-25 16:02:22
|
Author: ecn Date: 2007-04-25 12:02:16 -0400 (Wed, 25 Apr 2007) New Revision: 4845 Added: trunk/test/ZenTestCase/ Removed: trunk/Products/ZenTestCase/ Log: cleaning up to fix copyright issues Copied: trunk/test/ZenTestCase (from rev 4844, trunk/Products/ZenTestCase) |
From: <sv...@ze...> - 2007-04-25 15:59:50
|
Author: ecn Date: 2007-04-25 11:59:49 -0400 (Wed, 25 Apr 2007) New Revision: 4844 Added: trunk/test/ Log: a place to put the testing stuff |
From: <sv...@ze...> - 2007-04-25 15:43:26
|
Author: ecn Date: 2007-04-25 11:43:28 -0400 (Wed, 25 Apr 2007) New Revision: 4843 Modified: trunk/Products/ZenWin/zenwin.py Log: * note device up/down with events Modified: trunk/Products/ZenWin/zenwin.py =================================================================== --- trunk/Products/ZenWin/zenwin.py 2007-04-25 15:42:48 UTC (rev 4842) +++ trunk/Products/ZenWin/zenwin.py 2007-04-25 15:43:28 UTC (rev 4843) @@ -109,9 +109,12 @@ w = self.watchers.get(srec.name, None) if not w: self.scanDevice(srec) + self.deviceUp(srec) self.watchers[srec.name] = w = self.getWatcher(srec) try: + self.log.debug("Querying %s", srec.name) s = w.nextEvent(100) + self.deviceUp(srec) if not s.state: return if s.state == 'Stopped': @@ -124,7 +127,7 @@ wcode, source, descr, hfile, hcont, scode = info scode = abs(scode) if scode != TIMEOUT_CODE: - del self.watchers[srec.name] + self.deviceDown(srec, str(ex)) def processLoop(self): print [d.name for d in self.devices] @@ -135,15 +138,32 @@ try: self.processDevice(device) except Exception, ex: - self.sendEvent(dict(summary="Wmi error talking to %s: %s" % - (device.name, ex), - severity=Event.Error, - device=device.name, - agent=self.agent, - eventClass=Status_Wmi_Conn)) - self.wmiprobs.append(device.name) + self.deviceDown(device, str(ex)) + def deviceDown(self, device, message): + if device.name in self.watchers: + del self.watchers[device.name] + self.sendEvent(dict(summary="Wmi error talking to %s: %s" % + (device.name, message), + severity=Event.Error, + device=device.name, + agent=self.agent, + eventClass=Status_Wmi_Conn)) + self.wmiprobs.append(device.name) + self.log.warning("WMI Connection to %s went down" % device.name) + def deviceUp(self, device): + print device.name, self.wmiprobs + print device.name in self.wmiprobs + if device.name in self.wmiprobs: + self.wmiprobs.remove(device.name) + self.log.info("WMI Connection to %s up" % device.name) + self.sendEvent(dict(summary="Wmi connection to %s up." % device.name, + severity=Event.Clear, + device=device.name, + agent=self.agent, + eventClass=Status_Wmi_Conn)) + def updateDevices(self, devices): config = [] for n,u,p,s in devices: |
From: <sv...@ze...> - 2007-04-25 15:42:48
|
Author: ecn Date: 2007-04-25 11:42:48 -0400 (Wed, 25 Apr 2007) New Revision: 4842 Modified: trunk/Products/ZenWin/WinCollector.py Log: * pull device names out of the wmiprobs list Modified: trunk/Products/ZenWin/WinCollector.py =================================================================== --- trunk/Products/ZenWin/WinCollector.py 2007-04-25 15:00:21 UTC (rev 4841) +++ trunk/Products/ZenWin/WinCollector.py 2007-04-25 15:42:48 UTC (rev 4842) @@ -61,8 +61,8 @@ now = time.time() try: yield self.eventService().callRemote('getWmiConnIssues') - self.wmiprobs = driver.next() - self.log.debug("Wmi Probs %r", (self.wmiprobs,)) + self.wmiprobs = [e[0] for e in driver.next()] + self.log.debug("Wmi Probs %r", self.wmiprobs) self.processLoop() self.sendEvent(self.heartbeat) except Exception, ex: |
From: <sv...@ze...> - 2007-04-25 15:00:43
|
Author: ian Date: 2007-04-25 11:00:21 -0400 (Wed, 25 Apr 2007) New Revision: 4841 Modified: trunk/Products/ZenEvents/EventManagerBase.py trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt trunk/Products/ZenModel/DataRoot.py trunk/Products/ZenModel/EventView.py trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js Log: * A few zengrid changes * Moved old methods out of DataRoot Modified: trunk/Products/ZenEvents/EventManagerBase.py =================================================================== --- trunk/Products/ZenEvents/EventManagerBase.py 2007-04-25 13:02:00 UTC (rev 4840) +++ trunk/Products/ZenEvents/EventManagerBase.py 2007-04-25 15:00:21 UTC (rev 4841) @@ -945,28 +945,26 @@ def getJSONEventsInfo(self, offset=0, count=50, fields=[], getTotalCount=True, filter='', severity=2, state=1, - orderby='', history=False, REQUEST=None): + orderby='', REQUEST=None): + """ Event data in JSON format. """ - Event data in JSON format. - """ - argnames = 'offset count getTotalCount filter severity state orderby'.split() + argnames = ('offset count getTotalCount ' + 'filter severity state orderby').split() myargs = {} for arg in argnames: - try: - try: myargs[arg] = int(REQUEST[arg]) - except ValueError: myargs[arg] = REQUEST[arg] - except KeyError: myargs[arg] = eval(arg) + myargs[arg] = eval(arg) + if not fields: fields = self.defaultResultFields + myargs['resultFields'] = fields myargs['rows'] = myargs['count']; del myargs['count'] if myargs['orderby']=='count': myargs['orderby']=='rows'; - if not fields: fields = self.defaultResultFields - if history: data, totalCount = self.dmd.ZenEventHistory.getEventList(**myargs) - else: data, totalCount = self.getEventList(**myargs) + data, totalCount = self.getEventList(**myargs) results = [x.getDataForJSON(fields) + [x.getCssClass()] for x in data] return simplejson.dumps((results, totalCount)) security.declareProtected('View','getJSONFields') - def getJSONFields(self, fields=[]): - if not fields: fields = self.defaultResultFields + def getJSONFields(self, fields=[], REQUEST=None): + if not fields: + fields = self.defaultResultFields lens = map(self.getAvgFieldLength, fields) total = sum(lens) lens = map(lambda x:x/total*100, lens) Modified: trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt =================================================================== --- trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-25 13:02:00 UTC (rev 4840) +++ trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-25 15:00:21 UTC (rev 4841) @@ -15,6 +15,7 @@ orderby request/ev_orderby | here/eventOrderby | string:; resultFields request/ev_resultfields | here/getResultFields | zem/defaultResultFields; + resultFields python:'[\'%s\']'%('\',\''.join(resultFields)); evcontrol here/ZenEventManager/eventControls; evcolspan python:len(resultFields)+1+evcontrol+1; severity request/severity | python:2; @@ -117,11 +118,15 @@ cursor: default; padding: 0; } +.zg_headers { + position: relative; + left: 1px; +} .zg_headers td.cell { font-weight: bold; padding 0; border: medium none; - border-left: 1px solid #888; + border-right: 1px solid #888; } .zg_headers td.cell:hover { background-color: #888; @@ -130,6 +135,7 @@ div.cell_inner { padding:0 3px;margin:0; overflow:hidden; + height: 32px; white-space: normal; font-size: 12px; line-height: 132%; @@ -141,15 +147,15 @@ </div> -<script> +<script tal:content="string: addLoadEvent( function() { var b = new ZenGridBuffer(); var mygrid = new ZenGrid('gridcontainer', 'getJSONEventsInfo', - 'mygrid', b); + ${resultFields}, 'mygrid', b); connect('filter', 'onkeyup', mygrid.doEventLivesearch); connect('state', 'onchange', mygrid.refreshFromFormElement); connect('severity', 'onchange', mygrid.refreshFromFormElement); -}); +});"> </script> </td></tr> <!-- END TABLE CONTENTS --> Modified: trunk/Products/ZenModel/DataRoot.py =================================================================== --- trunk/Products/ZenModel/DataRoot.py 2007-04-25 13:02:00 UTC (rev 4840) +++ trunk/Products/ZenModel/DataRoot.py 2007-04-25 15:00:21 UTC (rev 4841) @@ -217,41 +217,13 @@ def __init__(self, id, title=None): ZenModelRM.__init__(self, id, title) - def getResultFields(self): - """Result fields for dashboard. - """ - return ('device','summary','lastTime','count') - - def getEventList(self, **kwargs): - """Return the current event list for this managed entity. - """ - return self.ZenEventManager.getEventList(**kwargs) - - def getEventCount(self, **kwargs): """Return the current event list for this managed entity. """ return self.ZenEventManager.getEventCount(**kwargs) - def getJSONHistoryEventsInfo(self, **kwargs): - kwargs['REQUEST'] = self.REQUEST - return self.ZenEventHistory.getJSONEventsInfo(**kwargs) - - - def getJSONEventsInfo(self, **kwargs): - """Return the current event list for this managed entity. - """ - kwargs['REQUEST'] = self.REQUEST - return self.ZenEventManager.getJSONEventsInfo(**kwargs) - - def getJSONFields(self, **kwargs): - """Return the current event list for this managed entity. - """ - return self.ZenEventManager.getJSONFields(**kwargs) - - def getDmdRoots(self): return filter(lambda o: o.isInTree, self.objectValues()) Modified: trunk/Products/ZenModel/EventView.py =================================================================== --- trunk/Products/ZenModel/EventView.py 2007-04-25 13:02:00 UTC (rev 4840) +++ trunk/Products/ZenModel/EventView.py 2007-04-25 15:00:21 UTC (rev 4841) @@ -70,6 +70,24 @@ return self.getEventHistory().getEventList(**kwargs) + def getJSONEventsInfo(self, **kwargs): + """Return the current event list for this managed entity. + """ + return self.getEventManager().getJSONEventsInfo(**kwargs) + + + def getJSONFields(self, **kwargs): + """Return the current event list for this managed entity. + """ + return self.getEventManager().getJSONFields(**kwargs) + + + def getJSONHistoryEventsInfo(self, **kwargs): + """Return the current history event list for this managed entity. + """ + return self.getEventHistory().getJSONEventsInfo(**kwargs) + + def getStatus(self, statusclass=None, **kwargs): """Return the status number for this device of class statClass. """ Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-25 13:02:00 UTC (rev 4840) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-25 15:00:21 UTC (rev 4841) @@ -1,3 +1,4 @@ + var Class={ create:function(){ return function(){ @@ -136,8 +137,9 @@ var ZenGrid = Class.create(); ZenGrid.prototype = { - __init__: function(container, url, gridId, buffer) { + __init__: function(container, url, fields, gridId, buffer) { bindMethods(this); + this.fieldnames = fields; this.container = $(container); this.gridId = gridId; this.buffer = buffer; @@ -171,7 +173,6 @@ appendChildNodes(document.body, x); var myw = getElementDimensions(x).w/26; removeElement(x); - log(myw); return myw; }, addMouseWheelListening: function() { @@ -233,6 +234,7 @@ this.lastOffset = offset; var qs = update(this.lastparams, { 'offset': this.buffer.queryOffset(offset), + 'fields:list': this.fieldnames, 'count': this.buffer.querySize(offset), 'getTotalCount': 1 }); @@ -295,7 +297,7 @@ return colgroup; }, connectHeaders: function(cells) { - for(i=0;i<cells.length;i++) { + for(i=isManager?1:0;i<cells.length;i++) { setStyle(cells[i], {'cursor':'pointer'}); connect(cells[i], 'onclick', bind(function(e) { @@ -334,7 +336,7 @@ this.setTableNumRows(this.numRows); this.lock.release(); }, this); - var x = loadJSONDoc('getJSONFields'); + var x = loadJSONDoc('getJSONFields', {'fields:list':this.fieldnames}); x.addCallback(bind(function(r){ this.fields=r; if (isManager) this.fields = concat([[' ','']], this.fields); @@ -343,7 +345,7 @@ }, clearTable: function() { table = this.zgtable; - var cells = table.getElementsByTagName('td'); + var cells = getElementsByTagAndClassName('div', 'cell_inner', table); for (i=0;(cell=cells[i]);i++){ replaceChildNodes(cell, null); } @@ -389,7 +391,13 @@ } for (j=isManager?1:0;j<yo.length;j++) { var cellwidth = this.abswidths[j] - divs[j].innerHTML = mydata[j]; + switch (this.fields[j][0]) { + case 'firstTime': + case 'lastTime': + replaceChildNodes(divs[j], isoTimestamp(mydata[j])); + default: + divs[j].innerHTML = mydata[j]; + } divs[j].title = this.abswidths[j]; var newClass = 'cell ' + mydata[mydata.length-1]; if (yo[j].className!=newClass) @@ -498,10 +506,11 @@ }, handleScroll: function() { clearTimeout(this.scrollTimeout); + this.nextScrollPosition = this.scrollbar.scrollTop || 0; + log(this.nextScrollPosition); this.scrollTimeout = setTimeout ( bind(function() { - this.scrollToPixel(this.scrollbar.scrollTop) - log(this.scrollbar.scrollTop); + this.scrollToPixel(this.nextScrollPosition) }, this), 50); }, refreshFromFormElement: function(e) { |
From: <sv...@ze...> - 2007-04-25 13:02:28
|
Author: ecn Date: 2007-04-25 09:02:00 -0400 (Wed, 25 Apr 2007) New Revision: 4840 Modified: trunk/Products/ZenWin/zenwin.py Log: * remove all the lower-case conversions: it was messing up the events * post the proper event class to get the GUI to agree the service is down Modified: trunk/Products/ZenWin/zenwin.py =================================================================== --- trunk/Products/ZenWin/zenwin.py 2007-04-25 12:31:01 UTC (rev 4839) +++ trunk/Products/ZenWin/zenwin.py 2007-04-25 13:02:00 UTC (rev 4840) @@ -24,7 +24,7 @@ import Globals from WinCollector import WinCollector as Base, TIMEOUT_CODE from Products.ZenHub.services import WmiConfig -from Products.ZenEvents.ZenEventClasses import Heartbeat, Status_Wmi_Conn, Status_WinSrv +from Products.ZenEvents.ZenEventClasses import Heartbeat, Status_Wmi_Conn, Status_WinService from Products.ZenEvents import Event from WinServiceTest import WinServiceTest @@ -35,7 +35,7 @@ self.name = name self.username = username self.password = password - self.services = dict([(k.lower(), v) for k, v in services.items()]) + self.services = dict([(k, v) for k, v in services.items()]) class zenwin(Base): @@ -53,7 +53,7 @@ "Compose an event" name = "WinServiceTest" evt = dict(device=devname, component=svcname, - summary=msg, eventClass=Status_WinSrv, + summary=msg, eventClass=Status_WinService, agent= self.agent, severity= sev, eventGroup= "StatusTest", manager=getfqdn()) if sev > 0: @@ -88,10 +88,9 @@ wql = "select Name from Win32_Service where State='Running'" w = WMI(srec.name, srec.username, srec.password) w.connect() - svcs = [ svc.Name.lower() for svc in w.query(wql) ] + svcs = [ svc.Name for svc in w.query(wql) ] nextFd = os.open('/dev/null', os.O_RDONLY) for name, (status, severity) in srec.services.items(): - name = name.lower() self.log.debug("service: %s status: %d", name, status) if name not in svcs: self.serviceStopped(srec, name) @@ -116,9 +115,9 @@ if not s.state: return if s.state == 'Stopped': - self.serviceStopped(srec, s.name.lower()) + self.serviceStopped(srec, s.name) if s.state == 'Running': - self.serviceRunning(srec, s.name.lower()) + self.serviceRunning(srec, s.name) except pywintypes.com_error, e: code,txt,info,param = e if info: |
From: <sv...@ze...> - 2007-04-25 12:31:02
|
Author: ecn Date: 2007-04-25 08:31:01 -0400 (Wed, 25 Apr 2007) New Revision: 4839 Modified: trunk/Products/ZenWin/zenwin.py Log: * remove gc call * remove non-existent close method Modified: trunk/Products/ZenWin/zenwin.py =================================================================== --- trunk/Products/ZenWin/zenwin.py 2007-04-24 21:33:12 UTC (rev 4838) +++ trunk/Products/ZenWin/zenwin.py 2007-04-25 12:31:01 UTC (rev 4839) @@ -98,9 +98,6 @@ elif status > 0: self.serviceRunning(srec, name) w.close() - del w - import gc - gc.collect() def getWatcher(self, srec): wql = ("""SELECT * FROM __InstanceModificationEvent within 5 where """ @@ -128,7 +125,6 @@ wcode, source, descr, hfile, hcont, scode = info scode = abs(scode) if scode != TIMEOUT_CODE: - w.close() del self.watchers[srec.name] def processLoop(self): |
From: <sv...@ze...> - 2007-04-24 21:33:10
|
Author: ian Date: 2007-04-24 17:33:12 -0400 (Tue, 24 Apr 2007) New Revision: 4838 Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js Log: * Fixed sorting on zengrid objects Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-24 21:26:20 UTC (rev 4837) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-24 21:33:12 UTC (rev 4838) @@ -300,7 +300,8 @@ connect(cells[i], 'onclick', bind(function(e) { var cell = e.src(); - this.refreshWithParams({'orderby': cell.innerHTML }); + var f = cell.getElementsByTagName('div')[0].innerHTML; + this.refreshWithParams({'orderby': f }); }, this) ); } |
From: <sv...@ze...> - 2007-04-24 21:26:20
|
Author: ian Date: 2007-04-24 17:26:20 -0400 (Tue, 24 Apr 2007) New Revision: 4837 Modified: trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js Log: * Modified the ZenGrid object Modified: trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt =================================================================== --- trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-24 20:10:17 UTC (rev 4836) +++ trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-24 21:26:20 UTC (rev 4837) @@ -106,18 +106,35 @@ <style> .leftfloat { float:left } +span.ruler, td.cell { - font-family: Trebuchet,verdana,helvetica,sans-serif; - font-size: 11px; - line-height: 12px; margin: 0px; overflow: hidden; white-space: nowrap; - border-spacing: 1px; - border: 1px solid #666; - height: 22px; + height: 32px; + border-bottom: 1px solid #000; + border-right: 1px solid #888; cursor: default; + padding: 0; } +.zg_headers td.cell { + font-weight: bold; + padding 0; + border: medium none; + border-left: 1px solid #888; +} +.zg_headers td.cell:hover { + background-color: #888; + color: white; +} +div.cell_inner { + padding:0 3px;margin:0; + overflow:hidden; + white-space: normal; + font-size: 12px; + line-height: 132%; + vertical-align: middle; +} </style> <div id="gridcontainer" style="width:100%;"> Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-24 20:10:17 UTC (rev 4836) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js 2007-04-24 21:26:20 UTC (rev 4837) @@ -143,13 +143,14 @@ this.buffer = buffer; this.maxRows = 300; this.numRows = 15; - this.rowHeight = 22; + this.rowHeight = 32; this.checkedArray = new Array(); this.url = url; this.lastparams = {}; this.fields = []; this.lastOffset = 0; this.lastPixelOffset = this.lastPixelOffset || 0; + this.fontProportion = this.getFontProportion(); this.buildHTML(); this.clearFirst = false; this.lock = new DeferredLock(); @@ -163,13 +164,16 @@ }, this)); this.addMouseWheelListening(); connect(this.scrollbar, 'onscroll', this.handleScroll); - connect(currentWindow(), 'onresize', - bind(function(e) { - this.refreshWidths(); - this.refreshTable(this.lastOffset); - }, this) - ); }, + getFontProportion: function() { + var x = SPAN({class:'ruler'}, + 'abcdefghijklmnopqrstuvwxyz'); + appendChildNodes(document.body, x); + var myw = getElementDimensions(x).w/26; + removeElement(x); + log(myw); + return myw; + }, addMouseWheelListening: function() { if (this.container.addEventListener) this.container.addEventListener( @@ -200,15 +204,18 @@ }, getColLengths: function() { var lens = new Array(); - var fieldMapping = { - summary: 10, - firstTime: -4, - lastTime: -4, - component: -5 + this.fieldMapping = { + summary: 0, + firstTime: 0, + lastTime: 0, + component: -3, + count: +3 } + this.fieldOffsetTotal = 0; + //this.fieldOffsetTotal = 10+-4+-4+-5; for (i=0;i<this.fields.length;i++) { var field = this.fields[i]; - var offset = fieldMapping[field[0]] || 0; + var offset = this.fieldMapping[field[0]] || 0; lens[lens.length] = field[1] + offset; } return lens @@ -259,16 +266,23 @@ var i = String(indx); cells = map(function(x) {return TD({ 'class':'cell', - 'id':x[0]+'_'+i}, null)}, + 'id':x[0]+'_'+i}, + DIV({'class':'cell_inner'}, null))}, this.fields); return TR({'class':'zengrid_row'}, cells); }, populateRow: function(row, data) { - var stuffz = row.getElementsByTagName('td'); + var stuffz = getElementsByTagAndClassName('div', 'cell_inner', row) for (i=0;i<stuffz.length;i++) { stuffz[i].innerHTML = data[i]; - addElementClass(stuffz[i], data[data.length-1]); + //addElementClass(stuffz[i], data[data.length-1]); } + + if (isManager) { + var cb = INPUT({type:'checkbox', + style: 'visibility:hidden;'}, null); + replaceChildNodes(stuffz[0], cb); + } }, getColgroup: function() { var widths = this.getColLengths(); @@ -276,7 +290,7 @@ if (parseFloat(w)<3) w=String(3); return createDOM( 'col', {width: w+'%'}, null) }, widths); - colgroup = createDOM('colgroup', {span:widths.length, height:'22px'}, + colgroup = createDOM('colgroup', {span:widths.length, height:'32px'}, cols); return colgroup; }, @@ -293,11 +307,13 @@ }, refreshWidths: function() { var widths = this.getColLengths(); - var parentwidth = getElementDimensions(this.container).w; - this.abswidths = map( - bind( function(p) { - return parseInt(parentwidth*(p/100)); - }, this), widths); + var parentwidth = getElementDimensions(this.viewport).w; + this.abswidths = new Array(); + for (i=0;i<widths.length;i++) { + var p = widths[i]; + var myw = parseInt(parentwidth*(p/100)); + this.abswidths[i] = myw; + } }, refreshFields: function() { var updateColumns = bind(function() { @@ -328,17 +344,17 @@ table = this.zgtable; var cells = table.getElementsByTagName('td'); for (i=0;(cell=cells[i]);i++){ - cell.innerHTML = ''; + replaceChildNodes(cell, null); } }, setTableNumRows: function(numrows) { this.rowEls = map(this.getBlankRow, range(numrows)); replaceChildNodes(this.output, this.rowEls); setElementDimensions(this.viewport, - {h:parseInt(numrows*(this.rowHeight+3))} + {h:parseInt(numrows*(this.rowHeight))} ); - var scrollHeight = parseInt(numrows * (this.rowHeight+3)); + var scrollHeight = parseInt(numrows * (this.rowHeight)); if (scrollHeight<=getElementDimensions(this.zgtable).h) { setStyle(this.scrollbar, {'display':'none'}); } else { @@ -361,25 +377,19 @@ value:evid}; if (this.checkedArray[evid]) chkboxparams.checked=true; var chkbox = INPUT(chkboxparams, null); - var yo = rows[i].getElementsByTagName('td'); + var yo = getElementsByTagAndClassName('td', 'cell', rows[i]); + var divs = getElementsByTagAndClassName('div','cell_inner', rows[i]); var firstcol = yo[0]; if (isManager) { mydata = concat([''],mydata); - replaceChildNodes(firstcol, chkbox); + replaceChildNodes(divs[0], chkbox); setElementClass(firstcol, 'cell ' + mydata[mydata.length-1]) connect(chkbox, 'onclick', this.markAsChecked); } for (j=isManager?1:0;j<yo.length;j++) { var cellwidth = this.abswidths[j] - var truncated = String(mydata[j]).substring(0, - (cellwidth / 6.8)-3); - if (this.fields[j][0]=='count') truncated = String( - mydata[j]); - if (truncated.length < String(mydata[j]).length) - truncated += '...'; - if (yo[j].innerHTML!=truncated) yo[j].innerHTML = truncated; - if (yo[j].title!=mydata[j]) - updateNodeAttributes(yo[j], {title:mydata[j]}); + divs[j].innerHTML = mydata[j]; + divs[j].title = this.abswidths[j]; var newClass = 'cell ' + mydata[mydata.length-1]; if (yo[j].className!=newClass) setElementClass(yo[j], newClass) @@ -391,12 +401,20 @@ getTotalRows: function() { cb = bind(function(r) { this.buffer.totalRows = r; - this.setScrollHeight(this.buffer.totalRows*(this.rowHeight+3)); + this.setScrollHeight(this.buffer.totalRows*(this.rowHeight)); this.lock.release(); }, this); d = loadJSONDoc('getEventCount'); d.addCallback(cb); }, + getHeaderWidths: function() { + var myws = new Array(); + for (i=0;i<this.fields.length;i++) { + var width = this.fields[i][0].length * this.fontProportion * 12; + myws[myws.length] = width; + } + return myws + }, buildHTML: function() { var getId = function(thing) { return "zg_" + thing + "_" + this.gridId } @@ -409,18 +427,21 @@ this.headcolgroup = createDOM('colgroup', null, null); this.colgroup = createDOM( 'colgroup', {style: 'height:'+this.rowHeight+'px'}, null ); - this.zgtable = TABLE( {id: getId('table')}, [ + this.zgtable = TABLE( {id: getId('table'), + cellspacing:0, cellpadding:0}, [ THEAD(null, null), this.colgroup, this.output, TFOOT(null, null) ]); this.viewport = DIV( {id: getId('viewport')}, this.zgtable ); - this.headers = TABLE( {id: getId('headers')}, [ + this.headers = TABLE( {id: getId('headers'), class:"zg_headers", + cellspacing:0, cellpadding:0}, [ this.headcolgroup, TBODY(null, null) ]); - this.innercont = DIV( {id:getId('innercont')}, [this.viewport, this.scrollbar]); + this.innercont = DIV( {id:getId('innercont')}, + [this.viewport, this.scrollbar]); setStyle(this.zgtable, { 'width': '100%', 'border': 'medium none', @@ -432,9 +453,10 @@ 'width':'98%' }); setStyle(this.innercont, { - 'width':'98%' + 'width':'100%' }); setStyle(this.viewport, { + 'width':'98%', 'height':this.rowHeight*(this.numRows)+'px', 'overflow':'hidden', 'float':'left', @@ -464,12 +486,22 @@ }, scrollToPixel: function(pixel) { this.lastPixelOffset = this.lastPixelOffset || 0; - this.refreshTable(parseInt(pixel/this.rowHeight)); + var diff = (pixel-this.lastPixelOffset) % this.rowHeight; + if (diff) { + pixel += diff; + } + var newOffset = Math.round(pixel/this.rowHeight); + this.refreshTable(newOffset); this.scrollbar.scrollTop = pixel; this.lastPixelOffset = pixel; }, handleScroll: function() { - this.scrollToPixel(this.scrollbar.scrollTop); + clearTimeout(this.scrollTimeout); + this.scrollTimeout = setTimeout ( + bind(function() { + this.scrollToPixel(this.scrollbar.scrollTop) + log(this.scrollbar.scrollTop); + }, this), 50); }, refreshFromFormElement: function(e) { node = e.src(); |
From: <sv...@ze...> - 2007-04-24 20:10:16
|
Author: ecn Date: 2007-04-24 16:10:17 -0400 (Tue, 24 Apr 2007) New Revision: 4836 Modified: trunk/Products/ZenWin/zenwin.py Log: every event must have a severity Modified: trunk/Products/ZenWin/zenwin.py =================================================================== --- trunk/Products/ZenWin/zenwin.py 2007-04-24 20:09:46 UTC (rev 4835) +++ trunk/Products/ZenWin/zenwin.py 2007-04-24 20:10:17 UTC (rev 4836) @@ -25,6 +25,7 @@ from WinCollector import WinCollector as Base, TIMEOUT_CODE from Products.ZenHub.services import WmiConfig from Products.ZenEvents.ZenEventClasses import Heartbeat, Status_Wmi_Conn, Status_WinSrv +from Products.ZenEvents import Event from WinServiceTest import WinServiceTest from WinEventlog import WinEventlog @@ -131,6 +132,7 @@ del self.watchers[srec.name] def processLoop(self): + print [d.name for d in self.devices] for device in self.devices: if device.name in self.wmiprobs: self.log.debug("WMI problems on %s: skipping" % device.name) @@ -139,7 +141,8 @@ self.processDevice(device) except Exception, ex: self.sendEvent(dict(summary="Wmi error talking to %s: %s" % - (device.name, ex), + (device.name, ex), + severity=Event.Error, device=device.name, agent=self.agent, eventClass=Status_Wmi_Conn)) |
From: <sv...@ze...> - 2007-04-24 20:09:48
|
Author: jstevens Date: 2007-04-24 16:09:46 -0400 (Tue, 24 Apr 2007) New Revision: 4835 Modified: trunk/Products/ZenModel/AdministrativeRoleable.py trunk/Products/ZenModel/UserSettings.py Log: fixes #1299, #1298 * Adding import of AdministrativeRole to a couple files that needed it Modified: trunk/Products/ZenModel/AdministrativeRoleable.py =================================================================== --- trunk/Products/ZenModel/AdministrativeRoleable.py 2007-04-24 19:45:04 UTC (rev 4834) +++ trunk/Products/ZenModel/AdministrativeRoleable.py 2007-04-24 20:09:46 UTC (rev 4835) @@ -16,6 +16,7 @@ Created by Marc Irlandez on 2007-04-05. """ from AccessControl import ClassSecurityInfo +from Products.ZenModel.AdministrativeRole import AdministrativeRole class AdministrativeRoleable: Modified: trunk/Products/ZenModel/UserSettings.py =================================================================== --- trunk/Products/ZenModel/UserSettings.py 2007-04-24 19:45:04 UTC (rev 4834) +++ trunk/Products/ZenModel/UserSettings.py 2007-04-24 20:09:46 UTC (rev 4835) @@ -28,6 +28,7 @@ from Products.ZenEvents.ActionRule import ActionRule from Products.ZenEvents.CustomEventView import CustomEventView from Products.ZenRelations.RelSchema import * +from Products.ZenModel.AdministrativeRole import AdministrativeRole from ZenModelRM import ZenModelRM import Products.ZenUtils.Utils as Utils |
From: <sv...@ze...> - 2007-04-24 19:45:03
|
Author: jstevens Date: 2007-04-24 15:45:04 -0400 (Tue, 24 Apr 2007) New Revision: 4834 Modified: trunk/inst/docs/INSTALL_CentOS43.txt trunk/inst/docs/INSTALL_FC6.txt trunk/inst/docs/INSTALL_RHEL5.txt Log: Updated instructions for firewall Modified: trunk/inst/docs/INSTALL_CentOS43.txt =================================================================== --- trunk/inst/docs/INSTALL_CentOS43.txt 2007-04-24 19:40:45 UTC (rev 4833) +++ trunk/inst/docs/INSTALL_CentOS43.txt 2007-04-24 19:45:04 UTC (rev 4834) @@ -34,13 +34,19 @@ # /etc/init.d/zenoss start -4. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +4. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # service iptables stop + # chkconfig iptables off + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps + Installation Technique: Automated Install 1. Download the installer via wget and execute it via the "sh" Modified: trunk/inst/docs/INSTALL_FC6.txt =================================================================== --- trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 19:40:45 UTC (rev 4833) +++ trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 19:45:04 UTC (rev 4834) @@ -51,7 +51,15 @@ # /etc/init.d/zenoss start -7. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +7. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # service iptables stop + # chkconfig iptables off + + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps + + \ No newline at end of file Modified: trunk/inst/docs/INSTALL_RHEL5.txt =================================================================== --- trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 19:40:45 UTC (rev 4833) +++ trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 19:45:04 UTC (rev 4834) @@ -26,10 +26,14 @@ # /etc/init.d/zenoss start -4. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +4. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # service iptables stop + # chkconfig iptables off + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps - |
From: <sv...@ze...> - 2007-04-24 19:40:43
|
Author: jstevens Date: 2007-04-24 15:40:45 -0400 (Tue, 24 Apr 2007) New Revision: 4833 Modified: branches/zenoss-1.1.x/inst/docs/INSTALL_CentOS43.txt branches/zenoss-1.1.x/inst/docs/INSTALL_FC6.txt branches/zenoss-1.1.x/inst/docs/INSTALL_RHEL5.txt Log: Changed firewall instructions, etc Modified: branches/zenoss-1.1.x/inst/docs/INSTALL_CentOS43.txt =================================================================== --- branches/zenoss-1.1.x/inst/docs/INSTALL_CentOS43.txt 2007-04-24 19:39:09 UTC (rev 4832) +++ branches/zenoss-1.1.x/inst/docs/INSTALL_CentOS43.txt 2007-04-24 19:40:45 UTC (rev 4833) @@ -63,13 +63,19 @@ # /etc/init.d/zenoss start -8. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +8. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # service iptables stop + # chkconfig iptables off + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps + Installation Technique: Automated Install 1. Download the installer via wget and execute it via the "sh" Modified: branches/zenoss-1.1.x/inst/docs/INSTALL_FC6.txt =================================================================== --- branches/zenoss-1.1.x/inst/docs/INSTALL_FC6.txt 2007-04-24 19:39:09 UTC (rev 4832) +++ branches/zenoss-1.1.x/inst/docs/INSTALL_FC6.txt 2007-04-24 19:40:45 UTC (rev 4833) @@ -9,7 +9,7 @@ Installation Technique: Manual Install -These instructions are for install the Zenoss RPM. This version works +These instructions are for installing the Zenoss RPM. This version works with FC6, but it should work with FC5 and previous Fedora Core installations with minor modifications (mostly to dependent RPM versions). Follow these steps on the machine where you want to run @@ -19,17 +19,13 @@ packages Zenoss depends on in order to properly function. To run yum, issue the following command: - # yum -y install net-snmp net-snmp-utils perl-Digest-HMAC perl-DBI + # yum -y install mysql mysql-server net-snmp net-snmp-utils -2. Zenoss also depends on some RPMs that are not included in YUM - distributions. These dependencies are bundled together in the - "zenoss-deps" distribution for your convenience. Download the - zenoss-deps from the Zenoss downloads page under "Zenoss Red Hat - RPM Dependencies", and install them using the following command: +2. Download the latest Zenoss RPM from the SourceForge downloads + page, and install it using the following command: - # tar xjf zenoss-deps-fc6-1.1.0.i386.tar.bz2 - # cd zenoss-deps; rpm -Uvh *.rpm + # rpm -ivh zenoss-1.1.2-0.fc6.i386.rpm 3. In order to allow the SNMP Daemon to read CPU information SE Linux @@ -45,22 +41,25 @@ # /etc/init.d/snmpd start -5. Start Zenoss using the command: +5. Start MySQL using the command: - # /etc/init.d/zenoss start + # /etc/init.d/mysql start -6. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +6. Start Zenoss using the command: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # /etc/init.d/zenoss start -Installation Technique: Automated Install +7. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: -1. Download the installer via wget and execute it via the "sh" - command. + # service iptables stop + # chkconfig iptables off - # wget http://www.zenoss.com/download/latest/installer_fc6w -O install.sh - # sh install.sh + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps + \ No newline at end of file Modified: branches/zenoss-1.1.x/inst/docs/INSTALL_RHEL5.txt =================================================================== --- branches/zenoss-1.1.x/inst/docs/INSTALL_RHEL5.txt 2007-04-24 19:39:09 UTC (rev 4832) +++ branches/zenoss-1.1.x/inst/docs/INSTALL_RHEL5.txt 2007-04-24 19:40:45 UTC (rev 4833) @@ -2,10 +2,10 @@ Installation Technique: Manual Install -These instructions are for installing the Zenoss RPM (Red Hat Package -Manager). This version works with Red Hat -Enterprise Linux version 5. Follow these steps on the machine where -you want to run Zenoss. Note: All commands should be run as root. +These instructions are for installing the Zenoss RPM (Red Hat Package Manager). +This version works with Red Hat Enterprise Linux version 5. Follow these steps +on the machine where you want to run Zenoss. Note: All commands should be run +as root. 1. The Yellow Dog Updater, Modified (YUM) is used to install several packages Zenoss depends on in order to properly function. To @@ -13,25 +13,27 @@ # yum -y install mysql mysql-server net-snmp net-snmp-utils -2. Start up the mysql server - # service mysqld start - -3. Download the latest Zenoss RPM from the SourceForge downloads +2. Download the latest Zenoss RPM from the SourceForge downloads page, and install it using the following command: # rpm -ivh zenoss-1.1.2-0.rhel5.i386.rpm -4. Start Zenoss using the command: +3. Start Zenoss using the command: - # service zenoss start + # /etc/init.d/mysqld restart + # /etc/init.d/zenoss start -5. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +4. Several ports need to be open for Zenoss to operate. One option for doing + this is to disable the firewall: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # service iptables stop + # chkconfig iptables off + Alternatively you can open the following ports in your firewall: + 8080 - HTTP access to the zenoss console + 514 - syslog + 162 - SNMP traps - |
From: <sv...@ze...> - 2007-04-24 19:39:10
|
Author: ecn Date: 2007-04-24 15:39:09 -0400 (Tue, 24 Apr 2007) New Revision: 4832 Modified: trunk/Products/ZenUtils/Utils.py Log: * deal with crazy natural object order Modified: trunk/Products/ZenUtils/Utils.py =================================================================== --- trunk/Products/ZenUtils/Utils.py 2007-04-24 19:26:30 UTC (rev 4831) +++ trunk/Products/ZenUtils/Utils.py 2007-04-24 19:39:09 UTC (rev 4832) @@ -510,9 +510,10 @@ except ValueError: origseq = () seqmap = () + orig = dict([(o.sequence, o) for o in objects]) if origseq: for oldSeq, newSeq in zip(origseq, seqmap): - objects[oldSeq].sequence = newSeq + orig[oldSeq].sequence = newSeq def sort(x): x = list(x) x.sort(lambda a, b: cmp(a.sequence, b.sequence)) @@ -520,5 +521,5 @@ for i, obj in enumerate(sort(objects)): obj.sequence = i if REQUEST: - REQUEST['RESPONSE'].redirect(context.getPrimaryUrlPath()) + return context.callZenScreen(REQUEST) |
From: <sv...@ze...> - 2007-04-24 19:26:29
|
Author: marc Date: 2007-04-24 15:26:30 -0400 (Tue, 24 Apr 2007) New Revision: 4831 Modified: trunk/Products/ZenModel/DeviceClass.py trunk/Products/ZenModel/DeviceManagerBase.py Log: #1285 * Methods moved to DeviceManagerBase Modified: trunk/Products/ZenModel/DeviceClass.py =================================================================== --- trunk/Products/ZenModel/DeviceClass.py 2007-04-24 18:35:34 UTC (rev 4830) +++ trunk/Products/ZenModel/DeviceClass.py 2007-04-24 19:26:30 UTC (rev 4831) @@ -206,33 +206,7 @@ if REQUEST: REQUEST['RESPONSE'].redirect(target.getPrimaryUrlPath()) - def setGroups(self, groupPaths=None, deviceNames=None, REQUEST=None): - """ Provide a method to set device groups from any organizer """ - if not groupPaths or not deviceNames: return self() - if type(deviceNames) == type(''): deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.setGroups(groupPaths) - if REQUEST: REQUEST['RESPONSE'].redirect(self.getPrimaryUrlPath()) - def setSystems(self, systemPaths=None, deviceNames=None, REQUEST=None): - """ Provide a method to set device systems from any organizer """ - if not systemPaths or not deviceNames: return self() - if type(deviceNames) == types.StringType: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.setSystems(systemPaths) - if REQUEST: return self() - - def setLocation(self, locationPath=None, deviceNames=None, REQUEST=None): - """ Provide a method to set device location from any organizer """ - if not locationPath or not deviceNames: return self() - if type(deviceNames) == types.StringType: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.setLocation(locationPath) - if REQUEST: return self() - security.declareProtected('View', 'getEventDeviceInfo') def getEventDeviceInfo(self): """getEventDeviceInfo() -> return the info for NcoEventPopulator""" @@ -645,49 +619,8 @@ devs._setProperty("zWinPassword", "") devs._setProperty("zWinEventlogMinSeverity", 2, type="int") devs._setProperty("zWinEventlog", False, type="boolean") - - def removeDevices(self, deviceNames=None, REQUEST=None): - """see IManageDevice""" - if not deviceNames: return self() - if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.deleteDevice() - if REQUEST: - return self.callZenScreen(REQUEST) - - def unlockDevices(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): - """Unlock devices""" - if not deviceNames: return self() - if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.unlock(sendEventWhenBlocked) - if REQUEST: - return self.callZenScreen(REQUEST) - - def lockDevicesFromDeletion(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): - """Lock devices from being deleted""" - if not deviceNames: return self() - if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.lockFromDeletion(sendEventWhenBlocked) - if REQUEST: - return self.callZenScreen(REQUEST) - - def lockDevicesFromUpdates(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): - """Lock devices from being deleted or updated""" - if not deviceNames: return self() - if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) - for devname in deviceNames: - dev = self.findDevice(devname) - dev.lockFromUpdates(sendEventWhenBlocked) - if REQUEST: - return self.callZenScreen(REQUEST) - def zenPropertyOptions(self, propname): "Provide a set of default options for a ZProperty" if propname == 'zCollectorPlugins': Modified: trunk/Products/ZenModel/DeviceManagerBase.py =================================================================== --- trunk/Products/ZenModel/DeviceManagerBase.py 2007-04-24 18:35:34 UTC (rev 4830) +++ trunk/Products/ZenModel/DeviceManagerBase.py 2007-04-24 19:26:30 UTC (rev 4831) @@ -41,7 +41,7 @@ if REQUEST: REQUEST['RESPONSE'].redirect(target.getPrimaryUrlPath()) - + ''' def removeDevices(self, deviceNames=None, REQUEST=None): """see IManageDevice""" if not deviceNames: return self() @@ -49,3 +49,73 @@ for devname in deviceNames: self.devices._delObject(devname) if REQUEST: return self() + ''' + + def removeDevices(self, deviceNames=None, REQUEST=None): + """see IManageDevice""" + if not deviceNames: return self() + if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.deleteDevice() + if REQUEST: + return self.callZenScreen(REQUEST) + + + def setGroups(self, groupPaths=None, deviceNames=None, REQUEST=None): + """ Provide a method to set device groups from any organizer """ + if not groupPaths or not deviceNames: return self() + if type(deviceNames) == type(''): deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.setGroups(groupPaths) + if REQUEST: REQUEST['RESPONSE'].redirect(self.getPrimaryUrlPath()) + + def setSystems(self, systemPaths=None, deviceNames=None, REQUEST=None): + """ Provide a method to set device systems from any organizer """ + if not systemPaths or not deviceNames: return self() + if type(deviceNames) == types.StringType: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.setSystems(systemPaths) + if REQUEST: return self() + + def setLocation(self, locationPath=None, deviceNames=None, REQUEST=None): + """ Provide a method to set device location from any organizer """ + if not locationPath or not deviceNames: return self() + if type(deviceNames) == types.StringType: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.setLocation(locationPath) + if REQUEST: return self() + + + def unlockDevices(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): + """Unlock devices""" + if not deviceNames: return self() + if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.unlock(sendEventWhenBlocked) + if REQUEST: + return self.callZenScreen(REQUEST) + + def lockDevicesFromDeletion(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): + """Lock devices from being deleted""" + if not deviceNames: return self() + if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.lockFromDeletion(sendEventWhenBlocked) + if REQUEST: + return self.callZenScreen(REQUEST) + + def lockDevicesFromUpdates(self, deviceNames=None, sendEventWhenBlocked=None, REQUEST=None): + """Lock devices from being deleted or updated""" + if not deviceNames: return self() + if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) + for devname in deviceNames: + dev = self.devices._getOb(devname) + dev.lockFromUpdates(sendEventWhenBlocked) + if REQUEST: + return self.callZenScreen(REQUEST) \ No newline at end of file |
From: <sv...@ze...> - 2007-04-24 18:35:35
|
Author: jstevens Date: 2007-04-24 14:35:34 -0400 (Tue, 24 Apr 2007) New Revision: 4830 Removed: trunk/inst/docs/INSTALL_CentOS5.txt Modified: trunk/inst/docs/INSTALL_FC6.txt trunk/inst/docs/INSTALL_RHEL5.txt Log: Cleaning up some of the install docs. Deleted: trunk/inst/docs/INSTALL_CentOS5.txt Modified: trunk/inst/docs/INSTALL_FC6.txt =================================================================== --- trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 17:39:44 UTC (rev 4829) +++ trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 18:35:34 UTC (rev 4830) @@ -9,7 +9,7 @@ Installation Technique: Manual Install -These instructions are for install the Zenoss RPM. This version works +These instructions are for installing the Zenoss RPM. This version works with FC6, but it should work with FC5 and previous Fedora Core installations with minor modifications (mostly to dependent RPM versions). Follow these steps on the machine where you want to run @@ -19,26 +19,15 @@ packages Zenoss depends on in order to properly function. To run yum, issue the following command: -GOOD??? # yum -y install mysql mysql-server net-snmp net-snmp-utils -BAD - # yum -y install net-snmp net-snmp-utils perl-Digest-HMAC perl-DBI - # yum -y install mysql mysql-server - # yum -y install net-snmp net-snmp-utils perl-Net-SNMP +2. Download the latest Zenoss RPM from the SourceForge downloads + page, and install it using the following command: -2. Zenoss also depends on some RPMs that are not included in YUM - distributions. These dependencies are bundled together in the - "zenoss-deps" distribution for your convenience. Download the - zenoss-deps from the Zenoss downloads page under "Zenoss Red Hat - RPM Dependencies", and install them using the following command: + # rpm -ivh zenoss-1.1.2-0.fc6.i386.rpm - # wget http://dev.zenoss.org/downloads/zenoss-deps-fc6-1.1.0.i386.tar.bz2 - # tar xjf zenoss-deps-fc6-1.1.0.i386.tar.bz2 - # cd zenoss-deps; rpm -Uvh *.rpm - 3. In order to allow the SNMP Daemon to read CPU information SE Linux must be disabled. This can be achieved using the following command (Note: if you have a better alternative please share it @@ -52,22 +41,17 @@ # /etc/init.d/snmpd start -5. Start Zenoss using the command: +5. Start MySQL using the command: - # /etc/init.d/zenoss start + # /etc/init.d/mysql start -6. Open a hole in the firewall policy to allow inbound TCP traffic to - port 8080. This allows you to view the Zenoss Console. +6. Start Zenoss using the command: - # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT + # /etc/init.d/zenoss start -Installation Technique: Automated Install +7. Open a hole in the firewall policy to allow inbound TCP traffic to + port 8080. This allows you to view the Zenoss Console. -1. Download the installer via wget and execute it via the "sh" - command. - - # wget http://www.zenoss.com/download/latest/installer_fc6w -O install.sh - # sh install.sh - + # iptables -I RH-Firewall-1-INPUT -p tcp --dport 8080 -j ACCEPT Modified: trunk/inst/docs/INSTALL_RHEL5.txt =================================================================== --- trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 17:39:44 UTC (rev 4829) +++ trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 18:35:34 UTC (rev 4830) @@ -2,10 +2,10 @@ Installation Technique: Manual Install -These instructions are for installing the Zenoss RPM (Red Hat Package -Manager). This version works with Red Hat -Enterprise Linux version 5. Follow these steps on the machine where -you want to run Zenoss. Note: All commands should be run as root. +These instructions are for installing the Zenoss RPM (Red Hat Package Manager). +This version works with Red Hat Enterprise Linux version 5. Follow these steps +on the machine where you want to run Zenoss. Note: All commands should be run +as root. 1. The Yellow Dog Updater, Modified (YUM) is used to install several packages Zenoss depends on in order to properly function. To |
From: <sv...@ze...> - 2007-04-24 17:39:46
|
Author: marc Date: 2007-04-24 13:39:44 -0400 (Tue, 24 Apr 2007) New Revision: 4829 Modified: trunk/Products/ZenModel/IpService.py trunk/Products/ZenModel/WinService.py trunk/Products/ZenModel/skins/zenmodel/ipServiceDetail.pt trunk/Products/ZenModel/skins/zenmodel/osProcessDetail.pt trunk/Products/ZenModel/skins/zenmodel/winServiceDetail.pt Log: #1215 * Fixed selected option on status dropdown * on IpService * on WinService * on OSProcess * Fixed name/id attribute and save error Modified: trunk/Products/ZenModel/IpService.py =================================================================== --- trunk/Products/ZenModel/IpService.py 2007-04-24 16:21:09 UTC (rev 4828) +++ trunk/Products/ZenModel/IpService.py 2007-04-24 17:39:44 UTC (rev 4829) @@ -34,7 +34,7 @@ s = IpService(id) context._setObject(id, s) s = context._getOb(id) - setattr(s, 'name', id) + #setattr(s, 'name', id) setattr(s, 'protocol', protocol) setattr(s, 'port', int(port)) args = {'protocol':protocol, 'port':int(port)} @@ -179,15 +179,14 @@ security.declareProtected('Manage DMD', 'manage_editService') - def manage_editService(self, status, name, ipaddresses, protocol, port, description, + def manage_editService(self, status, id, ipaddresses, protocol, port, description, monitor=False, severity=5, sendString="", expectRegex="", REQUEST=None): """Edit a Service from a web page. """ - if name != self.name: + if id != self.id: self.ipservices._remoteRemove(self) - setattr(self, 'name', name) - setattr(self, 'id', name) + setattr(self, 'id', id) self.ipservices._setObject(name, self) setattr(self, 'status', status) Modified: trunk/Products/ZenModel/WinService.py =================================================================== --- trunk/Products/ZenModel/WinService.py 2007-04-24 16:21:09 UTC (rev 4828) +++ trunk/Products/ZenModel/WinService.py 2007-04-24 17:39:44 UTC (rev 4829) @@ -24,7 +24,7 @@ s = WinService(id) context._setObject(id, s) s = context._getOb(id) - setattr(s, 'name', id) + #setattr(s, 'name', id) setattr(s, 'description', description) args = {'name':id, 'description':description} s.setServiceClass(args) @@ -124,7 +124,7 @@ security.declareProtected('Manage DMD', 'manage_editService') def manage_editService(self, status, - name, description, + id, description, acceptPause, acceptStop, pathName, serviceType, startMode, startName, @@ -133,11 +133,10 @@ """Edit a Service from a web page. """ serviceClassChanged = False - if name != self.name: + if id != self.id: serviceClassChanged = True self.winservices._remoteRemove(self) - setattr(self, 'name', name) - setattr(self, 'id', name) + setattr(self, 'id', id) self.winservices._setObject(name, self) if description != self.description: Modified: trunk/Products/ZenModel/skins/zenmodel/ipServiceDetail.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/ipServiceDetail.pt 2007-04-24 16:21:09 UTC (rev 4828) +++ trunk/Products/ZenModel/skins/zenmodel/ipServiceDetail.pt 2007-04-24 17:39:44 UTC (rev 4829) @@ -36,7 +36,7 @@ <option tal:repeat="status here/getStatusConversions" tal:content="python:status[0]" tal:attributes="value python:status[1]; - selected python:status==here.getStatus()" /> + selected python:status[1]==here.getStatus()" /> </select> </td> <td tal:condition="not:editable" @@ -52,12 +52,12 @@ <tr> <td class="tableheader">Name</td> <td class="tablevalues" tal:condition="not:editable" - tal:content="here/name"/> + tal:content="here/id"/> <td class="tablevalues" tal:condition="editable"> <input tal:attributes="class string:tablevalues; size string:50; - name string:name; - value here/name"> + name string:id; + value here/id"> </td> </tr> <tr> Modified: trunk/Products/ZenModel/skins/zenmodel/osProcessDetail.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/osProcessDetail.pt 2007-04-24 16:21:09 UTC (rev 4828) +++ trunk/Products/ZenModel/skins/zenmodel/osProcessDetail.pt 2007-04-24 17:39:44 UTC (rev 4829) @@ -38,7 +38,7 @@ <option tal:repeat="status here/getStatusConversions" tal:content="python:status[0]" tal:attributes="value python:status[1]; - selected python:status == here.getStatus()" /> + selected python:status[1]==here.getStatus()" /> </select> </td> <td tal:condition="not:editable" Modified: trunk/Products/ZenModel/skins/zenmodel/winServiceDetail.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/winServiceDetail.pt 2007-04-24 16:21:09 UTC (rev 4828) +++ trunk/Products/ZenModel/skins/zenmodel/winServiceDetail.pt 2007-04-24 17:39:44 UTC (rev 4829) @@ -50,7 +50,7 @@ <option tal:repeat="status here/getStatusConversions" tal:content="python:status[0]" tal:attributes="value python:status[1]; - selected python:status==here.getStatus()" /> + selected python:status[1]==here.getStatus()" /> </select> </td> <td tal:condition="not:editable" @@ -94,12 +94,12 @@ </td> <td class="tableheader">Cmd Name</td> <td class="tablevalues" tal:condition="not:editable" - tal:content="here/name"/> + tal:content="here/id"/> <td class="tablevalues" tal:condition="editable"> <input tal:condition="editable" tal:attributes="class string:tablevalues; - name string:name; - value here/name"> + name string:id; + value here/id"> </td> </tr> <tr> |
From: <sv...@ze...> - 2007-04-24 16:21:09
|
Author: ahajda Date: 2007-04-24 12:21:09 -0400 (Tue, 24 Apr 2007) New Revision: 4828 Modified: trunk/wmi/Samba/source/lib/com/dcom/main.c Log: Removed additional event context creation by kerberos routines. Modified: trunk/wmi/Samba/source/lib/com/dcom/main.c =================================================================== --- trunk/wmi/Samba/source/lib/com/dcom/main.c 2007-04-24 14:47:21 UTC (rev 4827) +++ trunk/wmi/Samba/source/lib/com/dcom/main.c 2007-04-24 16:21:09 UTC (rev 4828) @@ -56,6 +56,7 @@ for (c = ctx->dcom->credentials; c; c = c->next) { if ((server == NULL && c->server == NULL) ||(server && c->server && !strcmp(c->server, server))) { c->credentials = credentials; + talloc_steal(ctx->event_ctx, c->credentials); return; } } @@ -63,6 +64,7 @@ c = talloc(ctx, struct dcom_server_credentials); c->server = talloc_strdup(ctx, server); c->credentials = credentials; + talloc_steal(ctx->event_ctx, c->credentials); DLIST_ADD(ctx->dcom->credentials, c); } @@ -70,7 +72,7 @@ { ctx->dcom = talloc_zero(ctx, struct dcom_client_context); if (!credentials) { - credentials = cli_credentials_init(ctx); + credentials = cli_credentials_init(ctx->event_ctx); cli_credentials_set_conf(credentials); cli_credentials_parse_string(credentials, "%", CRED_SPECIFIED); } @@ -121,7 +123,7 @@ TALLOC_CTX *loc_ctx; if (server == NULL) { - return dcerpc_pipe_connect(ctx, p, "ncalrpc", + return dcerpc_pipe_connect(ctx->event_ctx, p, "ncalrpc", &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, NULL), ctx->event_ctx); } @@ -131,7 +133,7 @@ if (NT_STATUS_IS_OK(dcerpc_parse_binding(loc_ctx, server, &bd))) { if (DEBUGLVL(9)) bd->flags |= DCERPC_DEBUG_PRINT_BOTH; - status = dcerpc_pipe_connect_b(ctx, p, bd, + status = dcerpc_pipe_connect_b(ctx->event_ctx, p, bd, &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, bd->host), ctx->event_ctx); goto end; @@ -144,7 +146,7 @@ status = NT_STATUS_NO_MEMORY; goto end; } - status = dcerpc_pipe_connect(ctx, p, binding, &dcerpc_table_IRemoteActivation, + status = dcerpc_pipe_connect(ctx->event_ctx, p, binding, &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, server), ctx->event_ctx); if (NT_STATUS_IS_OK(status)) { @@ -408,11 +410,10 @@ binding->flags |= DCERPC_AUTH_NTLM | DCERPC_SIGN; if (DEBUGLVL(9)) binding->flags |= DCERPC_DEBUG_PRINT_BOTH; - status = dcerpc_pipe_connect_b(ox, &p, binding, + status = dcerpc_pipe_connect_b(iface->ctx->event_ctx, &p, binding, idl_iface_by_uuid(&iid), dcom_get_server_credentials(iface->ctx, binding->host), iface->ctx->event_ctx); - /* FIXME:avg Destructor should clean oxid pipe reference */ } talloc_free(binding); if (NT_STATUS_IS_OK(status)) break; |
From: <sv...@ze...> - 2007-04-24 14:47:21
|
Author: marc Date: 2007-04-24 10:47:21 -0400 (Tue, 24 Apr 2007) New Revision: 4827 Added: trunk/Products/ZenModel/skins/zenmodel/discoverLoggingHeader.pt trunk/Products/ZenModel/skins/zenmodel/loggingFooter.dtml Modified: trunk/Products/ZenModel/Device.py trunk/Products/ZenModel/IpNetwork.py trunk/Products/ZenModel/ZDeviceLoader.py trunk/Products/ZenModel/skins/zenmodel/deviceLoggingFooter.dtml trunk/Products/ZenModel/skins/zenmodel/deviceLoggingHeader.pt Log: #1293 * Fixed tables on loader pages Modified: trunk/Products/ZenModel/Device.py =================================================================== --- trunk/Products/ZenModel/Device.py 2007-04-24 13:50:00 UTC (rev 4826) +++ trunk/Products/ZenModel/Device.py 2007-04-24 14:47:21 UTC (rev 4827) @@ -1162,6 +1162,9 @@ response = REQUEST.RESPONSE dlh = self.deviceLoggingHeader() idx = dlh.rindex("</table>") + dlh = dlh[:idx] + idx = dlh.rindex("</table>") + dlh = dlh[:idx] response.write(str(dlh[:idx])) handler = setWebLoggingStream(response) @@ -1179,7 +1182,7 @@ log.info('collected snmp information for device %s',self.id) if REQUEST and setlog: - response.write(self.deviceLoggingFooter()) + response.write(self.loggingFooter()) clearWebLoggingStream(handler) Modified: trunk/Products/ZenModel/IpNetwork.py =================================================================== --- trunk/Products/ZenModel/IpNetwork.py 2007-04-24 13:50:00 UTC (rev 4826) +++ trunk/Products/ZenModel/IpNetwork.py 2007-04-24 14:47:21 UTC (rev 4827) @@ -419,8 +419,11 @@ if REQUEST: response = REQUEST.RESPONSE - dlh = self.deviceLoggingHeader() + dlh = self.discoverLoggingHeader() idx = dlh.rindex("</table>") + dlh = dlh[:idx] + idx = dlh.rindex("</table>") + dlh = dlh[:idx] response.write(str(dlh[:idx])) handler = setWebLoggingStream(response) Modified: trunk/Products/ZenModel/ZDeviceLoader.py =================================================================== --- trunk/Products/ZenModel/ZDeviceLoader.py 2007-04-24 13:50:00 UTC (rev 4826) +++ trunk/Products/ZenModel/ZDeviceLoader.py 2007-04-24 14:47:21 UTC (rev 4827) @@ -1,16 +1,8 @@ -########################################################################### +############################################################################### # -# This program is part of Zenoss Core, an open source monitoring platform. -# Copyright (C) 2007, Zenoss Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published by -# the Free Software Foundation. -# -# For complete information please visit: http://www.zenoss.com/oss/ -# -########################################################################### # Copyright (c) 2004 Zentinel Systems. +# +############################################################################### __doc__="""ZDeviceLoader.py @@ -106,6 +98,9 @@ response = REQUEST.RESPONSE dlh = self.deviceLoggingHeader() idx = dlh.rindex("</table>") + dlh = dlh[:idx] + idx = dlh.rindex("</table>") + dlh = dlh[:idx] response.write(str(dlh[:idx])) handler = setWebLoggingStream(response) try: Modified: trunk/Products/ZenModel/skins/zenmodel/deviceLoggingFooter.dtml =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/deviceLoggingFooter.dtml 2007-04-24 13:50:00 UTC (rev 4826) +++ trunk/Products/ZenModel/skins/zenmodel/deviceLoggingFooter.dtml 2007-04-24 14:47:21 UTC (rev 4827) @@ -1,4 +1,7 @@ - </table> +</table> +</td> +</tr> +</table> </div> </div> </div> Modified: trunk/Products/ZenModel/skins/zenmodel/deviceLoggingHeader.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/deviceLoggingHeader.pt 2007-04-24 13:50:00 UTC (rev 4826) +++ trunk/Products/ZenModel/skins/zenmodel/deviceLoggingHeader.pt 2007-04-24 14:47:21 UTC (rev 4827) @@ -27,11 +27,23 @@ <div metal:use-macro="here/templates/macros/tabsPane"/> <script type="text/javascript">zenPageInit()</script> <div id="contentPane"> - <table class=" zentable" cellpadding="3" cellspacing="1"> - <tr><th class="tabletitle" colspan="4">Collection Log</th></tr> + + <table class=" zentable"> <tr> + <th class="tabletitle" colspan="1"> + <div class="tabletitlecontainer"> + <div class="leftcorner"> </div> + <span class="tabletitletext">Load Device</span> + <div class="rightcorner"> </div> + </div> + </th> + </tr> + <tr> + <td style="padding:0px;"> + <table class="innerzentable" cellpadding="3" cellspacing="1"> + <tr> <th class="tableheader">Time</th> <th class="tableheader">Level</th> <th class="tableheader">Module</th> <th class="tableheader">Message</th> - </tr> + </tr> \ No newline at end of file Added: trunk/Products/ZenModel/skins/zenmodel/discoverLoggingHeader.pt Added: trunk/Products/ZenModel/skins/zenmodel/loggingFooter.dtml |
Author: ian Date: 2007-04-24 09:50:00 -0400 (Tue, 24 Apr 2007) New Revision: 4826 Added: trunk/Products/ZenWidgets/skins/zenui/css/zengrid.css trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js Modified: trunk/Products/ZenEvents/EventManagerBase.py trunk/Products/ZenEvents/ZEvent.py trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt trunk/Products/ZenEvents/skins/zenevents/viewHistoryEvents.pt trunk/Products/ZenEvents/skins/zenevents/zeneventsfuncs.js trunk/Products/ZenModel/DataRoot.py trunk/Products/ZenUtils/js/zenutils.js trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js trunk/Products/ZenWidgets/skins/zenui/zenuimacros.pt Log: * fixes #938: Added the ZenGrid widget, providing asynchronous views of tabular data * History and Events templates now use the ZenGrid * Async fetch params still not quite kosher. Am fixing those. Modified: trunk/Products/ZenEvents/EventManagerBase.py =================================================================== --- trunk/Products/ZenEvents/EventManagerBase.py 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenEvents/EventManagerBase.py 2007-04-24 13:50:00 UTC (rev 4826) @@ -29,7 +29,7 @@ from AccessControl import getSecurityManager from Globals import InitializeClass from Globals import DTMLFile -from Acquisition import aq_base +from Acquisition import aq_base, aq_parent import DateTime from AccessControl import Permissions as permissions @@ -270,7 +270,8 @@ def getEventList(self, resultFields=[], where="", orderby="", severity=None, - state=0, startdate=None, enddate=None, offset=0, rows=0): + state=0, startdate=None, enddate=None, offset=0, rows=0, + getTotalCount=False, filter=""): """see IEventList. """ try: @@ -278,14 +279,20 @@ resultFields = self.defaultResultFields resultFields = list(resultFields) resultFields.extend(self.defaultFields) - - select = ["select ", ','.join(resultFields), + calcfoundrows = '' + if getTotalCount: + calcfoundrows = 'SQL_CALC_FOUND_ROWS' + select = ["select ", calcfoundrows, ','.join(resultFields), "from %s where" % self.statusTable ] if not where: where = self.defaultWhere where = self._wand(where, "%s >= %s", self.severityField, severity) where = self._wand(where, "%s <= %s", self.stateField, state) + if filter: + where += ' and (%s) ' % (' or '.join(['%s LIKE "%%%s%%"' % ( + x, filter) for x in resultFields])) + log.info(where) if startdate: startdate, enddate = self._setupDateRange(startdate, enddate) where += " and %s >= '%s' and %s <= '%s'" % ( @@ -301,12 +308,15 @@ select.append("limit %d, %d" % (offset, rows)) select.append(';') select = " ".join(select) - #print select - retdata = self.checkCache(select) - if not retdata: + if getTotalCount: + try: retdata, totalCount = self.checkCache(select) + except TypeError: retdata, totalCount = self.checkCache(select), 100 + else: retdata = self.checkCache(select) + if not False: conn = self.connect() try: curs = conn.cursor() + log.info(select) curs.execute(select) retdata = [] # iterate through the data results and convert to python @@ -315,10 +325,16 @@ row = map(self.convert, resultFields, row) evt = ZEvent(self, resultFields, row) retdata.append(evt) + if getTotalCount: + curs.execute("SELECT FOUND_ROWS()") + totalCount = curs.fetchone()[0] finally: self.close(conn) - self.addToCache(select, retdata) + if getTotalCount: self.addToCache(select, (retdata, totalCount)) + else: self.addToCache(select, retdata) self.cleanCache() - return retdata + if getTotalCount: + return retdata, totalCount + else: return retdata except: log.exception("Failure querying events") raise @@ -372,7 +388,6 @@ conn = self.connect() try: curs = conn.cursor() - #print selectevent curs.execute(selectevent) evrow = curs.fetchone() if not evrow: @@ -411,7 +426,6 @@ self.cleanCache() return event - def getStatusME(self, me, statusclass=None, **kwargs): """ """ @@ -922,20 +936,56 @@ REQUEST.RESPONSE.setHeader("Pragma", "no-cache") return info + security.declareProtected('View','getJSONHistoryEventsInfo') + def getJSONHistoryEventsInfo(self, **kwargs): + kwargs['history'] = True + return self.getJSONEventsInfo(**kwargs) - security.declareProtected('View','getJSONEventsInfo') - def getJSONEventsInfo(self, fields=[], simple=False, REQUEST=None): + def getJSONEventsInfo(self, offset=0, count=50, fields=[], + getTotalCount=True, + filter='', severity=2, state=1, + orderby='', history=False, REQUEST=None): """ Event data in JSON format. """ + argnames = 'offset count getTotalCount filter severity state orderby'.split() + myargs = {} + for arg in argnames: + try: + try: myargs[arg] = int(REQUEST[arg]) + except ValueError: myargs[arg] = REQUEST[arg] + except KeyError: myargs[arg] = eval(arg) + myargs['rows'] = myargs['count']; del myargs['count'] + if myargs['orderby']=='count': myargs['orderby']=='rows'; if not fields: fields = self.defaultResultFields - data = self.getEventList() - data = [x.getDataForJSON(fields) for x in data] - final = (fields, data) - return simplejson.dumps(final) + if history: data, totalCount = self.dmd.ZenEventHistory.getEventList(**myargs) + else: data, totalCount = self.getEventList(**myargs) + results = [x.getDataForJSON(fields) + [x.getCssClass()] for x in data] + return simplejson.dumps((results, totalCount)) + security.declareProtected('View','getJSONFields') + def getJSONFields(self, fields=[]): + if not fields: fields = self.defaultResultFields + lens = map(self.getAvgFieldLength, fields) + total = sum(lens) + lens = map(lambda x:x/total*100, lens) + zipped = zip(fields, lens) + return simplejson.dumps(zipped) + def getAvgFieldLength(self, fieldname): + conn = self.connect() + try: + curs = conn.cursor() + selstatement = ("SELECT AVG(CHAR_LENGTH(mycol)) FROM (SELECT %s AS " + "mycol FROM %s LIMIT 50) AS a;") % (fieldname, + self.statusTable) + curs.execute(selstatement) + avglen = curs.fetchone() + finally: self.close(conn) + if not avglen: return 0. + else: return float(avglen[0]) + #========================================================================== # Event sending functions Modified: trunk/Products/ZenEvents/ZEvent.py =================================================================== --- trunk/Products/ZenEvents/ZEvent.py 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenEvents/ZEvent.py 2007-04-24 13:50:00 UTC (rev 4826) @@ -40,12 +40,8 @@ def getDataForJSON(self, fields): """ returns data ready for serialization """ - def val(field): return getattr(self, field, None) - data = dict([(field, val(field)) for field in fields]) - data['cssclass']=self.getCssClass() - return data + return map(lambda x:getattr(self, x, None), list(fields)+['evid']) - def getDataListWithLinks(self, fields, cssClass=''): """return a list of data elements that map to the fields parameter. """ Modified: trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt =================================================================== --- trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenEvents/skins/zenevents/viewEvents.pt 2007-04-24 13:50:00 UTC (rev 4826) @@ -2,8 +2,11 @@ <tal:block metal:fill-slot="contentPane"> <script type="text/javascript" src="/zport/js/zenutils.js"></script> +<script type="text/javascript" src="/zport/javascript/zengrid.js"></script> <script type="text/javascript" src="/zport/portal_skins/zenevents/zeneventsfuncs.js"></script> +<style> +</style> <form name="control" method="post" tal:attributes="action here/absolute_url_path" tal:define=" @@ -27,8 +30,7 @@ <tal:block metal:fill-slot="filterslot"> <div class="temp_filterbox"> Sev - <select class="tableheader" name="severity:int" id="severity" - onchange="getTablePage(this.form)"> + <select class="tableheader" name="severity:int" id="severity"> <option tal:repeat="sev here/ZenEventManager/getSeverities" tal:content="python:sev[0]" tal:attributes="value python:sev[1]; @@ -36,8 +38,7 @@ </select> State - <select class="tableheader" name="state:int" id="state" - onchange="getTablePage(this.form)"> + <select class="tableheader" name="state:int" id="state"> <option tal:repeat="st here/ZenEventManager/getEventStates" tal:content="python:st[0]" tal:attributes="value python:st[1]; @@ -49,13 +50,25 @@ onclick="startRefresh(this, this.form);"> <input class="tableheader" type="text" name="refreshRate" size='2' value='60'> - <tal:block metal:use-macro="here/zenuimacros/macros/filterboxinline"/> + <div class="filterbox" + tal:define=" tableName tableName | nothing; + ts request; + message request/SESSION/message | nothing;"> + <input type="text" name="filter" id="filter" + onfocus="select(this)" + tal:attributes="value ts/filter | string:;"/> + </div> + <style>.filterbox{position:relative;top:0px; + left:0px;right:0px;bottom:0px;display:inline; + padding-right:20px;margin-left:20px;}</style> </div> </tal:block> <tal:block metal:fill-slot="zentablecontents"> +<!-- BEGIN TABLE CONTENTS --> <tal:block metal:define-macro="header"> +<!-- <input type='hidden' name='sortedHeader' tal:attributes="value sortedHeader"/> <input type='hidden' name='sortedSence' value=""> @@ -87,9 +100,44 @@ onClick="toggleSelect(this.form);return false"/> </td> </tr> +--> </tal:block> +<tr><td> +<style> +.leftfloat { float:left } +td.cell { + font-family: Trebuchet,verdana,helvetica,sans-serif; + font-size: 11px; + line-height: 12px; + margin: 0px; + overflow: hidden; + white-space: nowrap; + border-spacing: 1px; + border: 1px solid #666; + height: 22px; + cursor: default; +} +</style> + +<div id="gridcontainer" style="width:100%;"> + +</div> + +<script> +addLoadEvent( function() { + var b = new ZenGridBuffer(); + var mygrid = new ZenGrid('gridcontainer', 'getJSONEventsInfo', + 'mygrid', b); + connect('filter', 'onkeyup', mygrid.doEventLivesearch); + connect('state', 'onchange', mygrid.refreshFromFormElement); + connect('severity', 'onchange', mygrid.refreshFromFormElement); +}); +</script> +</td></tr> +<!-- END TABLE CONTENTS --> </tal:block> + </tal:block> </tal:block> Modified: trunk/Products/ZenEvents/skins/zenevents/viewHistoryEvents.pt =================================================================== --- trunk/Products/ZenEvents/skins/zenevents/viewHistoryEvents.pt 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenEvents/skins/zenevents/viewHistoryEvents.pt 2007-04-24 13:50:00 UTC (rev 4826) @@ -4,6 +4,7 @@ <span metal:define-macro="body"> <script type="text/javascript"> var djConfig = { isDebug: true }; </script> <script type="text/javascript" src="/zport/js/zenutils.js"></script> +<script type="text/javascript" src="/zport/javascript/zengrid.js"></script> <script type="text/javascript" src="/zport/portal_skins/zenevents/zeneventsfuncs.js"></script> <script type="text/javascript" src="/zport/portal_skins/zenmodel/datePicker.js"> @@ -73,6 +74,7 @@ <tal:block metal:fill-slot="zentablecontents"> <!-- BEGIN TABLE CONTENTS --> + <!-- <tal:block metal:use-macro="here/viewEvents/macros/header"/> <tbody id="eventsBody"> <span metal:use-macro="here/getHistoryEventListPage/macros/page"/> @@ -86,6 +88,45 @@ </td> </tr> </tal:block> + --> +<tr><td> + +<style> +.leftfloat { float:left } +td.cell { + font-family: Trebuchet,verdana,helvetica,sans-serif; + font-size: 11px; + line-height: 12px; + margin: 0px; + overflow: hidden; + white-space: nowrap; + border-spacing: 1px; + border: 1px solid #666; + height: 22px; + cursor: default; +} +</style> + +<div id="gridcontainer" style="width:100%;"> + +</div> + +<script tal:content="string: + var thisurl = '${here/absolute_url_path}'"> + </script> + +<script> +addLoadEvent( function() { + var b = new ZenGridBuffer(); + var mygrid = new ZenGrid('gridcontainer', + thisurl + '/ZenEventHistory/getJSONEventsInfo', + 'mygrid', b); + connect('filter', 'onkeyup', mygrid.doEventLivesearch); + connect('state', 'onchange', mygrid.refreshFromFormElement); + connect('severity', 'onchange', mygrid.refreshFromFormElement); +}); +</script> +</td></tr> <!-- END TABLE CONTENTS --> </tal:block> Modified: trunk/Products/ZenEvents/skins/zenevents/zeneventsfuncs.js =================================================================== --- trunk/Products/ZenEvents/skins/zenevents/zeneventsfuncs.js 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenEvents/skins/zenevents/zeneventsfuncs.js 2007-04-24 13:50:00 UTC (rev 4826) @@ -65,7 +65,8 @@ //load the event list var getTablePage = function(form) { - log("getTablePage url=", form.url.value); + //log("getTablePage url=", form.url.value); + log(queryString(form)); var rate = parseInt(form.refreshRate.value) if (rate < 1) { @@ -122,7 +123,7 @@ var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode); if (charCode == 13 || charCode == 3) { - form.resetStart.value=1; + //form.resetStart.value=1; getTablePage(form); return false; } @@ -226,4 +227,13 @@ } } +var LSTimeout; +var doEventLivesearch = function(field, zengrid) { + filters = field.value; + clearTimeout(LSTimeout); + LSTimeout = setTimeout( + function () { zengrid.refreshWithParams({filter:filters}) }, + 500); +} + addLoadEvent(refreshData) Modified: trunk/Products/ZenModel/DataRoot.py =================================================================== --- trunk/Products/ZenModel/DataRoot.py 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenModel/DataRoot.py 2007-04-24 13:50:00 UTC (rev 4826) @@ -229,10 +229,27 @@ return self.ZenEventManager.getEventList(**kwargs) + def getEventCount(self, **kwargs): + """Return the current event list for this managed entity. + """ + return self.ZenEventManager.getEventCount(**kwargs) + + + def getJSONHistoryEventsInfo(self, **kwargs): + kwargs['REQUEST'] = self.REQUEST + return self.ZenEventHistory.getJSONEventsInfo(**kwargs) + + def getJSONEventsInfo(self, **kwargs): """Return the current event list for this managed entity. """ + kwargs['REQUEST'] = self.REQUEST return self.ZenEventManager.getJSONEventsInfo(**kwargs) + + def getJSONFields(self, **kwargs): + """Return the current event list for this managed entity. + """ + return self.ZenEventManager.getJSONFields(**kwargs) def getDmdRoots(self): Modified: trunk/Products/ZenUtils/js/zenutils.js =================================================================== --- trunk/Products/ZenUtils/js/zenutils.js 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenUtils/js/zenutils.js 2007-04-24 13:50:00 UTC (rev 4826) @@ -21,3 +21,26 @@ return res; }); }; + +function handle(delta) { + if (delta < 0) + /* something. */; + else + /* something. */; +} + +function wheel(event){ + var delta = 0; + if (!event) event = window.event; + if (event.wheelDelta) { + delta = event.wheelDelta/120; + if (window.opera) delta = -delta; + } else if (event.detail) { + delta = -event.detail/3; + } + if (delta) + handle(delta); + if (event.preventDefault) + event.preventDefault(); + event.returnValue = false; +} Added: trunk/Products/ZenWidgets/skins/zenui/css/zengrid.css Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js 2007-04-24 13:50:00 UTC (rev 4826) @@ -3,7 +3,7 @@ var isCheckbox = function(elem) { return (elem.type=='checkbox') } -function getCheckboxes() { +function getCheckboxes(elem) { var inputs = getElementsByTagAndClassName('input', null); return filter(isCheckbox, inputs); } @@ -14,11 +14,14 @@ newstate = -checkboxes[end].checked; var todo = checkboxes.slice(a, b+1); for (i=0;(box=todo[i]);i++) { - box.checked = newstate; + if ((!box.checked && newstate) || + (box.checked && !newstate)) box.click(); + //box.checked = newstate; } } function getIndex(box) { + log(checkboxes.length+" Checkboxes extant"); return findIdentical(checkboxes, box); } @@ -35,12 +38,13 @@ currentCheckbox = t; } +var CbCxs = new Array(); function connectCheckboxListeners() { -checkboxes = getCheckboxes(); + disconnectAllTo(handleChange); + checkboxes = getCheckboxes(); for (i=0; i<checkboxes.length; i++){ var box = checkboxes[i]; connect(box, 'onkeypress', handleChange); - disconnectAll(box, 'onclick'); connect(box, 'onclick', handleChange); } } Added: trunk/Products/ZenWidgets/skins/zenui/javascript/zengrid.js Modified: trunk/Products/ZenWidgets/skins/zenui/zenuimacros.pt =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/zenuimacros.pt 2007-04-24 13:04:51 UTC (rev 4825) +++ trunk/Products/ZenWidgets/skins/zenui/zenuimacros.pt 2007-04-24 13:50:00 UTC (rev 4826) @@ -139,7 +139,7 @@ <input type="text" name="filter" id="filter" onfocus="select(this)" tal:attributes="value ts/filter | string:; - onkeypress python:test(tableName, 'submitViaEnter(event)', + onkeypress python:test(tableName, 'handleFilterbox(event)', 'getPageViaEnter(event)' )" /> </div> </tal:block> |
From: <sv...@ze...> - 2007-04-24 13:04:55
|
Author: marc Date: 2007-04-24 09:04:51 -0400 (Tue, 24 Apr 2007) New Revision: 4825 Modified: trunk/Products/ZenModel/skins/zenmodel/editStatusMonitorConf.pt trunk/Products/ZenModel/skins/zenmodel/viewStatusMonitorOverview.pt Log: #1278 * snmpCycleInterval is removed from the UI Modified: trunk/Products/ZenModel/skins/zenmodel/editStatusMonitorConf.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/editStatusMonitorConf.pt 2007-04-24 12:48:03 UTC (rev 4824) +++ trunk/Products/ZenModel/skins/zenmodel/editStatusMonitorConf.pt 2007-04-24 13:04:51 UTC (rev 4825) @@ -64,11 +64,6 @@ <input class="tablevalues" type="text" name="cycleInterval:int" tal:attributes="value here/cycleInterval" /> </td> - <td class="tableheader" align="left">Snmp Cycle Interval (secs)</td> - <td class="tablevalues"> - <input class="tablevalues" type="text" name="snmpCycleInterval:int" - tal:attributes="value here/snmpCycleInterval" /> - </td> </tr> <tr> <td class="tableheader" align="left">Maximum Failures</td> Modified: trunk/Products/ZenModel/skins/zenmodel/viewStatusMonitorOverview.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/viewStatusMonitorOverview.pt 2007-04-24 12:48:03 UTC (rev 4824) +++ trunk/Products/ZenModel/skins/zenmodel/viewStatusMonitorOverview.pt 2007-04-24 13:04:51 UTC (rev 4825) @@ -46,10 +46,6 @@ <td class="tableheader" align="left">Cycle Interval</td> <td class="tablevalues" align="left" tal:content="here/cycleInterval">tries</td> - <td class="tableheader" align="left">Snmp Cycle Interval</td> - <td class="tablevalues" align="left" - tal:content="here/snmpCycleInterval">tries - </td> </tr> <tr> <td class="tableheader" align="left">Maximum Failures</td> |
From: <sv...@ze...> - 2007-04-24 12:48:29
|
Author: edahl Date: 2007-04-24 08:48:03 -0400 (Tue, 24 Apr 2007) New Revision: 4824 Modified: trunk/inst/docs/INSTALL_FC6.txt trunk/inst/docs/INSTALL_RHEL5.txt Log: * fixes Modified: trunk/inst/docs/INSTALL_FC6.txt =================================================================== --- trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 03:12:23 UTC (rev 4823) +++ trunk/inst/docs/INSTALL_FC6.txt 2007-04-24 12:48:03 UTC (rev 4824) @@ -19,6 +19,10 @@ packages Zenoss depends on in order to properly function. To run yum, issue the following command: +GOOD??? + # yum -y install mysql mysql-server net-snmp net-snmp-utils + +BAD # yum -y install net-snmp net-snmp-utils perl-Digest-HMAC perl-DBI # yum -y install mysql mysql-server # yum -y install net-snmp net-snmp-utils perl-Net-SNMP Modified: trunk/inst/docs/INSTALL_RHEL5.txt =================================================================== --- trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 03:12:23 UTC (rev 4823) +++ trunk/inst/docs/INSTALL_RHEL5.txt 2007-04-24 12:48:03 UTC (rev 4824) @@ -11,7 +11,7 @@ packages Zenoss depends on in order to properly function. To run yum, issue the following command: - # yum -y install mysql mysql-server net-snmp + # yum -y install mysql mysql-server net-snmp net-snmp-utils 2. Download the latest Zenoss RPM from the SourceForge downloads |
From: <sv...@ze...> - 2007-04-24 03:12:23
|
Author: ahajda Date: 2007-04-23 23:12:23 -0400 (Mon, 23 Apr 2007) New Revision: 4823 Modified: trunk/wmi/Samba/source/librpc/rpc/dcerpc.c trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c Log: Removed debugging code. Modified: trunk/wmi/Samba/source/librpc/rpc/dcerpc.c =================================================================== --- trunk/wmi/Samba/source/librpc/rpc/dcerpc.c 2007-04-24 03:04:38 UTC (rev 4822) +++ trunk/wmi/Samba/source/librpc/rpc/dcerpc.c 2007-04-24 03:12:23 UTC (rev 4823) @@ -337,7 +337,7 @@ return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info); } - ndr = ndr_push_init_ctx(mem_ctx);talloc_set_name(ndr, "MAMCIE1"); + ndr = ndr_push_init_ctx(mem_ctx); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -1291,7 +1291,7 @@ call = &table->calls[opnum]; /* setup for a ndr_push_* call */ - push = ndr_push_init_ctx(mem_ctx);talloc_set_name(push, "MAMCIE2"); + push = ndr_push_init_ctx(mem_ctx); if (!push) { return NULL; } Modified: trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c =================================================================== --- trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c 2007-04-24 03:04:38 UTC (rev 4822) +++ trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c 2007-04-24 03:12:23 UTC (rev 4823) @@ -56,7 +56,7 @@ NTSTATUS status; struct ndr_push *ndr; - ndr = ndr_push_init_ctx(mem_ctx);talloc_set_name(ndr, "MAMCIE3"); + ndr = ndr_push_init_ctx(mem_ctx); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -447,7 +447,7 @@ static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct dcerpc_syntax_id *syntax) { - struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx); talloc_set_name(ndr, "MAMCIE4"); + struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx); ndr->flags |= LIBNDR_FLAG_NOALIGN; |
From: <sv...@ze...> - 2007-04-24 03:04:39
|
Author: ahajda Date: 2007-04-23 23:04:38 -0400 (Mon, 23 Apr 2007) New Revision: 4822 Modified: trunk/wmi/Samba/source/wmi/wbemdata.c trunk/wmi/pycom/win32com/client.py Log: Added destructors to python code. Corrected destructors of smart IEnumWbemClassObject. Modified: trunk/wmi/Samba/source/wmi/wbemdata.c =================================================================== --- trunk/wmi/Samba/source/wmi/wbemdata.c 2007-04-24 02:23:25 UTC (rev 4821) +++ trunk/wmi/Samba/source/wmi/wbemdata.c 2007-04-24 03:04:38 UTC (rev 4822) @@ -581,6 +581,8 @@ return status; } +struct composite_context *dcom_proxy_IEnumWbemClassObject_Release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx); + WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct WbemClassObject **apObjects, uint32_t *puReturned) { WERROR result; @@ -607,6 +609,7 @@ WERR_CHECK("Retrieve enumerator of result(IWbemWCOSmartEnum)."); ecod->guid = GUID_random(); + d->vtable->Release_send = dcom_proxy_IEnumWbemClassObject_Release_send; } result = IWbemWCOSmartEnum_Next(ecod->pSE, loc_ctx, &ecod->guid, lTimeout, uCount, puReturned, &size, &data); @@ -646,6 +649,8 @@ ecod = d->object_data; if (ecod) { + talloc_steal(d, ecod->pFSE); + talloc_steal(d, ecod->pSE); iref[1].ipid = IUnknown_ipid(ecod->pFSE); iref[1].cPublicRefs = 5; iref[1].cPrivateRefs = 0; @@ -666,7 +671,7 @@ GUID_from_string("4590f812-1d3a-11d0-891f-00aa004b2e24", &clsid); dcom_register_marshal(&clsid, marshal, unmarshal); -#if 1 +#if 0 struct IEnumWbemClassObject_vtable *proxy_vtable; proxy_vtable = (struct IEnumWbemClassObject_vtable *)dcom_proxy_vtable_by_iid((struct GUID *)&dcerpc_table_IEnumWbemClassObject.syntax_id.uuid); if (proxy_vtable) Modified: trunk/wmi/pycom/win32com/client.py =================================================================== --- trunk/wmi/pycom/win32com/client.py 2007-04-24 02:23:25 UTC (rev 4821) +++ trunk/wmi/pycom/win32com/client.py 2007-04-24 03:04:38 UTC (rev 4822) @@ -25,6 +25,9 @@ class SWbemServices: def __init__(self, services): self.services = services + def __del__(self): +# print >> sys.stderr, "SWbemServices.__del__(%s)" % self.services + pywmi.IUnknown_Release(self.services) def ExecQuery(self, strQuery, strQueryLanguage = "WQL", iFlags = wbemFlagReturnImmediately, objWbemNamedValueSet = None): enum = pywmi.IWbemServices_ExecQuery(self.services, strQueryLanguage, strQuery, iFlags, objWbemNamedValueSet) return SWbemObjectSet(enum, iFlags) @@ -39,6 +42,9 @@ def __init__(self, enum, flags): self.enum = enum self.flags = flags + def __del__(self): +# print >> sys.stderr, "SWbemObjectSet.__del__(%s)" % self.enum + pywmi.IUnknown_Release(self.enum) def __iter__(self): if not (self.flags & wbemFlagForwardOnly): pywmi.IEnumWbemClassObject_Reset(self.enum) @@ -55,6 +61,9 @@ class SWbemEventSource: def __init__(self, enum): self.enum = enum + def __del__(self): +# print >> sys.stderr, "SWbemEventSource.__del__(%s)" % self.enum + pywmi.IUnknown_Release(self.enum) def NextEvent(self, iTimeoutMs = wbemTimeoutInfinite): try: o, = pywmi.IEnumWbemClassObject_SmartNext(self.enum, iTimeoutMs, 1) |
From: <sv...@ze...> - 2007-04-24 02:23:28
|
Author: ahajda Date: 2007-04-23 22:23:25 -0400 (Mon, 23 Apr 2007) New Revision: 4821 Modified: trunk/wmi/Samba/source/lib/com/dcom/dcom.h trunk/wmi/Samba/source/lib/com/dcom/main.c trunk/wmi/Samba/source/librpc/idl/winreg.idl trunk/wmi/Samba/source/librpc/rpc/dcerpc.c trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm trunk/wmi/Samba/source/scripting/swig/samba.i trunk/wmi/Samba/source/wmi/config.mk trunk/wmi/Samba/source/wmi/pywmi.i trunk/wmi/Samba/source/wmi/wbemdata.c trunk/wmi/Samba/source/wmi/wmicore.c Log: Removed memory leaks(some are Samba specific). IUnknown_Release should now work correctly. pidl/DCOM vtable changes. Initial work for PDH implementation. Modified: trunk/wmi/Samba/source/lib/com/dcom/dcom.h =================================================================== --- trunk/wmi/Samba/source/lib/com/dcom/dcom.h 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/lib/com/dcom/dcom.h 2007-04-24 02:23:25 UTC (rev 4821) @@ -42,7 +42,8 @@ } *credentials; struct dcom_object_exporter { uint64_t oxid; - struct GUID ipidRemUnknown; +// struct GUID ipidRemUnknown; + struct IRemUnknown *rem_unknown; struct DUALSTRINGARRAY *bindings; struct dcerpc_pipe *pipe; struct dcom_object_exporter *prev, *next; @@ -64,4 +65,6 @@ return ntstatus_to_werror(_status); \ } while (0) +#define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid) + #endif /* _DCOM_H */ Modified: trunk/wmi/Samba/source/lib/com/dcom/main.c =================================================================== --- trunk/wmi/Samba/source/lib/com/dcom/main.c 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/lib/com/dcom/main.c 2007-04-24 02:23:25 UTC (rev 4821) @@ -118,13 +118,14 @@ const char * available_transports[] = { "ncacn_ip_tcp", "ncacn_np" }; int i; NTSTATUS status; - TALLOC_CTX *loc_ctx = talloc_init("dcom_connect"); + TALLOC_CTX *loc_ctx; if (server == NULL) { return dcerpc_pipe_connect(ctx, p, "ncalrpc", &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, NULL), ctx->event_ctx); } + loc_ctx = talloc_new(ctx); /* Allow server name to contain a binding string */ if (NT_STATUS_IS_OK(dcerpc_parse_binding(loc_ctx, server, &bd))) { @@ -133,17 +134,15 @@ status = dcerpc_pipe_connect_b(ctx, p, bd, &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, bd->host), ctx->event_ctx); - - talloc_free(loc_ctx); - return status; + goto end; } for (i = 0; i < ARRAY_SIZE(available_transports); i++) { char *binding = talloc_asprintf(loc_ctx, "%s:%s", available_transports[i], server); if (!binding) { - talloc_free(loc_ctx); - return NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; + goto end; } status = dcerpc_pipe_connect(ctx, p, binding, &dcerpc_table_IRemoteActivation, dcom_get_server_credentials(ctx, server), ctx->event_ctx); @@ -151,11 +150,11 @@ if (NT_STATUS_IS_OK(status)) { if (DEBUGLVL(9)) (*p)->conn->flags |= DCERPC_DEBUG_PRINT_BOTH; - talloc_free(loc_ctx); - return status; + goto end; } } +end: talloc_free(loc_ctx); return status; } @@ -223,6 +222,7 @@ WERROR hr; uint64_t oxid; struct GUID ipidRemUnknown; + struct IUnknown *ru_template; struct ORPCTHAT that; uint32_t AuthnHint; struct COMVERSION ServerVersion; @@ -235,7 +235,7 @@ return ntstatus_to_werror(status); } - loc_ctx = talloc_init("dcom_create_object"); + loc_ctx = talloc_new(ctx); ifaces = talloc_array(loc_ctx, struct MInterfacePointer *, num_ifaces); ZERO_STRUCT(r.in); @@ -261,20 +261,20 @@ status = dcerpc_RemoteActivation(p, loc_ctx, &r); if(NT_STATUS_IS_ERR(status)) { DEBUG(1, ("Error while running RemoteActivation %s\n", nt_errstr(status))); - talloc_free(loc_ctx); - return ntstatus_to_werror(status); + hr = ntstatus_to_werror(status); + goto end; } if(!W_ERROR_IS_OK(r.out.result)) { - talloc_free(loc_ctx); - return r.out.result; + hr = r.out.result; + goto end; } if(!W_ERROR_IS_OK(hr)) { - talloc_free(loc_ctx); - return hr; + goto end; } + ru_template = NULL; *ip = talloc_array(ctx, struct IUnknown *, num_ifaces); for (i = 0; i < num_ifaces; i++) { (*ip)[i] = NULL; @@ -282,48 +282,52 @@ status = dcom_IUnknown_from_OBJREF(ctx, &(*ip)[i], &r.out.ifaces[i]->obj); if (!NT_STATUS_IS_OK(status)) { results[i] = ntstatus_to_werror(status); - } + } else if (!ru_template) + ru_template = (*ip)[i]; } } m = object_exporter_update_oxid(ctx, oxid, pds); m->pipe = NULL; - m->ipidRemUnknown = ipidRemUnknown; + if (!ru_template) { + DEBUG(1,("dcom_create_object: Cannot Create IRemUnknown - template interface not available\n")); + hr = WERR_GENERAL_FAILURE; + } + m->rem_unknown = talloc_zero(m, struct IRemUnknown); + memcpy(m->rem_unknown, ru_template, sizeof(struct IUnknown)); + GUID_from_string(COM_IREMUNKNOWN_UUID, &m->rem_unknown->obj.iid); + m->rem_unknown->obj.u_objref.u_standard.std.ipid = ipidRemUnknown; + m->rem_unknown->vtable = (struct IRemUnknown_vtable *)dcom_proxy_vtable_by_iid(&m->rem_unknown->obj.iid); + /* TODO:avg copy stringbindigs?? */ + dcom_update_credentials_for_aliases(ctx, server, pds); - + hr = WERR_OK; +end: talloc_free(loc_ctx); - return WERR_OK; + return hr; } -#define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid) - WERROR dcom_query_interface(struct IUnknown *d, uint32_t cRefs, uint16_t cIids, struct GUID *iids, struct IUnknown **ip, WERROR *results) { struct dcom_object_exporter *ox; - struct IUnknown ru; - struct GUID iid; struct REMQIRESULT *rqir; WERROR result; NTSTATUS status; int i; TALLOC_CTX *loc_ctx; + struct IUnknown ru; + loc_ctx = talloc_new(d); ox = object_exporter_by_ip(d->ctx, d); - ru = *d; - GUID_from_string(COM_IREMUNKNOWN_UUID, &iid); - ru.vtable = dcom_proxy_vtable_by_iid(&iid); - ru.obj.iid = iid; - IUnknown_ipid(&ru) = ox->ipidRemUnknown; - loc_ctx = talloc_init("dcom_query_interface"); - - result = IRemUnknown_RemQueryInterface((struct IRemUnknown *)&ru, loc_ctx, &IUnknown_ipid(d), cRefs, cIids, iids, &rqir); + result = IRemUnknown_RemQueryInterface(ox->rem_unknown, loc_ctx, &IUnknown_ipid(d), cRefs, cIids, iids, &rqir); if (!W_ERROR_IS_OK(result)) { DEBUG(1, ("dcom_query_interface failed: %08X\n", W_ERROR_V(result))); talloc_free(loc_ctx); return result; } + ru = *(struct IUnknown *)ox->rem_unknown; for (i = 0; i < cIids; ++i) { ip[i] = NULL; results[i] = rqir[i].hResult; @@ -336,8 +340,8 @@ } } } + talloc_free(loc_ctx); - return WERR_OK; } @@ -408,6 +412,7 @@ idl_iface_by_uuid(&iid), dcom_get_server_credentials(iface->ctx, binding->host), iface->ctx->event_ctx); + /* FIXME:avg Destructor should clean oxid pipe reference */ } talloc_free(binding); if (NT_STATUS_IS_OK(status)) break; @@ -467,11 +472,14 @@ p->ctx = ctx; p->obj = *o; p->vtable = dcom_proxy_vtable_by_iid(&o->iid); + if (!p->vtable) { DEBUG(0, ("Unable to find proxy class for interface with IID %s\n", GUID_string(ctx, &o->iid))); return NT_STATUS_NOT_SUPPORTED; } + p->vtable->Release_send = dcom_release_send; + ox = object_exporter_by_oxid(ctx, o->u_objref.u_standard.std.oxid); /* FIXME: Add object to list of objects to ping */ *_p = p; @@ -536,6 +544,70 @@ return status; } +/* FIXME:avg put IUnknown_Release_out into header */ +struct IUnknown_Release_out { + uint32_t result; +}; + +void dcom_release_continue(struct composite_context *cr) +{ + struct composite_context *c; + struct IUnknown *d; + struct IUnknown_Release_out *out; + WERROR r; + + c = talloc_get_type(cr->async.private_data, struct composite_context); + d = c->private_data; + r = IRemUnknown_RemRelease_recv(cr); + talloc_free(d); + out = talloc_zero(c, struct IUnknown_Release_out); + out->result = W_ERROR_V(r); + c->private_data = out; + composite_done(c); +} + +struct composite_context *dcom_release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx) +{ + struct composite_context *c, *cr; + struct REMINTERFACEREF iref; + struct dcom_object_exporter *ox; + + c = composite_create(d->ctx, d->ctx->event_ctx); + if (c == NULL) return NULL; + c->private_data = d; + + ox = object_exporter_by_ip(d->ctx, d); + iref.ipid = IUnknown_ipid(d); + iref.cPublicRefs = 5; + iref.cPrivateRefs = 0; + cr = IRemUnknown_RemRelease_send(ox->rem_unknown, mem_ctx, 1, &iref); + + composite_continue(c, cr, dcom_release_continue, c); + return c; +} + +uint32_t dcom_release_recv(struct composite_context *c) +{ + NTSTATUS status; + WERROR r; + + status = composite_wait(c); + if (!NT_STATUS_IS_OK(status)) + r = ntstatus_to_werror(status); + else + W_ERROR_V(r) = ((struct IUnknown_Release_out *)c->private_data)->result; + talloc_free(c); + return W_ERROR_IS_OK(r) ? 0 : W_ERROR_V(r); +} + +uint32_t dcom_release(void *interface, TALLOC_CTX *mem_ctx) +{ + struct composite_context *c; + + c = dcom_release_send(interface, mem_ctx); + return dcom_release_recv(c); +} + void dcom_proxy_async_call_recv_pipe_send_rpc(struct composite_context *c_pipe) { struct composite_context *c; @@ -553,6 +625,6 @@ return; } - req = dcerpc_ndr_request_send(p, &s->d->obj.u_objref.u_standard.std.ipid, s->table, s->opnum, s->mem_ctx, s->r); + req = dcerpc_ndr_request_send(p, &s->d->obj.u_objref.u_standard.std.ipid, s->table, s->opnum, s, s->r); composite_continue_rpc(c, req, s->continuation, c); } Modified: trunk/wmi/Samba/source/librpc/idl/winreg.idl =================================================================== --- trunk/wmi/Samba/source/librpc/idl/winreg.idl 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/librpc/idl/winreg.idl 2007-04-24 02:23:25 UTC (rev 4821) @@ -345,7 +345,7 @@ /******************/ /* Function: 0x20 */ WERROR winreg_OpenHKPT( - [in] uint16 *system_name, + [in,string,charset(UTF16)] uint16 *system_name, [in] winreg_AccessMask access_mask, [out,ref] policy_handle *handle ); Modified: trunk/wmi/Samba/source/librpc/rpc/dcerpc.c =================================================================== --- trunk/wmi/Samba/source/librpc/rpc/dcerpc.c 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/librpc/rpc/dcerpc.c 2007-04-24 02:23:25 UTC (rev 4821) @@ -337,7 +337,7 @@ return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info); } - ndr = ndr_push_init_ctx(mem_ctx); + ndr = ndr_push_init_ctx(mem_ctx);talloc_set_name(ndr, "MAMCIE1"); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -1291,7 +1291,7 @@ call = &table->calls[opnum]; /* setup for a ndr_push_* call */ - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(mem_ctx);talloc_set_name(push, "MAMCIE2"); if (!push) { return NULL; } @@ -1364,6 +1364,7 @@ status = dcerpc_request_recv(req, mem_ctx, &response); if (!NT_STATUS_IS_OK(status)) { + talloc_free(req); return status; } @@ -1560,7 +1561,8 @@ pkt.u.alter.auth_info = data_blob(NULL, 0); /* construct the NDR form of the packet */ - c->status = ncacn_push_auth(&blob, mem_ctx, &pkt, + /* FIXME:low mem_ctx can be freed earlier */ + c->status = ncacn_push_auth(&blob, c, &pkt, p->conn->security_state.auth_info); if (!composite_is_ok(c)) return c; Modified: trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c =================================================================== --- trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/librpc/rpc/dcerpc_util.c 2007-04-24 02:23:25 UTC (rev 4821) @@ -56,7 +56,7 @@ NTSTATUS status; struct ndr_push *ndr; - ndr = ndr_push_init_ctx(mem_ctx); + ndr = ndr_push_init_ctx(mem_ctx);talloc_set_name(ndr, "MAMCIE3"); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -447,7 +447,7 @@ static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct dcerpc_syntax_id *syntax) { - struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx); + struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx); talloc_set_name(ndr, "MAMCIE4"); ndr->flags |= LIBNDR_FLAG_NOALIGN; Modified: trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm =================================================================== --- trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm 2007-04-24 02:23:25 UTC (rev 4821) @@ -83,9 +83,8 @@ my $data = $interface->{DATA}; foreach my $d (@{$data}) { if ($d->{TYPE} eq "FUNCTION") { - $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n"; +# $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n"; $res .= "\tstruct composite_context *(*$d->{NAME}_send) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d, "in") . ");\\\n"; - $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}_recv) (struct composite_context *c" . GetArgumentProtoList($d, "out") . ");\\\n"; } } $res .= "\n"; @@ -121,14 +120,15 @@ next if ($d->{TYPE} ne "FUNCTION"); my $defname = ($d->{NAME} =~ /^$if->{NAME}_(.*)$/) ? $1 : $d->{NAME}; - $res .= "#define $if->{NAME}_${defname}(interface, mem_ctx" . GetArgumentList($d) . ") "; - $res .= "((interface)->vtable->$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . "))"; - $res .="\n"; +# $res .= "#define $if->{NAME}_${defname}(interface, mem_ctx" . GetArgumentList($d) . ") "; +# $res .= "((interface)->vtable->$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . "))"; + $res .= mapType($d->{RETURN_TYPE}) . " $if->{NAME}_${defname}(struct $if->{NAME} *interface, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\n"; $res .= "#define $if->{NAME}_${defname}_send(interface, mem_ctx" . GetArgumentList($d, "in") . ") "; $res .= "((interface)->vtable->$d->{NAME}_send(interface, mem_ctx" . GetArgumentList($d, "in") . "))"; $res .="\n"; - $res .= "#define $if->{NAME}_${defname}_recv(c" . GetArgumentList($d, "out") . ") "; - $res .= "((interface)->vtable->$d->{NAME}_recv(c" . GetArgumentList($d, "out") . "))"; +# $res .= "#define $if->{NAME}_${defname}_recv(c" . GetArgumentList($d, "out") . ") "; +# $res .= "((interface)->vtable->$d->{NAME}_recv(c" . GetArgumentList($d, "out") . "))"; + $res .= mapType($d->{RETURN_TYPE}) . " $if->{NAME}_${defname}_recv(struct composite_context *c" . GetArgumentProtoList($d, "out") . ");\n"; $res .="\n"; } $res .= "\nNTSTATUS dcom_proxy_$if->{NAME}_init(void);\n"; Modified: trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm =================================================================== --- trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm 2007-04-24 02:23:25 UTC (rev 4821) @@ -45,7 +45,7 @@ { my $interface = shift; - $res .= "NTSTATUS dcom_proxy_$interface->{NAME}_init(void) + $res .= "\nNTSTATUS dcom_proxy_$interface->{NAME}_init(void) { struct $interface->{NAME}_vtable *proxy_vtable = talloc(talloc_autofree_context(), struct $interface->{NAME}_vtable); "; @@ -70,7 +70,8 @@ foreach my $x (@{$interface->{DATA}}) { next unless ($x->{TYPE} eq "FUNCTION"); - $res .= "\tproxy_vtable->$x->{NAME} = dcom_proxy_$interface->{NAME}_$x->{NAME};\n"; +# $res .= "\tproxy_vtable->$x->{NAME} = dcom_proxy_$interface->{NAME}_$x->{NAME};\n"; + $res .= "\tproxy_vtable->$x->{NAME}_send = dcom_proxy_$interface->{NAME}_$x->{NAME}_send;\n"; } $res.= " @@ -87,6 +88,7 @@ my $interface = shift; my $fn = shift; my $name = $fn->{NAME}; + my $short_name = ($fn->{NAME} =~ /^$interface->{NAME}_(.*)$/) ? $1 : $fn->{NAME}; my $uname = uc $name; my $args_in = 0; my $args_out = 0; @@ -180,7 +182,7 @@ } $res .=" - if (DEBUGLVL(9)) { + if (DEBUGLVL(12)) { NDR_PRINT_IN_DEBUG(${name}, r); } @@ -236,7 +238,7 @@ return; } - if (DEBUGLVL(9)) { + if (DEBUGLVL(12)) { NDR_PRINT_OUT_DEBUG(${name}, r); } "; @@ -252,6 +254,10 @@ out->$a->{NAME} = NULL; } "; + } elsif (defined($a->{POINTERS}) and $a->{POINTERS} > 1) { + $res .= +" talloc_steal(s->mem_ctx, out->$a->{NAME}); +"; } } @@ -266,7 +272,7 @@ #### *_recv ################################################## $res.=" -static " . mapType($fn->{RETURN_TYPE}) . " dcom_proxy_$interface->{NAME}_${name}_recv(struct composite_context *c" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn, "out") . ") +" . mapType($fn->{RETURN_TYPE}) . " $interface->{NAME}_${name}_recv(struct composite_context *c" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn, "out") . ") { struct $interface->{NAME}_${name}_out *out; NTSTATUS status; @@ -287,24 +293,24 @@ "; foreach $a (@{$fn->{ELEMENTS}}) { next unless (has_property($a, "out")); - $res.="\t if ($a->{NAME}) *$a->{NAME} = out->$a->{NAME};\n"; + $res.="\tif ($a->{NAME}) *$a->{NAME} = out->$a->{NAME};\n"; } if ($fn->{RETURN_TYPE} ne "void") { $res.="\tresult = out->result;\n"; } $res .= " talloc_free(c); -" . (($fn->{RETURN_TYPE} ne "void") ? "\treturn result;\n" : "") . " +" . (($fn->{RETURN_TYPE} ne "void") ? "\treturn result;" : "") . " } "; #### * sync ################################################## $res.=" -static " . mapType($fn->{RETURN_TYPE}) . " dcom_proxy_$interface->{NAME}_${name}(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn) . ") +" . mapType($fn->{RETURN_TYPE}) . " $interface->{NAME}_${short_name}(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn) . ") { struct composite_context *c; - c = dcom_proxy_$interface->{NAME}_${name}_send(d, mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentList($fn, "in") . "); + c = $interface->{NAME}_${short_name}_send(d, mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentList($fn, "in") . "); if (c == NULL) return"; if ($fn->{RETURN_TYPE} eq "WERROR") { $res.=" WERR_NOMEM"; @@ -313,7 +319,7 @@ } $res.="; - return dcom_proxy_$interface->{NAME}_${name}_recv(c" . Parse::Pidl::Samba4::COM::Header::GetArgumentList($fn, "out") . "); + return $interface->{NAME}_${name}_recv(c" . Parse::Pidl::Samba4::COM::Header::GetArgumentList($fn, "out") . "); } "; Modified: trunk/wmi/Samba/source/scripting/swig/samba.i =================================================================== --- trunk/wmi/Samba/source/scripting/swig/samba.i 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/scripting/swig/samba.i 2007-04-24 02:23:25 UTC (rev 4821) @@ -62,7 +62,7 @@ } %typemap(in) struct cli_credentials * { - $1 = cli_credentials_init(arg1); + $1 = cli_credentials_init(NULL); cli_credentials_set_conf($1); if ($input == Py_None) { cli_credentials_set_anonymous($1); Modified: trunk/wmi/Samba/source/wmi/config.mk =================================================================== --- trunk/wmi/Samba/source/wmi/config.mk 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/wmi/config.mk 2007-04-24 02:23:25 UTC (rev 4821) @@ -55,10 +55,27 @@ RPC_NDR_REMACT \ NDR_TABLE \ DCOM_PROXY_DCOM \ - dcom + dcom \ + RPC_NDR_WINREG OBJ_FILES = wbemdata.o \ wmicore.o \ ../librpc/gen_ndr/dcom_p.o \ pywmi_wrap.o # End LIBRARY swig_dcerpc ####################### + +################################# +# Start BINARY pdhc +#[BINARY::pdhc] +#INSTALLDIR = BINDIR +#OBJ_FILES = \ +# pdhc.o +#PRIVATE_DEPENDENCIES = \ +# POPT_SAMBA \ +# POPT_CREDENTIALS \ +# LIBPOPT \ +# NDR_TABLE \ +# RPC_NDR_WINREG +# End BINARY pdhc +################################# + Modified: trunk/wmi/Samba/source/wmi/pywmi.i =================================================================== --- trunk/wmi/Samba/source/wmi/pywmi.i 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/wmi/pywmi.i 2007-04-24 02:23:25 UTC (rev 4821) @@ -2,6 +2,7 @@ %include "typemaps.i" %include "scripting/swig/samba.i" +//%include "librpc/gen_ndr/winreg.i" %runtime %{ void push_object(PyObject **stack, PyObject *o) @@ -35,6 +36,7 @@ #include "librpc/gen_ndr/com_dcom.h" #include "wmi/proto.h" + WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace, const char *user, const char *password, const char *locale, uint32_t flags, const char *authority, struct IWbemContext* wbem_ctx, struct IWbemServices** services); WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout,uint32_t uCount, @@ -256,6 +258,9 @@ push_object(&$result, o); } + +uint32_t IUnknown_Release(void *d, TALLOC_CTX *mem_ctx); + WERROR IWbemServices_ExecQuery(struct IWbemServices *d, TALLOC_CTX *mem_ctx, const char *strQueryLanguage, const char *strQuery, int32_t lFlags, struct IWbemContext *pCtx, struct IEnumWbemClassObject **ppEnum); @@ -320,6 +325,7 @@ ComError = PyObject_GetAttrString(mod_pywintypes, "com_error"); DEBUGLEVEL = 0; +// talloc_enable_leak_report_full(); lp_load(); dcerpc_init(); Modified: trunk/wmi/Samba/source/wmi/wbemdata.c =================================================================== --- trunk/wmi/Samba/source/wmi/wbemdata.c 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/wmi/wbemdata.c 2007-04-24 02:23:25 UTC (rev 4821) @@ -30,6 +30,7 @@ #include "librpc/rpc/dcerpc.h" #include "librpc/gen_ndr/ndr_misc.h" #include "lib/talloc/talloc.h" +#include "libcli/composite/composite.h" NTSTATUS ndr_pull_WbemClassObject_Object(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r); void duplicate_CIMVAR(TALLOC_CTX *mem_ctx, const union CIMVAR *src, union CIMVAR *dst, enum CIMTYPE_ENUMERATION cimtype); @@ -38,21 +39,21 @@ #define NDR_CHECK_LEN(n) do { if (p + (n) > pend) { \ DEBUG(0, ("%s(%d): WBEMDATA_ERR(0x%08X): Buffer too small(0x%04X)\n", __FILE__, __LINE__, ndr->offset, p + (n) - pend)); \ status = NT_STATUS_UNSUCCESSFUL; \ - goto error; \ + goto end; \ } \ } while(0) #define NDR_CHECK_EXPR(expr) do { if (!(expr)) {\ DEBUG(0, ("%s(%d): WBEMDATA_ERR(0x%08X): Error parsing(%s)\n", __FILE__, __LINE__, ndr->offset, #expr)); \ status = NT_STATUS_UNSUCCESSFUL; \ - goto error; \ + goto end; \ } \ } while(0) #define NDR_CHECK_CONST(val, exp) NDR_CHECK_EXPR((val) == (exp)) #define NDR_CHECK_RSTRING(rstring) NDR_CHECK_EXPR((rstring) >= 0) -#define NTERR_CHECK(call) status = call; if (!NT_STATUS_IS_OK(status)) goto error; +#define NTERR_CHECK(call) status = call; if (!NT_STATUS_IS_OK(status)) goto end; enum { DATATYPE_CLASSOBJECT = 2, @@ -95,7 +96,7 @@ if (DEBUGLVL(9)) { NDR_PRINT_DEBUG(WbemClassObject, wco); } -error: +end: talloc_free(mem_ctx); return status; } @@ -119,12 +120,13 @@ talloc_free(*pv); *pv = NULL; status = NT_STATUS_OK; - goto error; + goto end; } NTERR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &u)); if (u + 8 > ndr->data_size) { DEBUG(1, ("unmarshall_IWbemClassObject: Incorrect data_size")); - return NT_STATUS_BUFFER_TOO_SMALL; + status = NT_STATUS_BUFFER_TOO_SMALL; + goto end; } wco = talloc_zero(*pv, struct WbemClassObject); ndr->current_mem_ctx = wco; @@ -139,7 +141,7 @@ } else { talloc_free(wco); } -error: +end: talloc_free(mem_ctx); return status; } @@ -449,7 +451,7 @@ #define WERR_CHECK(msg) if (!W_ERROR_IS_OK(result)) { \ DEBUG(1, ("ERROR: %s\n", msg)); \ - goto error; \ + goto end; \ } else { \ DEBUG(1, ("OK : %s\n", msg)); \ } @@ -566,7 +568,7 @@ default: DEBUG(0, ("WBEMDATA_Parse: Data type %d not supported\n", datatype)); status = NT_STATUS_NOT_SUPPORTED; - goto error; + goto end; } ndr->offset = ofs_next; if (DEBUGLVL(9)) { @@ -574,17 +576,11 @@ } } status = NT_STATUS_OK; -error: +end: talloc_free(mem_ctx); return status; } -static int IEnumWbemClassObject_data_destructor(struct IEnumWbemClassObject_data *ecod) -{ -// struct REMINTERFACEREF rif[2] = { {ecod->pFSE->obj.u_objref.u_standard.std.ipid, 5, 0}, {ecod->pSE->obj.u_objref.u_standard.std.ipid, 5, 0} }; - return 0; -} - WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct WbemClassObject **apObjects, uint32_t *puReturned) { WERROR result; @@ -596,12 +592,11 @@ loc_ctx = talloc_new(0); ecod = d->object_data; - // FIXME:high make destructors if (!ecod) { - d->object_data = ecod = talloc_zero(d, struct IEnumWbemClassObject_data); struct GUID iid; WERROR coresult; + d->object_data = ecod = talloc_zero(d, struct IEnumWbemClassObject_data); GUID_from_string(COM_IWBEMFETCHSMARTENUM_UUID, &iid); result = dcom_query_interface((struct IUnknown *)d, 5, 1, &iid, (struct IUnknown **)&ecod->pFSE, &coresult); WERR_CHECK("dcom_query_interface."); @@ -612,8 +607,6 @@ WERR_CHECK("Retrieve enumerator of result(IWbemWCOSmartEnum)."); ecod->guid = GUID_random(); - - talloc_set_destructor(ecod, IEnumWbemClassObject_data_destructor); } result = IWbemWCOSmartEnum_Next(ecod->pSE, loc_ctx, &ecod->guid, lTimeout, uCount, puReturned, &size, &data); @@ -626,7 +619,7 @@ result = ntstatus_to_werror(status); WERR_CHECK("WBEMDATA_Parse."); } -error: +end: if (!W_ERROR_IS_OK(result)) { status = werror_to_ntstatus(result); DEBUG(9, ("dcom_proxy_IEnumWbemClassObject_Next: %s - %s\n", nt_errstr(status), get_friendly_nt_error_msg(status))); @@ -635,17 +628,49 @@ return result; } +struct composite_context *dcom_proxy_IEnumWbemClassObject_Release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx) +{ + struct composite_context *c, *cr; + struct REMINTERFACEREF iref[3]; + struct dcom_object_exporter *ox; + struct IEnumWbemClassObject_data *ecod; + + c = composite_create(d->ctx, d->ctx->event_ctx); + if (c == NULL) return NULL; + c->private_data = d; + + ox = object_exporter_by_ip(d->ctx, d); + iref[0].ipid = IUnknown_ipid(d); + iref[0].cPublicRefs = 5; + iref[0].cPrivateRefs = 0; + + ecod = d->object_data; + if (ecod) { + iref[1].ipid = IUnknown_ipid(ecod->pFSE); + iref[1].cPublicRefs = 5; + iref[1].cPrivateRefs = 0; + iref[2].ipid = IUnknown_ipid(ecod->pSE); + iref[2].cPublicRefs = 5; + iref[2].cPrivateRefs = 0; + cr = IRemUnknown_RemRelease_send(ox->rem_unknown, mem_ctx, 3, iref); + } else + cr = IRemUnknown_RemRelease_send(ox->rem_unknown, mem_ctx, 1, iref); + + composite_continue(c, cr, dcom_release_continue, c); + return c; +} + NTSTATUS dcom_proxy_IWbemClassObject_init() { struct GUID clsid; GUID_from_string("4590f812-1d3a-11d0-891f-00aa004b2e24", &clsid); dcom_register_marshal(&clsid, marshal, unmarshal); -#if 0 +#if 1 struct IEnumWbemClassObject_vtable *proxy_vtable; proxy_vtable = (struct IEnumWbemClassObject_vtable *)dcom_proxy_vtable_by_iid((struct GUID *)&dcerpc_table_IEnumWbemClassObject.syntax_id.uuid); if (proxy_vtable) - proxy_vtable->IEnumWbemClassObject_Next = dcom_proxy_IEnumWbemClassObject_Next; + proxy_vtable->Release_send = dcom_proxy_IEnumWbemClassObject_Release_send; else DEBUG(0, ("WARNING: IEnumWbemClassObject should be initialized before IWbemClassObject.")); #endif Modified: trunk/wmi/Samba/source/wmi/wmicore.c =================================================================== --- trunk/wmi/Samba/source/wmi/wmicore.c 2007-04-24 00:20:05 UTC (rev 4820) +++ trunk/wmi/Samba/source/wmi/wmicore.c 2007-04-24 02:23:25 UTC (rev 4821) @@ -1,20 +1,7 @@ #include "includes.h" -//#include "lib/cmdline/popt_common.h" #include "auth/credentials/credentials.h" -//#include "librpc/rpc/dcerpc.h" -//#include "librpc/gen_ndr/ndr_oxidresolver.h" -//#include "librpc/gen_ndr/ndr_oxidresolver_c.h" -//#include "librpc/gen_ndr/dcom.h" -//#include "librpc/gen_ndr/ndr_dcom.h" -//#include "librpc/gen_ndr/ndr_dcom_c.h" -//#include "librpc/gen_ndr/ndr_remact_c.h" -//#include "librpc/gen_ndr/ndr_epmapper_c.h" #include "librpc/gen_ndr/com_dcom.h" -//#include "librpc/rpc/dcerpc_table.h" - #include "lib/com/dcom/dcom.h" -//#include "lib/com/proto.h" -//#include "lib/com/dcom/proto.h" struct IWbemServices; struct IWbemContext; |