diff options
author | James Meyer <james.meyer@operamail.com> | 2009-02-27 16:34:55 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2009-02-27 16:34:55 (GMT) |
commit | b70cf779699270766389918fd3169488fd21671f (patch) | |
tree | 1365b416ac32f6ece0d3c113eb65f31f15c6a3b8 | |
parent | ff391b5a2ecf9b873836c587606ec58e5c18943c (diff) | |
download | linhes_pkgbuild-b70cf779699270766389918fd3169488fd21671f.zip linhes_pkgbuild-b70cf779699270766389918fd3169488fd21671f.tar.gz linhes_pkgbuild-b70cf779699270766389918fd3169488fd21671f.tar.bz2 |
white space cleanups and fe_restart option to process.py.
-rwxr-xr-x | abs/mv-core/local-website/PKGBUILD | 2 | ||||
-rwxr-xr-x | abs/mv-core/local-website/contents/process.py | 53 |
2 files changed, 28 insertions, 27 deletions
diff --git a/abs/mv-core/local-website/PKGBUILD b/abs/mv-core/local-website/PKGBUILD index 5ecee78..2358cf5 100755 --- a/abs/mv-core/local-website/PKGBUILD +++ b/abs/mv-core/local-website/PKGBUILD @@ -1,6 +1,6 @@ pkgname=local-website pkgver=3 -pkgrel=78 +pkgrel=82 pkgdesc="Local website for MythVantage " arch=(i686 x86_64) #depends=('lighttpd') diff --git a/abs/mv-core/local-website/contents/process.py b/abs/mv-core/local-website/contents/process.py index eb70caa..b390440 100755 --- a/abs/mv-core/local-website/contents/process.py +++ b/abs/mv-core/local-website/contents/process.py @@ -40,32 +40,22 @@ def getform(theform, valuelist, notpresent='', nolist=False): """ data = {} for field in valuelist: - - if not theform.has_key(field): # if the field is not present (or was empty) data[field] = notpresent - else: # the field is present - - - print type(theform[field]) - + print type(theform[field]) if type(theform[field]) != type([]): # is it a list or a single item - print type(theform[field]) + print type(theform[field]) data[field] = theform[field].value - else: - if not nolist: # do we want a list ? data[field] = theform.getlist(field) - else: data[field] = theform.getfirst(field) - # just fetch the first item return data @@ -119,12 +109,8 @@ def go_backup(myhost): cmd=' "sudo /etc/cron.daily/backup_cron ; sudo su nobody -c /data/srv/hobbit/server/ext/hbnotes.py"' command=sshcmd + cmd + " 2>&1 " results=os.popen(command,'r') - #print command - - return results - def go_restore(restorefile,myhost): myhostname = socket.gethostname() if myhostname.strip() == myhost.strip(): @@ -171,7 +157,7 @@ def go_updateall(allupdate_type): cmd+=allupdate_type command= cmd + " 2>&1 " results=os.popen(command,'r') - return results + return results def go_shutdown(myhost): @@ -216,16 +202,15 @@ def go_shutdownall(): def go_reboot(myhost): myhostname = socket.gethostname() if myhostname.strip() == myhost.strip(): - message="Reboot from MBE:::ALT" - os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) - time.sleep(3) + message="Reboot from MBE:::ALT" + os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) + time.sleep(3) command="sudo /sbin/reboot " else: command="sudo /usr/bin/func \"" + myhost.strip() + "*\ call power reboot " - message="Reboot from MBE:::ALT" - os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) - time.sleep(3) - + message="Reboot from MBE:::ALT" + os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) + time.sleep(3) results=os.popen(command,'r') return results @@ -234,6 +219,19 @@ def go_wake(myhost): results=os.popen(command,'r') return results +def go_kill(myhost,kill_type): + myhostname = socket.gethostname() + if myhostname.strip() == myhost.strip(): + cmd="sudo /usr/bin/update_systemno_op " + command=cmd + kill_type + else: + cmd=" call fe_restart " + cmd+=kill_type + command="sudo /usr/bin/func \"" + myhost.strip() + "*\" " + cmd + print command + results=os.popen(command,'r') + return results + mainpage = ''' <html><head> @@ -249,7 +247,7 @@ error = ''' result = ''' <h1>%s of %s</h1> ''' -possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5'] +possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5','param6'] if __name__ == '__main__': cgiprint(contentheader) # content header @@ -270,7 +268,8 @@ if __name__ == '__main__': update_type = formdict['param3'] oldurl = formdict['param4'] hidden = formdict['hiddenparam'] - all_update_type=formdict['param5'] + all_update_type=formdict['param5'] + kill_type = formdict['param6'] body = result % (radio, hidden) @@ -298,6 +297,8 @@ if __name__ == '__main__': mylogfile=go_updateall(all_update_type) elif selection == "ShutdownAll": mylogfile=go_shutdownall() + elif selection == "Kill": + mylogfile=go_kill(myhost,kill_type) box=''' <div style="border: 1px solid #aaa; width:600px; height:500px; overflow:auto; color:#FFF;text-align:left;"> |