Bug fixes

This commit is contained in:
Kloadut 2012-10-15 22:48:05 +02:00
parent 6fec72d127
commit 1f4b115b6f
4 changed files with 25 additions and 26 deletions

View file

@ -444,7 +444,6 @@ action_map = {
'actions' : {
'info': {
'action_help' : _("Check System"),
'connections' : ['ldap'],
'arguments' : {
'-m' : {
'full' : '--memory',
@ -475,7 +474,6 @@ action_map = {
},
}
},
},
#############################
# Firewall #
#############################
@ -638,7 +636,8 @@ def main(action_map):
result = args.func(vars(args), connections)
else:
result = args.func(vars(args))
except TypeError:
except TypeError, error:
print error
print(_("Not (yet) implemented function"))
return 1
except YunoHostError, error:

View file

@ -4,6 +4,7 @@ import os
import sys
import ldap
import ldap.modlist as modlist
import json
import re
import getpass
@ -208,7 +209,7 @@ class YunoHostLDAP:
"""
self.conn = ldap.initialize('ldap://localhost:389')
self.base = 'dc=yunohost,dc=org'
self.base = 'dc=gavoty,dc=org'
self.pwd = getpass.getpass(colorize(_('LDAP Admin Password: '), 'yellow'))
try:
self.conn.simple_bind_s('cn=admin,' + self.base, self.pwd)

View file

@ -5,7 +5,7 @@ import sys
import subprocess
import psutil
from datetime import datetime, timedelta
from psutil._compat import print_
#from psutil._compat import print_
def bytes2human(n):
symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
@ -22,7 +22,7 @@ def check_disk():
templ = "%s,%s/%s,%s,%s"
for part in psutil.disk_partitions(all=False):
usage = psutil.disk_usage(part.mountpoint)
print_(templ % (part.mountpoint,
print(templ % (part.mountpoint,
bytes2human(usage.used),
bytes2human(usage.total),
bytes2human(usage.free),
@ -49,14 +49,14 @@ def uptime():
uptime = datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)
print "Uptime: %s" % (str(uptime).split('.')[0])
def monitor_info(args, connections):
if args['memory'] == True:
def monitor_info(args):
if args['memory']:
check_memory()
elif args['cpu'] == True:
elif args['cpu']:
check_cpu()
elif args['disk'] == True:
elif args['disk']:
check_disk()
elif args['ifconfig'] == True:
elif args['ifconfig']:
ifconfig()
elif args['uptime'] == True:
elif args['uptime']:
uptime()

View file

@ -9,7 +9,6 @@ import string
import getpass
from yunohost import YunoHostError, win_msg, colorize, validate
def user_list(args, connections): # TODO : fix
print(args)