From 8564f284b1b20b75f9c81e819116dd292f547389 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 26 Feb 2009 14:46:38 -0600 Subject: Restoring the func to mythvantage. Still need to rework the pacman module. --- abs/mv-core/func/PKGBUILD | 14 +++++---- abs/mv-core/func/func-0.24.tar.gz | Bin 0 -> 130319 bytes abs/mv-core/func/minion.conf | 4 +-- abs/mv-core/func/power.py | 59 ++++++++++++-------------------------- 4 files changed, 28 insertions(+), 49 deletions(-) create mode 100644 abs/mv-core/func/func-0.24.tar.gz diff --git a/abs/mv-core/func/PKGBUILD b/abs/mv-core/func/PKGBUILD index af1c5b5..3cd4bad 100644 --- a/abs/mv-core/func/PKGBUILD +++ b/abs/mv-core/func/PKGBUILD @@ -1,6 +1,6 @@ pkgname=func -pkgver=0.13 -pkgrel=18 +pkgver=0.24 +pkgrel=7 pkgdesc="fedora unifed network controller" url="" license="gpl" @@ -9,10 +9,9 @@ makedepends=() conflicts=() replaces=() backup=() -moddir="pkg/usr/lib/python2.5/site-packages/func/minion/modules/" +moddir="pkg/usr/lib/python2.6/site-packages/func/minion/modules/" install=func.install -#source=(https://hosted.fedoraproject.org/projects/func/attachment/wiki/FuncReleases/$pkgname-$pkgver.tar.gz) -source=($pkgname-$pkgver.tar.gz certmaster.conf minion.conf power.py pacman.py failed_func.sh) +source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func.sh) md5sums=() arch=('i686') @@ -23,10 +22,13 @@ build() { python setup.py install --prefix=$startdir/pkg/usr cd $startdir/src install -m755 -D minion.conf $startdir/pkg/etc/func/minion.conf - install -m755 -D certmaster.conf $startdir/pkg/etc/func/certmaster.conf + install -m755 -D async_methods.conf $startdir/pkg/etc/func/async_methods.conf install -m755 -D $startdir/src/$pkgname-${pkgver}/etc/sample.acl $startdir/pkg/etc/func/minion-acl.d/sample.acl + 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/failed_func.sh $startdir/pkg/usr/bin/failed_func.sh mkdir -p $startdir/pkg/var/log/func + cd $startdir/pkg + find ./ -name "*.pyc" -print | xargs rm -f } diff --git a/abs/mv-core/func/func-0.24.tar.gz b/abs/mv-core/func/func-0.24.tar.gz new file mode 100644 index 0000000..baa8eef Binary files /dev/null and b/abs/mv-core/func/func-0.24.tar.gz differ diff --git a/abs/mv-core/func/minion.conf b/abs/mv-core/func/minion.conf index 627e04b..dd3d4cc 100644 --- a/abs/mv-core/func/minion.conf +++ b/abs/mv-core/func/minion.conf @@ -2,7 +2,7 @@ [main] log_level = DEBUG -certmaster = -cert_dir = /etc/pki/func acl_dir = /etc/func/minion-acl.d +listen_addr = +listen_port = 51234 diff --git a/abs/mv-core/func/power.py b/abs/mv-core/func/power.py index fd847e7..297f464 100644 --- a/abs/mv-core/func/power.py +++ b/abs/mv-core/func/power.py @@ -1,58 +1,35 @@ -#!/usr/bin/python - -## -## Grabs status from SMART to see if your hard drives are ok -## Returns in the format of (return code, [line1, line2, line3,...]) -## -## Copyright 2007, Red Hat, Inc -## Michael DeHaan -## -## This software may be freely redistributed under the terms of the GNU -## general public license. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## - # other modules import sub_process # our modules -from modules import func_module +import func_module # ================================= class power(func_module.FuncModule): - def __init__(self): - self.methods = { - "poweroff" : self.poweroff, - "reboot" : self.reboot, - } - func_module.FuncModule.__init__(self) - def poweroff(self,flags=""): - """ - Returns a struct of hardware information. By default, this pulls down - all of the devices. If you don't care about them, set with_devices to - False. - """ + version = "0.0.1" + api_version = "0.0.1" + description = "Reboot the server" + def reboot(self,flags="-q onecheck"): + """ + Reboot the server + """ flags.replace(";","") # prevent stupidity - - #cmd = sub_process.Popen("/sbin/poweroff %s" % flags,stdout=sub_process.PIPE,shell=True) - cmd = sub_process.Popen("/sbin/poweroff") + cmd = sub_process.Popen("/sbin/reboot") data = cmd.communicate()[0] - - results = ['poweroff'] + results = ['reboot'] return (cmd.returncode, results) - def reboot(self,flags=""): - cmd=sub_process.Popen('/sbin/reboot') - data = cmd.communicate()[0] - results = ['rebooting'] - + def poweroff (self,flags="-q onecheck"): + """ + Reboot the server + """ + flags.replace(";","") # prevent stupidity + cmd = sub_process.Popen("/sbin/poweroff") + data = cmd.communicate()[0] + results = ['off'] return (cmd.returncode, results) -methods = power() -register_rpc = methods.register_rpc -- cgit v0.12