summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/hobbitmon/hobbitadd.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2010-10-23 18:17:40 (GMT)
committerJames Meyer <james.meyer@operamail.com>2010-10-23 18:19:39 (GMT)
commitadbcf19958300e9b6598990184c8815b945ba0ee (patch)
treef4283c850ac0ac202c17e78a637ee7ca8147621b /abs/mv-core/hobbitmon/hobbitadd.py
parent61a68250df10d29b624650948484898334ff22d0 (diff)
downloadlinhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.zip
linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.gz
linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.bz2
Removed old core and extra from repo. Renamed -testing to core/extra. This will setup the base for the testing branch.
Diffstat (limited to 'abs/mv-core/hobbitmon/hobbitadd.py')
-rwxr-xr-xabs/mv-core/hobbitmon/hobbitadd.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/abs/mv-core/hobbitmon/hobbitadd.py b/abs/mv-core/hobbitmon/hobbitadd.py
deleted file mode 100755
index b8ae15d..0000000
--- a/abs/mv-core/hobbitmon/hobbitadd.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-#polls the hobbit server for ghost clients. If it finds ghosts it will make a new bb-hosts file
-#with the new clients.
-#Will not add duplicate clients
-#return code of 0 means a new file was written, anything else is an error or no inserts occured
-import urllib2
-import string
-import sys
-
-
-def readbb():
- global bblist
- try:
- infile = open('/data/srv/hobbit/etc/bb-hosts', 'r')
- except(IOError), e:
- print "couldn't open bb-hosts file"
- sys.exit(1)
- else:
- bblist = infile.readlines()
- infile.close()
-
-
-def findghosts():
- global infile
- global bblist
- global ghostitems
- global numberitems
- try:
- f = urllib2.urlopen("http://localhost/hobbit/hobbit-cgi/hobbit-ghosts.sh?SORT=name&MAXAGE=300&TEXT")
- except urllib2.HTTPError, e:
- if e.code != 200:
- print 'error find ghost list'
- sys.exit(1)
- else:
- ghostitems = f.readlines()
- f.close()
- numberitems = len(ghostitems)
-
-
-def makenewbb():
- global bblist
- global ghostitems
- global numberitems
- global numinserts
- numinserts=0
- outlist = []
- for item in bblist:
- if item not in outlist:
- outlist.append(item)
-
- for item in ghostitems:
- line = item.rstrip()
- nline = "%s #func" % (line)
- nline = nline + '\n'
- if nline not in outlist:
- outlist.append(nline)
- print "adding: " + nline
- numinserts = numinserts + 1
- if numinserts > 0:
- outfile = open("/data/srv/hobbit/etc/bb-hosts","w")
- #outfile = open("/tmp/new-bb","w")
- for i in outlist:
- outfile.write(i + '\n' )
- outfile.close
-
-
-global infile
-global bblist
-global ghostitems
-global numberitems
-global numinserts
-
-readbb()
-findghosts()
-print numberitems
-if numberitems > 0:
- makenewbb()
-else:
- print "nothing to add"
-
-
-if numinserts < 1:
- sys.exit(1)
-else:
- sys.exit(0)
-
-