summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2008-11-12 10:58:01 -0500
committerAdrian Likins <alikins@redhat.com>2008-11-12 10:58:01 -0500
commit394c3cbedef016d204c62d4b5b0a7a371e566eeb (patch)
tree03ff41481f717f271b6876341529e400dba4e41d /func
parenta41094a337ce90de8a6adc8d982de07d2f54e231 (diff)
downloadfunc-394c3cbedef016d204c62d4b5b0a7a371e566eeb.tar.gz
func-394c3cbedef016d204c62d4b5b0a7a371e566eeb.tar.xz
func-394c3cbedef016d204c62d4b5b0a7a371e566eeb.zip
Add support for configuring funcd ports.
func/overlord/base_command.py: add support for reading the port from the minion.conf file. This may need to be changed if we want to support each minion having a different port number. func/overlord/cmd_modules/call.py: The commandline options were overriding the default values in base_command for async/verbose/etc. The commandline options have been changed to get there defaults from the baseclass now. This was also causing func cli to default to async mode. func/overlord/cmd_modules/check.py: updated to reflect that the port numbers are not hardcoded now
Diffstat (limited to 'func')
-rw-r--r--func/overlord/base_command.py14
-rw-r--r--func/overlord/cmd_modules/call.py5
-rw-r--r--func/overlord/cmd_modules/check.py20
3 files changed, 31 insertions, 8 deletions
diff --git a/func/overlord/base_command.py b/func/overlord/base_command.py
index 9052c20..6ca3aab 100644
--- a/func/overlord/base_command.py
+++ b/func/overlord/base_command.py
@@ -15,8 +15,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import command
import client
+from certmaster.config import read_config, BaseConfig, ListOption
+from func import commonconfig
+
+
DEFAULT_PORT = 51234
DEFAULT_MAPLOC = "/var/lib/func/map"
+# FIXME
+CONFIG_FILE="/etc/func/minion.conf"
class BaseCommand(command.Command):
""" wrapper class for commands with some convience functions, namely
@@ -29,6 +35,14 @@ class BaseCommand(command.Command):
forks=1
delegate=False
mapfile=DEFAULT_MAPLOC
+
+ # temporary work around FIXME
+ # we really need a way to store what port each minion is
+ # listening on, though this is probably workable for most
+ # cases. Though it should probably be a different config
+ # file, since FuncdConfig is for the minion server, not
+ config = read_config(CONFIG_FILE, commonconfig.FuncdConfig)
+ port = config.listen_port
def getOverlord(self):
self.overlord_obj = client.Overlord(self.server_spec,
port=self.port,
diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py
index e1674fe..59a2997 100644
--- a/func/overlord/cmd_modules/call.py
+++ b/func/overlord/cmd_modules/call.py
@@ -36,6 +36,7 @@ class Call(base_command.BaseCommand):
summary = "allows a specific module and method to be called"
def addOptions(self):
self.parser.add_option("-v", "--verbose", dest="verbose",
+ default=self.verbose,
action="store_true")
self.parser.add_option("-x", "--xmlrpc", dest="xmlrpc",
help="output return data in XMLRPC format",
@@ -51,9 +52,10 @@ class Call(base_command.BaseCommand):
action="store_true")
self.parser.add_option("-f", "--forks", dest="forks",
help="how many parallel processes? (default 1)",
- default=DEFAULT_FORKS)
+ default=self.forks)
self.parser.add_option("-a", "--async", dest="async",
help="Use async calls? (default 0)",
+ default=self.async,
action="store_true")
self.parser.add_option("-n", "--nopoll", dest="nopoll",
help="Don't wait for async results",
@@ -66,6 +68,7 @@ class Call(base_command.BaseCommand):
action="store_true")
self.parser.add_option('-d', '--delegate', dest="delegate",
help="use delegation to make function call",
+ default=self.delegate,
action="store_true")
def handleOptions(self, options):
diff --git a/func/overlord/cmd_modules/check.py b/func/overlord/cmd_modules/check.py
index 58ecc6c..73d5efb 100644
--- a/func/overlord/cmd_modules/check.py
+++ b/func/overlord/cmd_modules/check.py
@@ -19,10 +19,11 @@ import os
import urllib2
from func.overlord import base_command
-from func import utils
+from certmaster import utils
from func.minion import sub_process
from certmaster.config import read_config
from certmaster.commonconfig import MinionConfig
+from func.commonconfig import FuncdConfig
class CheckAction(base_command.BaseCommand):
@@ -44,6 +45,10 @@ class CheckAction(base_command.BaseCommand):
def do(self, args):
+ self.minion_config = read_config('/etc/certmaster/minion.conf', MinionConfig)
+ self.funcd_config = read_config('/etc/func/minion.conf', FuncdConfig)
+
+
if not self.check_certmaster and not self.check_minion:
print "* specify --certmaster, --minion, or both"
return
@@ -110,15 +115,16 @@ class CheckAction(base_command.BaseCommand):
if rc == 0:
# FIXME: don't hardcode port
- print "* iptables may be running, ensure 51234 is unblocked"
+ print "* iptables may be running"
+ print "Insure that port %s is open for minions to connect to certmaster" % self.minion_config.certmaster_port
+ print "Insure that port %s is open for overlord to connect to minions" % self.funcd_config.listen_port
def check_talk_to_certmaster(self):
- config_file = '/etc/certmaster/minion.conf'
- minion_config = read_config(config_file, MinionConfig)
- cert_dir = minion_config.cert_dir
# FIXME: don't hardcode port
- master_uri = "http://%s:51235/" % minion_config.certmaster
- print "* this minion is configured in /etc/certmaster/minion.conf to talk to host '%s' for certs, verify that is correct" % minion_config.certmaster
+ master_uri = "http://%s:%s/" % (self.minion_config.certmaster, self.minion_config.certmaster_port)
+ print "* this minion is configured in /etc/certmaster/minion.conf"
+ print " to talk to host '%s' on port %s for certs, verify that is correct" % (self.minion_config.certmaster,
+ self.minion_config.certmaster_port)
# this will be a 501, unsupported GET, but we should be
# able to tell if we can make contact
connect_ok = True