summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfunc/minion/server.py12
-rwxr-xr-xfunc/overlord/client.py2
-rwxr-xr-xfunc/utils.py43
3 files changed, 6 insertions, 51 deletions
diff --git a/func/minion/server.py b/func/minion/server.py
index 2750afc..36f3262 100755
--- a/func/minion/server.py
+++ b/func/minion/server.py
@@ -27,15 +27,13 @@ from func.config import read_config
from func.commonconfig import FuncdConfig
from certmaster.commonconfig import CMConfig
from func import logger
-from func import certs
+from certmaster import certs
import func.jobthing as jobthing
# our modules
import AuthedXMLRPCServer
import codes
import module_loader
-import func.utils as futils
-import func.minion.utils as fmutils
import func.minion.acls as acls_mod
from certmaster import utils
@@ -139,11 +137,11 @@ class FuncApiMethod:
except codes.FuncException, e:
self.__log_exc()
(t, v, tb) = sys.exc_info()
- rc = futils.nice_exception(t,v,tb)
+ rc = utils.nice_exception(t,v,tb)
except:
self.__log_exc()
(t, v, tb) = sys.exc_info()
- rc = futils.nice_exception(t,v,tb)
+ rc = utils.nice_exception(t,v,tb)
self.logger.debug("Return code for %s: %s" % (self.__name, rc))
return rc
@@ -235,7 +233,7 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
return jobthing.minion_async_run(self.get_dispatch_method, method, params)
except:
(t, v, tb) = sys.exc_info()
- rc = futils.nice_exception(t, v, tb)
+ rc = utils.nice_exception(t, v, tb)
return rc
def auth_cb(self, request, client_address):
@@ -250,7 +248,7 @@ def main(argv):
"""
if "daemon" in sys.argv or "--daemon" in sys.argv:
- futils.daemonize("/var/run/funcd.pid")
+ utils.daemonize("/var/run/funcd.pid")
else:
print "serving...\n"
diff --git a/func/overlord/client.py b/func/overlord/client.py
index 4cb8216..79ead06 100755
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -19,6 +19,7 @@ import os
import func.yaml as yaml
from certmaster.commonconfig import CMConfig
+from certmaster import utils
from func.config import read_config, CONFIG_FILE
import sslclient
@@ -28,7 +29,6 @@ import groups
import delegation_tools as dtools
import func.forkbomb as forkbomb
import func.jobthing as jobthing
-import func.utils as utils
from func.CommonErrors import *
# ===================================
diff --git a/func/utils.py b/func/utils.py
index 9577bd9..0e4b4d5 100755
--- a/func/utils.py
+++ b/func/utils.py
@@ -18,49 +18,6 @@ import socket
REMOTE_ERROR = "REMOTE_ERROR"
-def trace_me():
- x = traceback.extract_stack()
- bar = string.join(traceback.format_list(x))
- return bar
-
-def daemonize(pidfile=None):
- """
- Daemonize this process with the UNIX double-fork trick.
- Writes the new PID to the provided file name if not None.
- """
-
- print pidfile
- pid = os.fork()
- if pid > 0:
- sys.exit(0)
- os.setsid()
- os.umask(0)
- pid = os.fork()
-
- if pid > 0:
- if pidfile is not None:
- open(pidfile, "w").write(str(pid))
- sys.exit(0)
-
-def nice_exception(etype, evalue, etb):
- etype = str(etype)
- try:
- lefti = etype.index("'") + 1
- righti = etype.rindex("'")
- nicetype = etype[lefti:righti]
- except:
- nicetype = etype
- nicestack = string.join(traceback.format_list(traceback.extract_tb(etb)))
- return [ REMOTE_ERROR, nicetype, str(evalue), nicestack ]
-
-def get_hostname():
- fqdn = socket.getfqdn()
- host = socket.gethostname()
- if fqdn.find(host) != -1:
- return fqdn
- else:
- return host
-
def is_error(result):
if type(result) != list: