summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
Diffstat (limited to 'abs')
-rw-r--r--abs/mv-core/func/PKGBUILD6
-rw-r--r--abs/mv-core/func/fe_restart.py35
-rw-r--r--abs/mv-core/func/power.py8
-rwxr-xr-xabs/mv-core/hobbitmon/PKGBUILD2
-rwxr-xr-xabs/mv-core/hobbitmon/hbnotes.py2
-rwxr-xr-xabs/mv-core/local-website/PKGBUILD2
-rwxr-xr-xabs/mv-core/local-website/contents/process.py53
7 files changed, 72 insertions, 36 deletions
diff --git a/abs/mv-core/func/PKGBUILD b/abs/mv-core/func/PKGBUILD
index 9e4a598..96eafce 100644
--- a/abs/mv-core/func/PKGBUILD
+++ b/abs/mv-core/func/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=func
pkgver=0.24
-pkgrel=9
+pkgrel=21
pkgdesc="fedora unifed network controller"
url=""
license="gpl"
@@ -11,13 +11,12 @@ replaces=()
backup=()
moddir="pkg/usr/lib/python2.6/site-packages/func/minion/modules/"
install=func.install
-source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func.sh)
+source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func.sh fe_restart.py)
md5sums=()
arch=('i686')
build() {
cd $startdir/src/$pkgname-${pkgver}
- cd $startdir/src/func
python setup.py build
python setup.py install --prefix=$startdir/pkg/usr
cd $startdir/src
@@ -27,6 +26,7 @@ build() {
install -m755 -D $startdir/src/$pkgname-${pkgver}/etc/Test.conf $startdir/pkg/etc/func/modules/Test.conf
install -m755 -D $startdir/src/power.py ${startdir}/${moddir}/power.py
install -m755 -D $startdir/src/pacman.py ${startdir}/${moddir}/pacman.py
+ install -m755 -D $startdir/src/fe_restart.py ${startdir}/${moddir}/fe_restart.py
install -m755 -D $startdir/src/failed_func.sh $startdir/pkg/usr/bin/failed_func.sh
mkdir -p $startdir/pkg/var/log/func
cd $startdir/pkg
diff --git a/abs/mv-core/func/fe_restart.py b/abs/mv-core/func/fe_restart.py
new file mode 100644
index 0000000..a75b0c5
--- /dev/null
+++ b/abs/mv-core/func/fe_restart.py
@@ -0,0 +1,35 @@
+##
+# other modules
+import sub_process
+
+# our modules
+import func_module
+
+# =================================
+
+class re_restart(func_module.FuncModule):
+
+ version = "0.0.1"
+ api_version = "0.0.1"
+ description = "Restart the frontend"
+
+ def killX (self,flags="restart frontend"):
+ """
+ Restart X
+ """
+ flags.replace(";","") # prevent stupidity
+ cmd = sub_process.Popen("/sbin/sv %s " % flags,stdout=sub_process.PIPE,shell=True)
+ data = cmd.communicate()[0]
+ results = ['Restarted UI']
+ return (cmd.returncode, results)
+
+ def killmyth (self,flags="-9 mythfrontend"):
+ """
+ kill the mythfrontend process server
+ """
+ flags.replace(";","") # prevent stupidity
+ cmd = sub_process.Popen("/usr/bin/killall %s" % flags,stdout=sub_process.PIPE,shell=True)
+ data = cmd.communicate()[0]
+ results = ['killed mythfrontend']
+ return (cmd.returncode, results)
+
diff --git a/abs/mv-core/func/power.py b/abs/mv-core/func/power.py
index 297f464..668965a 100644
--- a/abs/mv-core/func/power.py
+++ b/abs/mv-core/func/power.py
@@ -16,9 +16,9 @@ class power(func_module.FuncModule):
def reboot(self,flags="-q onecheck"):
"""
Reboot the server
- """
+ """
flags.replace(";","") # prevent stupidity
- cmd = sub_process.Popen("/sbin/reboot")
+ cmd = sub_process.Popen("/sbin/reboot")
data = cmd.communicate()[0]
results = ['reboot']
return (cmd.returncode, results)
@@ -26,9 +26,9 @@ class power(func_module.FuncModule):
def poweroff (self,flags="-q onecheck"):
"""
Reboot the server
- """
+ """
flags.replace(";","") # prevent stupidity
- cmd = sub_process.Popen("/sbin/poweroff")
+ cmd = sub_process.Popen("/sbin/poweroff")
data = cmd.communicate()[0]
results = ['off']
return (cmd.returncode, results)
diff --git a/abs/mv-core/hobbitmon/PKGBUILD b/abs/mv-core/hobbitmon/PKGBUILD
index e2a9484..cb71a60 100755
--- a/abs/mv-core/hobbitmon/PKGBUILD
+++ b/abs/mv-core/hobbitmon/PKGBUILD
@@ -1,7 +1,7 @@
pkgname=hobbitserver
provides=hobbit
pkgver=4.2.0
-pkgrel=102
+pkgrel=103
pkgdesc="Hobbit is a system for monitoring servers and networks. "
license="GPL"
arch=('i686')
diff --git a/abs/mv-core/hobbitmon/hbnotes.py b/abs/mv-core/hobbitmon/hbnotes.py
index 087b646..5300e88 100755
--- a/abs/mv-core/hobbitmon/hbnotes.py
+++ b/abs/mv-core/hobbitmon/hbnotes.py
@@ -297,7 +297,7 @@ def main(argv):
</select>
</br>
<input name="param2" type="radio" value="Kill" />Restart interface: </>
- <select name="param3">
+ <select name="param6">
<option value="killX">Full UI</option>
<option value="killmyth">MythFrontend</option>
</select>
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;">