diff options
Diffstat (limited to 'abs/mv-core/func')
-rw-r--r-- | abs/mv-core/func/PKGBUILD | 32 | ||||
-rw-r--r-- | abs/mv-core/func/certmaster.conf | 7 | ||||
-rwxr-xr-x | abs/mv-core/func/failed_func.sh | 14 | ||||
-rw-r--r-- | abs/mv-core/func/func-0.13.tar.gz | bin | 0 -> 59377 bytes | |||
-rwxr-xr-x | abs/mv-core/func/func.install | 49 | ||||
-rw-r--r-- | abs/mv-core/func/minion.conf | 8 | ||||
-rw-r--r-- | abs/mv-core/func/pacman.py | 40 | ||||
-rw-r--r-- | abs/mv-core/func/power.py | 58 |
8 files changed, 208 insertions, 0 deletions
diff --git a/abs/mv-core/func/PKGBUILD b/abs/mv-core/func/PKGBUILD new file mode 100644 index 0000000..a72ebd0 --- /dev/null +++ b/abs/mv-core/func/PKGBUILD @@ -0,0 +1,32 @@ +pkgname=func +pkgver=0.13 +pkgrel=15 +pkgdesc="fedora unifed network controller" +url="" +license="gpl" +depends=(pyopenssl) +makedepends=() +conflicts=() +replaces=() +backup=() +moddir="pkg/usr/lib/python2.5/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) +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 + 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 $startdir/src/$pkgname-${pkgver}/etc/sample.acl $startdir/pkg/etc/func/minion-acl.d/sample.acl + 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 +} diff --git a/abs/mv-core/func/certmaster.conf b/abs/mv-core/func/certmaster.conf new file mode 100644 index 0000000..075d81f --- /dev/null +++ b/abs/mv-core/func/certmaster.conf @@ -0,0 +1,7 @@ +[main] +listen_addr = +cadir = /etc/pki/func/ca +certroot = /data/srv/func/certmaster/certs +csrroot = /data/srv/func/certmaster/csrs +autosign = yes + diff --git a/abs/mv-core/func/failed_func.sh b/abs/mv-core/func/failed_func.sh new file mode 100755 index 0000000..2ec4da7 --- /dev/null +++ b/abs/mv-core/func/failed_func.sh @@ -0,0 +1,14 @@ +. /etc/profile +. /etc/systemconfig +curl -# http://$dbhost/failed_func_hosts|grep -q `hostname` +status=$? +if [ $status = 0 ] +then + echo "removeing ca" + rm -f /etc/pki/func/* + echo "restarting func" + sv stop funcd + sleep 3 + sv start funcd +fi + diff --git a/abs/mv-core/func/func-0.13.tar.gz b/abs/mv-core/func/func-0.13.tar.gz Binary files differnew file mode 100644 index 0000000..76b6c82 --- /dev/null +++ b/abs/mv-core/func/func-0.13.tar.gz diff --git a/abs/mv-core/func/func.install b/abs/mv-core/func/func.install new file mode 100755 index 0000000..a1d42f8 --- /dev/null +++ b/abs/mv-core/func/func.install @@ -0,0 +1,49 @@ +# This is a default template for a post-install scriptlet. You can +# remove any functions you don't need (and this header). + +# arg 1: the new package version +pre_install() { +/bin/true +} + +# arg 1: the new package version +post_install() { + if [ ! -e /etc/cron.tenminutes ] + then + mkdir /etc/cron.tenminutes + fi + + ln -s /usr/bin/failed_func.sh /etc/cron.tenminutes/failed_func.sh + + + +} + +# arg 1: the new package version +# arg 2: the old package version +pre_upgrade() { + /bin/true + + + +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install +} + +# arg 1: the old package version +pre_remove() { + /bin/true +} + +# arg 1: the old package version +post_remove() { + /bin/true +} + +op=$1 +shift +$op $* diff --git a/abs/mv-core/func/minion.conf b/abs/mv-core/func/minion.conf new file mode 100644 index 0000000..627e04b --- /dev/null +++ b/abs/mv-core/func/minion.conf @@ -0,0 +1,8 @@ +# configuration for minions + +[main] +log_level = DEBUG +certmaster = +cert_dir = /etc/pki/func +acl_dir = /etc/func/minion-acl.d + diff --git a/abs/mv-core/func/pacman.py b/abs/mv-core/func/pacman.py new file mode 100644 index 0000000..c1d8d9d --- /dev/null +++ b/abs/mv-core/func/pacman.py @@ -0,0 +1,40 @@ +#!/usr/bin/python + + +# other modules +import sub_process + +# our modules +from modules import func_module + +# ================================= + +class pacman(func_module.FuncModule): + def __init__(self): + self.methods = { + "update_system" : self.update_system, + "pkgversion" : self.pkgversion, + } + func_module.FuncModule.__init__(self) + + def update_system(self,flags): + flags.replace(";","") # prevent stupidity + cmd = sub_process.Popen("/usr/bin/update_system %s" % flags,stdout=sub_process.PIPE,shell=True) + data = cmd.communicate()[0] + results = [] + for x in data.split("\n"): + results.append(x) + return (cmd.returncode, results) + + def pkgversion(self,flags): + flags.replace(";","") # prevent stupidity + cmd = sub_process.Popen("/usr/bin/pacman -Q %s | grep -v error" % flags,stdout=sub_process.PIPE,shell=True) + data = cmd.communicate()[0] + results = [] + for x in data.split("\n"): + results.append(x) + return (cmd.returncode, results) + + +methods = pacman() +register_rpc = methods.register_rpc diff --git a/abs/mv-core/func/power.py b/abs/mv-core/func/power.py new file mode 100644 index 0000000..fd847e7 --- /dev/null +++ b/abs/mv-core/func/power.py @@ -0,0 +1,58 @@ +#!/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 <mdehaan@redhat.com> +## +## 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 + +# ================================= + +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. + """ + + flags.replace(";","") # prevent stupidity + + #cmd = sub_process.Popen("/sbin/poweroff %s" % flags,stdout=sub_process.PIPE,shell=True) + cmd = sub_process.Popen("/sbin/poweroff") + data = cmd.communicate()[0] + + results = ['poweroff'] + return (cmd.returncode, results) + + def reboot(self,flags=""): + cmd=sub_process.Popen('/sbin/reboot') + data = cmd.communicate()[0] + results = ['rebooting'] + + return (cmd.returncode, results) + +methods = power() +register_rpc = methods.register_rpc |