Changeset 22
- Timestamp:
- 01/23/09 15:06:51 (3 years ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
ChangeLog (modified) (1 diff)
-
config.py (modified) (1 diff)
-
config.yaml (modified) (1 diff)
-
misc/utils.py (modified) (1 diff)
-
plugins/info/info/__init__.py (modified) (1 diff)
-
plugins/zfs/zfs/__init__.py (modified) (3 diffs)
-
plugins/zfs/zfs/zfs.glade (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r21 r22 1 2009-01-23 Pedro Gracia,,, <lasarux@gmail.com> 2 3 * config.py: 4 * config.yaml: 5 * misc/utils.py: 6 * plugins/info/info/__init__.py: 7 * plugins/zfs/zfs/__init__.py: 8 * plugins/zfs/zfs/zfs.glade: 9 More changes in config stuff. 10 ZFS plugin uses the current connection. 11 1 12 2009-01-23 Pedro Gracia,,, <lasarux@gmail.com> 2 13 -
trunk/config.py
r11 r22 11 11 REMOTE = "TERM=unix LC_ALL=C" 12 12 13 def get_command(command, opsys): 13 def get_command(command, os): 14 columns = COMMANDS[command]["columns"] 14 15 try: 15 args = COMMANDS[command][o psys]16 args = COMMANDS[command][os] 16 17 except: 17 18 args = COMMANDS[command]["default"] 18 return "%s %s" % (command, args) 19 20 def send_command(command, ip, opsys): 21 rcommand = get_command(command, opsys) 22 s = pxssh.pxssh() 23 if s.login(ip, user): 24 s.sendline("%s %s " % (REMOTE, rcommand)) 25 s.prompt() 26 result = s.before 27 s.logout() 28 # process data 29 regex = COMMANDS[command]["regex"] 30 headlines = int(COMMANDS[command]["headlines"]) 31 p = re.compile(regex) 32 #for i in result.splitlines()[headlines+1:]: 33 # m = p.search(i) 34 # m.group("size") 35 return result 19 return "%s %s" % (command, args), columns -
trunk/config.yaml
r20 r22 147 147 default: -h 148 148 headlines: 1 149 columns: ["Filesystem", "Size", "Used", "Avail", "Capacity", "Mounted on"] 149 150 regex: (?P<filesystem>[\w\/\[\]<>-]+|automount -[\w]+ \[[\d]+\])\s+\ 150 151 (?P<size>[\w,.]+)\s+\ -
trunk/misc/utils.py
r21 r22 1 # -*- coding: utf-8 -*- 1 2 import gtk 2 3 -
trunk/plugins/info/info/__init__.py
r21 r22 32 32 #textbuffer = self.info_tview.get_buffer() 33 33 #textbuffer.set_text("Remoting...") 34 rcommand = self.main.config.get_command(command, os)34 rcommand, columns = self.main.config.get_command(command, os) 35 35 36 36 s = self.main.s -
trunk/plugins/zfs/zfs/__init__.py
r21 r22 5 5 import simplepanels 6 6 import gtk 7 8 TEST_ZFS_LIST=["NAME USED AVAIL REFER MOUNTPOINT",9 "rpool 3,29G 11,8G 46K /rpool",10 "rpool/ROOT 2,28G 11,8G 18K legacy",11 "rpool/ROOT/opensolaris 2,28G 11,8G 2,22G /",12 "rpool/dump 511M 11,8G 511M -",13 "rpool/export 5,09M 11,8G 19K /export",14 "rpool/export/home 5,07M 11,8G 19K /export/home",15 "rpool/export/home/pedro 5,05M 11,8G 5,05M /export/home/pedro",16 "rpool/swap 512M 12,3G 16K -"]17 18 19 20 7 21 8 class ZFSPlugin(object, SimpleGladeApp): … … 31 18 self.main = main 32 19 self.root.reparent(main.zfs_vbox) 20 21 def on_refresh_btn_clicked(self, button): 33 22 self.show_list() 34 23 35 24 def show_list(self): 36 25 """Show 'zfs list' info""" 26 s = self.main.s 27 s.sendline("zfs list") 28 s.prompt() 29 result = s.before.split("\n")[2:] 30 37 31 columns = [('visible', 'str', 'Name'), 38 32 ('visible', 'str', 'Used'), … … 42 36 ] 43 37 data = [] 44 for i in TEST_ZFS_LIST[1:]: 45 data.append(i.split()) 38 for i in result: 39 row = i.split() 40 if len(row) == len(columns): 41 data.append(row) 46 42 47 43 self.t = Treeview("list", columns, data, self.list_treeview) -
trunk/plugins/zfs/zfs/zfs.glade
r19 r22 57 57 </child> 58 58 <child> 59 <widget class="GtkButton" id=" button3">59 <widget class="GtkButton" id="refresh_btn"> 60 60 <property name="visible">True</property> 61 61 <property name="can_focus">True</property> … … 64 64 <property name="use_stock">True</property> 65 65 <property name="response_id">0</property> 66 <signal name="clicked" handler="on_refresh_btn_clicked"/> 66 67 </widget> 67 68 <packing>
