From e0ffcf4ed82441080a2e1afb6cbfbdc0a57b3c3e Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 6 Jul 2009 20:19:51 +0000 Subject: [PATCH] rename configuration variables like from GENI_ to SFA_ --- INSTALL.txt | 4 +-- config/sfa-config-tty | 74 +++++++++++++++++++-------------------- config/sfa_config | 46 ++++++++++++------------ sfa/init.d/sfa | 6 ++-- sfa/plc/sfa-import-plc.py | 4 +-- sfa/server/aggregate.py | 4 +-- sfa/server/registry.py | 4 +-- sfa/trust/auth.py | 2 +- sfa/util/api.py | 10 +++--- sfa/util/config.py | 16 ++++----- sfa/util/method.py | 4 +-- 11 files changed, 87 insertions(+), 87 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 63a83f5a..10913d16 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -21,8 +21,8 @@ These two configuration parameters are required for SFA server configuration (a) # sfa-config-tty - set GENI_PLC_USER to PLC_ROOT_USER - set GENI_PLC_PASSWORD to PLC_ROOT_PASSWORD + set SFA_PLC_USER to PLC_ROOT_USER + set SFA_PLC_PASSWORD to PLC_ROOT_PASSWORD write and quit *NOTE* at this point you get a warning b/c the authorities hierarchy has not been created yet; ignore diff --git a/config/sfa-config-tty b/config/sfa-config-tty index 0c2f84e5..5cb575de 100755 --- a/config/sfa-config-tty +++ b/config/sfa-config-tty @@ -24,32 +24,32 @@ from sfa.trust.hierarchy import * from sfa.util.misc import * -all_variables = ["GENI_REGISTRY_ROOT_AUTH", - "GENI_REGISTRY_LEVEL1_AUTH", - "GENI_REGISTRY_ENABLED", - "GENI_REGISTRY_HOST", - "GENI_REGISTRY_PORT", - "GENI_AGGREGATE_ENABLED", - "GENI_AGGREGATE_HOST", - "GENI_AGGREGATE_PORT", - "GENI_SM_ENABLED", - "GENI_SM_HOST", - "GENI_SM_PORT", - "GENI_PLC_USER", - "GENI_PLC_PASSWORD", - "GENI_PLC_URL", - "GENI_PLC_DB_NAME", - "GENI_PLC_DB_HOST", - "GENI_PLC_DB_PORT", - "GENI_PLC_DB_USER", - "GENI_PLC_DB_PASSWORD", +all_variables = ["SFA_REGISTRY_ROOT_AUTH", + "SFA_REGISTRY_LEVEL1_AUTH", + "SFA_REGISTRY_ENABLED", + "SFA_REGISTRY_HOST", + "SFA_REGISTRY_PORT", + "SFA_AGGREGATE_ENABLED", + "SFA_AGGREGATE_HOST", + "SFA_AGGREGATE_PORT", + "SFA_SM_ENABLED", + "SFA_SM_HOST", + "SFA_SM_PORT", + "SFA_PLC_USER", + "SFA_PLC_PASSWORD", + "SFA_PLC_URL", + "SFA_PLC_DB_NAME", + "SFA_PLC_DB_HOST", + "SFA_PLC_DB_PORT", + "SFA_PLC_DB_USER", + "SFA_PLC_DB_PASSWORD", ] -usual_variables = ["GENI_REGISTRY_ROOT_AUTH", - "GENI_REGISTRY_LEVEL1_AUTH", - "GENI_PLC_USER", - "GENI_PLC_PASSWORD", - "GENI_PLC_DB_USER", - "GENI_PLC_DB_PASSWORD", +usual_variables = ["SFA_REGISTRY_ROOT_AUTH", + "SFA_REGISTRY_LEVEL1_AUTH", + "SFA_PLC_USER", + "SFA_PLC_PASSWORD", + "SFA_PLC_DB_USER", + "SFA_PLC_DB_PASSWORD", ] @@ -113,25 +113,25 @@ def validate(changes): defaults = get_defaults() - # GENI_INTERFACE_HRN is GENI_REGISTRY_LEVEL1_AUTH, if thats blank it - # then defaults to GENI_REGISTRY_ROOT_AUTH - # GENI_REGISTRY_LEVEL1_AUTH, so if either of these are present we must - # update GENI_INTERFACE_HRN - if 'GENI_REGISTRY_ROOT_AUTH' in changes: - root_auth = changes['GENI_REGISTRY_ROOT_AUTH'] + # SFA_INTERFACE_HRN is SFA_REGISTRY_LEVEL1_AUTH, if thats blank it + # then defaults to SFA_REGISTRY_ROOT_AUTH + # SFA_REGISTRY_LEVEL1_AUTH, so if either of these are present we must + # update SFA_INTERFACE_HRN + if 'SFA_REGISTRY_ROOT_AUTH' in changes: + root_auth = changes['SFA_REGISTRY_ROOT_AUTH'] else: - root_auth = defaults['GENI_REGISTRY_ROOT_AUTH'] + root_auth = defaults['SFA_REGISTRY_ROOT_AUTH'] - if 'GENI_REGISTRY_LEVEL1_AUTH' in changes: - level1_auth = changes['GENI_REGISTRY_LEVEL1_AUTH'] + if 'SFA_REGISTRY_LEVEL1_AUTH' in changes: + level1_auth = changes['SFA_REGISTRY_LEVEL1_AUTH'] else: - level1_auth = defaults['GENI_REGISTRY_LEVEL1_AUTH'] + level1_auth = defaults['SFA_REGISTRY_LEVEL1_AUTH'] if level1_auth: interface_hrn = level1_auth else: interface_hrn = root_auth - changes['GENI_INTERFACE_HRN'] = interface_hrn + changes['SFA_INTERFACE_HRN'] = interface_hrn return changes def get_defaults(): @@ -230,7 +230,7 @@ def mainloop (default_config, config_file): return result def setup_server_key(config_dict): - hrn = config_dict.get('GENI_INTERFACE_HRN') + hrn = config_dict.get('SFA_INTERFACE_HRN') if not hrn: return # Get the path to the authorities directory hierarchy diff --git a/config/sfa_config b/config/sfa_config index 7c78b0fb..c4bae71e 100644 --- a/config/sfa_config +++ b/config/sfa_config @@ -1,98 +1,98 @@ # Directory where SFA interfaces are installed -GENI_BASE_DIR="/usr/share/sfa/" +SFA_BASE_DIR="/usr/share/sfa/" # HRN # Human readable name for the interfaces -GENI_INTERFACE_HRN="plc" +SFA_INTERFACE_HRN="plc" # API Debug # Are we logging -GENI_API_DEBUG=1 +SFA_API_DEBUG=1 # Registry Configuration # # Enabled # Enable the registry interface -GENI_REGISTRY_ENABLED=1 +SFA_REGISTRY_ENABLED=1 # Root Auth # The hrn of the registry's root auth -GENI_REGISTRY_ROOT_AUTH="plc" +SFA_REGISTRY_ROOT_AUTH="plc" # Level1 Auth # The hrn of the registry's level1 auth # xxx could be determined from hrn above -GENI_REGISTRY_LEVEL1_AUTH="" +SFA_REGISTRY_LEVEL1_AUTH="" # Hostname # The fully qualified hostname of the registry server -GENI_REGISTRY_HOST="localhost" +SFA_REGISTRY_HOST="localhost" # Port # Geni registry port -GENI_REGISTRY_PORT=12345 +SFA_REGISTRY_PORT=12345 ## Aggregate Configuration ## ## Enable aggregate inteface ## Enable the aggregate inteface. -GENI_AGGREGATE_ENABLED=1 +SFA_AGGREGATE_ENABLED=1 # ## Hostname ## The fully qualified hostname of the aggregate server -GENI_AGGREGATE_HOST="localhost" +SFA_AGGREGATE_HOST="localhost" # ## Port ## Geni aggregate server port -GENI_AGGREGATE_PORT=12346 +SFA_AGGREGATE_PORT=12346 # Slice Manager Configuration # # Enabled # Enable the slice manager -GENI_SM_ENABLED=1 +SFA_SM_ENABLED=1 # Host ## The fully qualified hostname or IP address of the slice manager server -GENI_SM_HOST="localhost" +SFA_SM_HOST="localhost" # Port # Geni slice manager server port -GENI_SM_PORT=12347 +SFA_SM_PORT=12347 # PLC Interface Access Configuration # # PLC user # Valid plc account geni interfaces will use for plc requests -GENI_PLC_USER='root@localhost.localdomain' +SFA_PLC_USER='root@localhost.localdomain' # Password # Password for user account -GENI_PLC_PASSWORD='root' +SFA_PLC_PASSWORD='root' # Hostname # Fully qualified hostname of PLC interface -GENI_PLC_URL='https://localhost:443/PLCAPI/' +SFA_PLC_URL='https://localhost:443/PLCAPI/' # PLC Shell PATH # Path of PLC shell. This only applies if Geni interfaces and PLC interface are running on the same # machine -GENI_PLC_SHELL_PATH='/usr/share/plc_api' +SFA_PLC_SHELL_PATH='/usr/share/plc_api' # PLC DB Name -GENI_PLC_DB_NAME='planetlab5' +SFA_PLC_DB_NAME='planetlab5' # PLC DB Host -GENI_PLC_DB_HOST='www.planet-lab.org' +SFA_PLC_DB_HOST='www.planet-lab.org' # PLC DB port -GENI_PLC_DB_PORT=5432 +SFA_PLC_DB_PORT=5432 # PLC DB User -GENI_PLC_DB_USER='pgsqluser' +SFA_PLC_DB_USER='pgsqluser' # PLC DB Password -GENI_PLC_DB_PASSWORD='' +SFA_PLC_DB_PASSWORD='' diff --git a/sfa/init.d/sfa b/sfa/init.d/sfa index bbfa3961..06051b04 100755 --- a/sfa/init.d/sfa +++ b/sfa/init.d/sfa @@ -20,17 +20,17 @@ start() { echo -n $"Starting SFA: " - if [ "$GENI_REGISTRY_ENABLED" ]; then + if [ "$SFA_REGISTRY_ENABLED" ]; then echo "Registry" daemon /usr/bin/sfa-server.py -r -d $OPTIONS fi - if [ "$GENI_AGGREGATE_ENABLED" ]; then + if [ "$SFA_AGGREGATE_ENABLED" ]; then echo "Aggregate" daemon /usr/bin/sfa-server.py -a -d $OPTIONS fi - if [ "$GENI_SM_ENABLED" ]; then + if [ "$SFA_SM_ENABLED" ]; then echo "SliceMgr" daemon /usr/bin/sfa-server.py -s -d $OPTIONS fi diff --git a/sfa/plc/sfa-import-plc.py b/sfa/plc/sfa-import-plc.py index 97eecc12..34601b03 100755 --- a/sfa/plc/sfa-import-plc.py +++ b/sfa/plc/sfa-import-plc.py @@ -62,8 +62,8 @@ shell = connect_shell() #level1_auth = "planetlab.us" config = Config() -root_auth = config.GENI_REGISTRY_ROOT_AUTH -level1_auth = config.GENI_REGISTRY_LEVEL1_AUTH +root_auth = config.SFA_REGISTRY_ROOT_AUTH +level1_auth = config.SFA_REGISTRY_LEVEL1_AUTH if not level1_auth or level1_auth in ['']: level1_auth = None diff --git a/sfa/server/aggregate.py b/sfa/server/aggregate.py index 696c9967..7f2fa87a 100644 --- a/sfa/server/aggregate.py +++ b/sfa/server/aggregate.py @@ -105,8 +105,8 @@ class Aggregates(dict): # set up a connection to the local registry # connect to registry using GeniClient - address = self.api.config.GENI_AGGREGATE_HOST - port = self.api.config.GENI_AGGREGATE_PORT + address = self.api.config.SFA_AGGREGATE_HOST + port = self.api.config.SFA_AGGREGATE_PORT url = 'http://%(address)s:%(port)s' % locals() self[self.api.hrn] = GeniClient(url, self.api.key_file, self.api.cert_file) diff --git a/sfa/server/registry.py b/sfa/server/registry.py index 3b209ea8..65da7c5d 100644 --- a/sfa/server/registry.py +++ b/sfa/server/registry.py @@ -112,8 +112,8 @@ class Registries(dict): # set up a connection to the local registry # connect to registry using GeniClient - address = self.api.config.GENI_REGISTRY_HOST - port = self.api.config.GENI_REGISTRY_PORT + address = self.api.config.SFA_REGISTRY_HOST + port = self.api.config.SFA_REGISTRY_PORT url = 'http://%(address)s:%(port)s' % locals() self[self.api.hrn] = GeniClient(url, self.api.key_file, self.api.cert_file) diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index 67d6d71b..c8251d63 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -207,7 +207,7 @@ class Auth: type = record.get_type() cred_object_hrn = src_cred.get_gid_object().get_hrn() - if cred_object_hrn in [self.config.GENI_REGISTRY_ROOT_AUTH]: + if cred_object_hrn in [self.config.SFA_REGISTRY_ROOT_AUTH]: return if type=="slice": researchers = record.get("researcher", []) diff --git a/sfa/util/api.py b/sfa/util/api.py index 03ea9a1b..ce6a7abe 100644 --- a/sfa/util/api.py +++ b/sfa/util/api.py @@ -117,16 +117,16 @@ class GeniAPI: self.credential = None self.plshell = self.getPLCShell() self.plshell_version = self.getPLCShellVersion() - self.basedir = self.config.GENI_BASE_DIR + os.sep + self.basedir = self.config.SFA_BASE_DIR + os.sep self.server_basedir = self.basedir + os.sep + "geni" + os.sep - self.hrn = self.config.GENI_INTERFACE_HRN + self.hrn = self.config.SFA_INTERFACE_HRN self.time_format = "%Y-%m-%d %H:%M:%S" def getPLCShell(self): - self.plauth = {'Username': self.config.GENI_PLC_USER, + self.plauth = {'Username': self.config.SFA_PLC_USER, 'AuthMethod': 'password', - 'AuthString': self.config.GENI_PLC_PASSWORD} + 'AuthString': self.config.SFA_PLC_PASSWORD} try: import PLC.Shell shell = PLC.Shell.Shell(globals = globals()) @@ -134,7 +134,7 @@ class GeniAPI: return shell except ImportError: # connect via xmlrpc - url = self.config.GENI_PLC_URL + url = self.config.SFA_PLC_URL shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) shell.AuthCheck(self.plauth) diff --git a/sfa/util/config.py b/sfa/util/config.py index 680cd8d3..bde3f568 100644 --- a/sfa/util/config.py +++ b/sfa/util/config.py @@ -45,11 +45,11 @@ class Config: def get_default_dbinfo(): config = Config() dbinfo={ - 'dbname' : config.GENI_PLC_DB_NAME, - 'address' : config.GENI_PLC_DB_HOST, - 'port' : config.GENI_PLC_DB_PORT, - 'user' : config.GENI_PLC_DB_USER, - 'password' : config.GENI_PLC_DB_PASSWORD + 'dbname' : config.SFA_PLC_DB_NAME, + 'address' : config.SFA_PLC_DB_HOST, + 'port' : config.SFA_PLC_DB_PORT, + 'user' : config.SFA_PLC_DB_USER, + 'password' : config.SFA_PLC_DB_PASSWORD } return dbinfo @@ -66,9 +66,9 @@ def get_default_dbinfo(): def get_pl_auth(): config = Config() pl_auth = { - 'Username': config.GENI_PLC_USER, + 'Username': config.SFA_PLC_USER, 'AuthMethod': 'capability', - 'AuthString': config.GENI_PLC_PASSWORD, - "Url": config.GENI_PLC_URL + 'AuthString': config.SFA_PLC_PASSWORD, + "Url": config.SFA_PLC_URL } return pl_auth diff --git a/sfa/util/method.py b/sfa/util/method.py index d3820425..9683bc54 100644 --- a/sfa/util/method.py +++ b/sfa/util/method.py @@ -91,7 +91,7 @@ class Method (object): result = self.call(*args, **kwds) runtime = time.time() - start - if self.api.config.GENI_API_DEBUG or hasattr(self, 'message'): + if self.api.config.SFA_API_DEBUG or hasattr(self, 'message'): # XX print to some log file # print >> log, "some output" pass @@ -106,7 +106,7 @@ class Method (object): fault.faultString = caller + ": " + self.name + ": " + fault.faultString runtime = time.time() - start - if self.api.config.GENI_API_DEBUG: + if self.api.config.SFA_API_DEBUG: # XX print to some log file #print >> log, "Some debugging output" pass -- 2.43.0