diff options
-rw-r--r-- | buildtools/make-python-executable.py | 38 | ||||
-rw-r--r-- | buildtools/python-header | 3 | ||||
-rw-r--r-- | buildtools/pywrap-header | 3 | ||||
-rwxr-xr-x | configure | 40 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | rpkid/Makefile.in | 49 | ||||
-rw-r--r-- | rpkid/backup-sql.py | 2 | ||||
-rw-r--r-- | rpkid/examples/rpki.conf (renamed from rpkid/examples/myrpki.conf) | 0 | ||||
-rw-r--r-- | rpkid/irbe_cli.py | 2 | ||||
-rw-r--r-- | rpkid/rpki/__doc__.py.in | 26 | ||||
-rw-r--r-- | rpkid/rpki/config.py | 59 | ||||
-rw-r--r-- | rpkid/rpki/irdbd.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/myrpki.py | 8 | ||||
-rw-r--r-- | rpkid/rpki/pubd.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/rootd.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/rpkid.py | 4 | ||||
-rw-r--r-- | rpkid/sql-setup.py | 4 | ||||
-rw-r--r-- | rpkid/start-servers.py | 4 | ||||
-rw-r--r-- | rpkid/tests/smoketest.py | 5 | ||||
-rw-r--r-- | rpkid/tests/sql-cleaner.py | 2 | ||||
-rw-r--r-- | rpkid/tests/sql-dumper.py | 2 | ||||
-rw-r--r-- | rpkid/tests/yamltest.py | 10 |
22 files changed, 168 insertions, 118 deletions
diff --git a/buildtools/make-python-executable.py b/buildtools/make-python-executable.py new file mode 100644 index 00000000..eeb31e39 --- /dev/null +++ b/buildtools/make-python-executable.py @@ -0,0 +1,38 @@ +""" +Convert a Python script into an executable Python script. Mostly this +means constructing a header based on a few parameters supplied by +autoconf. + +$Id$ + +Copyright (C) 2011 Internet Systems Consortium ("ISC") + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +""" + +import os, sys + +sys.stdout.write('''\ +#!%(AC_PYTHON_INTERPRETER)s +# Automatically constructed script header + +# Set location of global rpki.conf file +if __name__ == "__main__": + import rpki.config + rpki.config.default_dirname = "%(AC_RPKI_CONFIG_DIR)s" + +# Original script starts here + +''' % os.environ) + +sys.stdout.write(sys.stdin.read()) diff --git a/buildtools/python-header b/buildtools/python-header deleted file mode 100644 index 24120c9d..00000000 --- a/buildtools/python-header +++ /dev/null @@ -1,3 +0,0 @@ -#!@PYTHON@ -# -*- Python-*- @configure_input@ - diff --git a/buildtools/pywrap-header b/buildtools/pywrap-header deleted file mode 100644 index 94fb51b1..00000000 --- a/buildtools/pywrap-header +++ /dev/null @@ -1,3 +0,0 @@ -#!@PYWRAP@ -# -*- Python-*- @configure_input@ - @@ -4164,28 +4164,6 @@ if test $build_python = yes then ac_config_files="$ac_config_files rpkid/Makefile rpkid/tests/Makefile" - - # These are plain Python scripts, do not require pywrap - ac_config_files="$ac_config_files rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py" - - ac_config_files="$ac_config_files rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py" - - ac_config_files="$ac_config_files rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py" - - - # These use POW, so may require pywrap - ac_config_files="$ac_config_files rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py" - - ac_config_files="$ac_config_files rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py" - - ac_config_files="$ac_config_files rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py" - - ac_config_files="$ac_config_files rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py" - - ac_config_files="$ac_config_files rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py" - - ac_config_files="$ac_config_files rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py" - fi # This should go away once its content has migrated from Doxygen into DocBook. @@ -4923,15 +4901,6 @@ do "pywrap/Makefile") CONFIG_FILES="$CONFIG_FILES pywrap/Makefile" ;; "rpkid/Makefile") CONFIG_FILES="$CONFIG_FILES rpkid/Makefile" ;; "rpkid/tests/Makefile") CONFIG_FILES="$CONFIG_FILES rpkid/tests/Makefile" ;; - "rpkid/backup-sql") CONFIG_FILES="$CONFIG_FILES rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py" ;; - "rpkid/sql-setup") CONFIG_FILES="$CONFIG_FILES rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py" ;; - "rpkid/start-servers") CONFIG_FILES="$CONFIG_FILES rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py" ;; - "rpkid/irbe_cli") CONFIG_FILES="$CONFIG_FILES rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py" ;; - "rpkid/irdbd") CONFIG_FILES="$CONFIG_FILES rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py" ;; - "rpkid/myrpki") CONFIG_FILES="$CONFIG_FILES rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py" ;; - "rpkid/pubd") CONFIG_FILES="$CONFIG_FILES rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py" ;; - "rpkid/rootd") CONFIG_FILES="$CONFIG_FILES rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py" ;; - "rpkid/rpkid") CONFIG_FILES="$CONFIG_FILES rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py" ;; "rpkid/rpki/__doc__.py") CONFIG_FILES="$CONFIG_FILES rpkid/rpki/__doc__.py" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -5349,15 +5318,6 @@ which seems to be undefined. Please make sure it is defined" >&2;} case $ac_file$ac_mode in "rcynic/show.sh":F) chmod +x rcynic/show.sh ;; - "rpkid/backup-sql":F) chmod +x rpkid/backup-sql ;; - "rpkid/sql-setup":F) chmod +x rpkid/sql-setup ;; - "rpkid/start-servers":F) chmod +x rpkid/start-servers ;; - "rpkid/irbe_cli":F) chmod +x rpkid/irbe_cli ;; - "rpkid/irdbd":F) chmod +x rpkid/irdbd ;; - "rpkid/myrpki":F) chmod +x rpkid/myrpki ;; - "rpkid/pubd":F) chmod +x rpkid/pubd ;; - "rpkid/rootd":F) chmod +x rpkid/rootd ;; - "rpkid/rpkid":F) chmod +x rpkid/rpkid ;; esac done # for ac_tag diff --git a/configure.ac b/configure.ac index 06b23933..2dc1efb3 100644 --- a/configure.ac +++ b/configure.ac @@ -295,19 +295,6 @@ AC_SUBST(PYWRAP_LIBDIR) if test $build_python = yes then AC_CONFIG_FILES([rpkid/Makefile rpkid/tests/Makefile]) - - # These are plain Python scripts, do not require pywrap - AC_CONFIG_FILES([rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py], [chmod +x rpkid/backup-sql]) - AC_CONFIG_FILES([rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py], [chmod +x rpkid/sql-setup]) - AC_CONFIG_FILES([rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py], [chmod +x rpkid/start-servers]) - - # These use POW, so may require pywrap - AC_CONFIG_FILES([rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py], [chmod +x rpkid/irbe_cli]) - AC_CONFIG_FILES([rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py], [chmod +x rpkid/irdbd]) - AC_CONFIG_FILES([rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py], [chmod +x rpkid/myrpki]) - AC_CONFIG_FILES([rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py], [chmod +x rpkid/pubd]) - AC_CONFIG_FILES([rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py], [chmod +x rpkid/rootd]) - AC_CONFIG_FILES([rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py], [chmod +x rpkid/rpkid]) fi # This should go away once its content has migrated from Doxygen into DocBook. diff --git a/rpkid/Makefile.in b/rpkid/Makefile.in index 526f7522..68c4c272 100644 --- a/rpkid/Makefile.in +++ b/rpkid/Makefile.in @@ -1,18 +1,29 @@ # $Id$ PYTHON = @PYTHON@ +PYWRAP = @PYWRAP@ PYWRAP_CMD = @PYWRAP_CMD@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localstatedir = @localstatedir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ + abs_top_srcdir = @abs_top_srcdir@ abs_top_builddir = @abs_top_builddir@ SETUP_PY = AC_CFLAGS='${CFLAGS}' AC_LDFLAGS='${LDFLAGS}' AC_LIBS='${LIBS}' ${PYTHON} setup.py -all: rpki/pow/_POW.so rpki/relaxng.py myrpki.rng +EXECUTABLES = backup-sql sql-setup start-servers irbe_cli irdbd myrpki pubd rootd rpkid + +all: rpki/pow/_POW.so rpki/relaxng.py myrpki.rng ${EXECUTABLES} rpki/pow/_POW.so: ext/POW.c setup.py ${SETUP_PY} build_ext --inplace @@ -37,8 +48,9 @@ myrpki.rng: myrpki.rnc trang myrpki.rnc myrpki.rng clean:: - find . -type f -name '*.pyc' -delete + find . -type f -name '*.py[co]' -delete cd tests; $(MAKE) $@ + rm -f ${EXECUTABLES} install: ${SETUP_PY} install @@ -128,4 +140,35 @@ docs: dot eps png html text tgz pdf distclean: clean docclean cd tests; ${MAKE} $@ - rm -f TAGS rpki/__doc__.py rootd rpkid backup-sql irbe_cli irdbd myrpki pubd sql-setup start-servers Makefile + rm -f TAGS rpki/__doc__.py Makefile + +COMPILE_COMMON = AC_RPKI_CONFIG_DIR='${sysconfdir}' ${PYTHON} ${abs_top_srcdir}/buildtools/make-python-executable.py <$? >$@; chmod +x $@ +COMPILE_PYTHON = AC_PYTHON_INTERPRETER='${PYTHON}' ${COMPILE_COMMON} +COMPILE_PYWRAP = AC_PYTHON_INTERPRETER='${PYWRAP}' ${COMPILE_COMMON} + +backup-sql: backup-sql.py + ${COMPILE_PYTHON} + +sql-setup: sql-setup.py + ${COMPILE_PYTHON} + +start-servers: start-servers.py + ${COMPILE_PYTHON} + +irbe_cli: irbe_cli.py + ${COMPILE_PYWRAP} + +irdbd: irdbd.py + ${COMPILE_PYWRAP} + +myrpki: myrpki.py + ${COMPILE_PYWRAP} + +pubd: pubd.py + ${COMPILE_PYWRAP} + +rootd: rootd.py + ${COMPILE_PYWRAP} + +rpkid: rpkid.py + ${COMPILE_PYWRAP} diff --git a/rpkid/backup-sql.py b/rpkid/backup-sql.py index cdf5beac..0a7c9594 100644 --- a/rpkid/backup-sql.py +++ b/rpkid/backup-sql.py @@ -26,7 +26,7 @@ import subprocess, os, getopt, sys, time, rpki.config os.environ["TZ"] = "UTC" time.tzset() -cfg_file = "myrpki.conf" +cfg_file = None opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) for o, a in opts: diff --git a/rpkid/examples/myrpki.conf b/rpkid/examples/rpki.conf index 3ef99fd6..3ef99fd6 100644 --- a/rpkid/examples/myrpki.conf +++ b/rpkid/examples/rpki.conf diff --git a/rpkid/irbe_cli.py b/rpkid/irbe_cli.py index 36f03421..58c4c0bf 100644 --- a/rpkid/irbe_cli.py +++ b/rpkid/irbe_cli.py @@ -265,7 +265,7 @@ argv = sys.argv[1:] if not argv: usage(0) -cfg_file = "irbe.conf" +cfg_file = None verbose = True opts, argv = getopt.getopt(argv, "c:hpqv?", top_opts) diff --git a/rpkid/rpki/__doc__.py.in b/rpkid/rpki/__doc__.py.in index 7b2b280b..9576acd7 100644 --- a/rpkid/rpki/__doc__.py.in +++ b/rpkid/rpki/__doc__.py.in @@ -169,8 +169,8 @@ # At present the daemon programs all run in foreground, that is, the # daemons themselves make no attempt to put themselves in background. # The easiest way to run the servers is to run the @c start_servers -# script, which examines your @c myrpki.conf file and starts the -# appropriate servers in background using @c myrpki.conf as the +# script, which examines your @c rpki.conf file and starts the +# appropriate servers in background using @c rpki.conf as the # configuration file for each server as well. # # If you prefer, you can run each server by hand instead of using the @@ -534,18 +534,18 @@ # to the value of the @c baz variable from section @c bar. The section # name @c ENV is special: it refers to environment variables. # -# @section myrpkiconf myrpki.conf +# @section rpkiconf rpki.conf # -# The default name for the shared configuration file is @c myrpki.conf. +# The default name for the shared configuration file is @c rpki.conf. # Unless you really know what you're doing, you should start by -# copying the @c $top/myrpki.conf from the @c rpkid/examples directory and +# copying the @c rpki.conf from the @c rpkid/examples directory and # modifying it, as the sample configuration file already includes all # the additional settings necessary to use the simplified configuration. # -# @dontinclude myrpki.conf +# @dontinclude rpki.conf # @skipline [myrpki] # -# The @c [myrpki] section of @c myrpki.conf contains all the +# The @c [myrpki] section of @c rpki.conf contains all the # parameters that you really need to configure. # # @skip # @@ -621,7 +621,7 @@ # underneath that name. In most cases @c publication_rsync_server # should be the same as @c publication_rsync_server, which is what the # macro invocation in the default setting does. @c -# publication_base_directory, like other pathnames in @c myrpki.conf, +# publication_base_directory, like other pathnames in @c rpki.conf, # can be either a relative or absolute pathname; if relative, it's # interpreted with respect to the directory in which the programs in # question were started. In this specific case, it's probably better @@ -664,13 +664,13 @@ # @section otherconf Other configuration files and options # # In most cases the simplified configuration in the @c [myrpki] -# section of @c myrpki.conf should suffice, but in case you need to +# section of @c rpki.conf should suffice, but in case you need to # tinker, here are details on the the rest of the configuration # options. In most cases the default name of the configuration file # for a program is the name of the program followed by @c ".conf", and # the section name is also named for the program, so that you can # combine sections into a single configuration file as shown with @c -# myrpki.conf. +# rpki.conf. # # @li @subpage CommonOptions "Common configuration options" # @@ -705,7 +705,7 @@ # set up the MySQL databases they use. You can do this by hand, or # you can use the @c sql-setup.py script, which prompts you for your # MySQL root password then attempts to do everything else -# automatically using values from myrpki.conf. +# automatically using values from rpki.conf. # # Using the script is simple: # @@ -860,7 +860,7 @@ # Keep reading, and don't panic. # # The default configuration file name for @c myrpki is -# @ref Configuration "@c myrpki.conf". +# @ref Configuration "@c rpki.conf". # You can change this using the "-c" option when invoking myrpki, or # by setting the environment variable MYRPKI_CONF. # @@ -888,7 +888,7 @@ # # The steps needed during setup phase are: # -# @li Write a configuration file (copy $top/rpkid/examples/myrpki.conf +# @li Write a configuration file (copy $top/rpkid/examples/rpki.conf # and edit as needed). You need to configure the @c [myrpki] section; # in theory, the rest of the file should be ok as it is, at least for # simple use. You also need to create (either by hand or by dumping diff --git a/rpkid/rpki/config.py b/rpkid/rpki/config.py index 2bdc160c..59ac6efd 100644 --- a/rpkid/rpki/config.py +++ b/rpkid/rpki/config.py @@ -35,6 +35,23 @@ PERFORMANCE OF THIS SOFTWARE. import ConfigParser, os, re +## @var default_filename +# Default name of config file if caller doesn't specify one explictly. + +default_filename = "rpki.conf" + +## @var default_dirname +# Default name of directory to check for global config file, or None +# if no global config file. Autoconf-generated code may set this to a +# non-None value during script startup. + +default_dirname = None + +## @var default_envname +# Name of environment variable containing config file name. + +default_envname = "RPKI_CONF" + class parser(object): """ Extensions to stock Python ConfigParser: @@ -45,22 +62,44 @@ class parser(object): OpenSSL-style indirect variable references (${section::option}). get-methods with default values and default section name. + + If no filename is given to the constructor (filename = None), we + check for an environment variable naming the config file, then we + check for a default filename in the current directory, then finally + we check for a global config file if autoconf provided a directory + name to check. """ - def __init__(self, filename, section = None, allow_missing = False): - """ - Initialize this parser. - """ + def __init__(self, filename = None, section = None, allow_missing = False): - self.filename = filename self.cfg = ConfigParser.RawConfigParser() - try: - self.cfg.readfp(open(filename), filename) - except IOError: - if not allow_missing: - raise self.default_section = section + filenames = [] + if filename is not None: + filenames.append(filename) + else: + if default_envname in os.environ: + filenames.append(os.environ[default_envname]) + filenames.append(default_filename) + if default_dirname is not None: + filenames.append("%s/%s" % (default_dirname, default_filename)) + + for fn in filenames: + try: + f = open(fn) + break + except IOError: + f = None + + if f is not None: + self.filename = fn + self.cfg.readfp(f, fn) + elif allow_missing: + self.filename = None + else: + raise + def has_section(self, section): """ Test whether a section exists. diff --git a/rpkid/rpki/irdbd.py b/rpkid/rpki/irdbd.py index a90f71ce..b5edf70e 100644 --- a/rpkid/rpki/irdbd.py +++ b/rpkid/rpki/irdbd.py @@ -3,8 +3,6 @@ IR database daemon. Usage: python irdbd.py [ { -c | --config } configfile ] [ { -h | --help } ] -Default configuration file is irdbd.conf, override with --config option. - $Id$ Copyright (C) 2009--2010 Internet Systems Consortium ("ISC") @@ -175,7 +173,7 @@ class main(object): os.environ["TZ"] = "UTC" time.tzset() - cfg_file = "irdbd.conf" + cfg_file = None opts, argv = getopt.getopt(sys.argv[1:], "c:dh?", ["config=", "debug", "help"]) for o, a in opts: diff --git a/rpkid/rpki/myrpki.py b/rpkid/rpki/myrpki.py index 136a41d1..dc375357 100644 --- a/rpkid/rpki/myrpki.py +++ b/rpkid/rpki/myrpki.py @@ -899,7 +899,7 @@ class main(rpki.cli.Cmd): rpki.log.use_syslog = False - self.cfg_file = os.getenv("MYRPKI_CONF", "myrpki.conf") + self.cfg_file = None opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) for o, a in opts: @@ -950,9 +950,9 @@ class main(rpki.cli.Cmd): if self.run_rootd and (not self.run_pubd or not self.run_rpkid): raise RuntimeError, "Can't run rootd unless also running rpkid and pubd" - self.bpki_resources = CA(self.cfg_file, self.cfg.get("bpki_resources_directory")) + self.bpki_resources = CA(self.cfg.filename, self.cfg.get("bpki_resources_directory")) if self.run_rpkid or self.run_pubd or self.run_rootd: - self.bpki_servers = CA(self.cfg_file, self.cfg.get("bpki_servers_directory")) + self.bpki_servers = CA(self.cfg.filename, self.cfg.get("bpki_servers_directory")) self.pubd_contact_info = self.cfg.get("pubd_contact_info", "") @@ -1560,7 +1560,7 @@ class main(rpki.cli.Cmd): action = "set", bpki_crl = rpki.x509.CRL(PEM_file = self.bpki_servers.crl))) - irdbd_cfg = rpki.config.parser(self.cfg.get("irdbd_conf", self.cfg_file), "irdbd") + irdbd_cfg = rpki.config.parser(self.cfg.get("irdbd_conf", self.cfg.filename), "irdbd") db = MySQLdb.connect(user = irdbd_cfg.get("sql-username"), db = irdbd_cfg.get("sql-database"), diff --git a/rpkid/rpki/pubd.py b/rpkid/rpki/pubd.py index c842b6c6..0fd4b713 100644 --- a/rpkid/rpki/pubd.py +++ b/rpkid/rpki/pubd.py @@ -5,8 +5,6 @@ Usage: python pubd.py [ { -c | --config } configfile ] [ { -h | --help } ] [ { -p | --profile } outputfile ] -Default configuration file is pubd.conf, override with --config option. - $Id$ Copyright (C) 2009--2010 Internet Systems Consortium ("ISC") @@ -53,7 +51,7 @@ class main(object): os.environ["TZ"] = "UTC" time.tzset() - self.cfg_file = "pubd.conf" + self.cfg_file = None self.profile = False opts, argv = getopt.getopt(sys.argv[1:], "c:dhp:?", ["config=", "debug", "help"]) diff --git a/rpkid/rpki/rootd.py b/rpkid/rpki/rootd.py index 74674b57..9a8620a1 100644 --- a/rpkid/rpki/rootd.py +++ b/rpkid/rpki/rootd.py @@ -5,8 +5,6 @@ rpki.* classes in order to reuse as much code as possible. Usage: python rootd.py [ { -c | --config } configfile ] [ { -h | --help } ] -Default configuration file is rootd.conf, override with --config option. - $Id$ Copyright (C) 2009--2010 Internet Systems Consortium ("ISC") @@ -269,7 +267,7 @@ class main(object): os.environ["TZ"] = "UTC" time.tzset() - self.cfg_file = "rootd.conf" + self.cfg_file = None opts, argv = getopt.getopt(sys.argv[1:], "c:dh?", ["config=", "debug", "help"]) for o, a in opts: diff --git a/rpkid/rpki/rpkid.py b/rpkid/rpki/rpkid.py index 927e1456..f36e3ee1 100644 --- a/rpkid/rpki/rpkid.py +++ b/rpkid/rpki/rpkid.py @@ -5,8 +5,6 @@ Usage: python rpkid.py [ { -c | --config } configfile ] [ { -h | --help } ] [ { -p | --profile } outputfile ] -Default configuration file is rpkid.conf, override with --config option. - $Id$ Copyright (C) 2009--2010 Internet Systems Consortium ("ISC") @@ -56,7 +54,7 @@ class main(object): os.environ["TZ"] = "UTC" time.tzset() - self.cfg_file = "rpkid.conf" + self.cfg_file = None self.profile = None opts, argv = getopt.getopt(sys.argv[1:], "c:dhp:?", ["config=", "debug", "help", "profile="]) diff --git a/rpkid/sql-setup.py b/rpkid/sql-setup.py index 2074de03..360b76a9 100644 --- a/rpkid/sql-setup.py +++ b/rpkid/sql-setup.py @@ -1,6 +1,6 @@ """ Automated setup of all the pesky SQL stuff we need. Prompts for MySQL -root password, pulls other information from myrpki.conf. +root password, pulls other information from rpki.conf. $Id$ @@ -80,7 +80,7 @@ def sql_setup(name): db.commit() db.close() -cfg_file = "myrpki.conf" +cfg_file = None verbose = False diff --git a/rpkid/start-servers.py b/rpkid/start-servers.py index 168ca33a..1d7862df 100644 --- a/rpkid/start-servers.py +++ b/rpkid/start-servers.py @@ -41,7 +41,7 @@ rpkid_dir = os.path.normpath(sys.path[0]) os.environ["TZ"] = "UTC" time.tzset() -cfg_file = "myrpki.conf" +cfg_file = None debug = False piddir = None @@ -60,7 +60,7 @@ for o, a in opts: cfg = rpki.config.parser(cfg_file, "myrpki") def run(name): - cmd = (sys.executable, os.path.join(rpkid_dir, name + ".py"), "-c", cfg_file) + cmd = (sys.executable, os.path.join(rpkid_dir, name + ".py"), "-c", cfg.filename) if debug: proc = subprocess.Popen(cmd + ("-d",), stdout = open(name + ".log", "a"), stderr = subprocess.STDOUT) else: diff --git a/rpkid/tests/smoketest.py b/rpkid/tests/smoketest.py index 3b4fe7bc..448d93b4 100644 --- a/rpkid/tests/smoketest.py +++ b/rpkid/tests/smoketest.py @@ -7,8 +7,6 @@ Usage: python smoketest.py [ { -c | --config } config_file ] [ { -p | --profile } ] [ { -y | --yaml } yaml_script ] -Default config_file is smoketest.conf, override with --config option. - Default yaml_script is smoketest.yaml, override with -yaml option. yaml_script is a YAML file describing the tests to be run, and is @@ -65,8 +63,7 @@ else: os.environ["TZ"] = "UTC" time.tzset() -cfg_file = "smoketest.conf" - +cfg_file = None yaml_script = None profile = False diff --git a/rpkid/tests/sql-cleaner.py b/rpkid/tests/sql-cleaner.py index 7900ddf9..5c772bc4 100644 --- a/rpkid/tests/sql-cleaner.py +++ b/rpkid/tests/sql-cleaner.py @@ -20,7 +20,7 @@ PERFORMANCE OF THIS SOFTWARE. import subprocess, rpki.config -cfg = rpki.config.parser("yamltest.conf", "yamltest", allow_missing = True) +cfg = rpki.config.parser(None, "yamltest", allow_missing = True) for name in ("rpkid", "irdbd", "pubd"): diff --git a/rpkid/tests/sql-dumper.py b/rpkid/tests/sql-dumper.py index 933b7a2c..503ba98b 100644 --- a/rpkid/tests/sql-dumper.py +++ b/rpkid/tests/sql-dumper.py @@ -20,7 +20,7 @@ PERFORMANCE OF THIS SOFTWARE. import subprocess, rpki.config -cfg = rpki.config.parser("yamltest.conf", "yamltest") +cfg = rpki.config.parser(None, "yamltest") for name in ("rpkid", "irdbd", "pubd"): diff --git a/rpkid/tests/yamltest.py b/rpkid/tests/yamltest.py index 8e140746..ecd00af2 100644 --- a/rpkid/tests/yamltest.py +++ b/rpkid/tests/yamltest.py @@ -425,7 +425,7 @@ class allocation(object): print "Writing", f.name section = None - for line in open(cleanpath(rpkid_dir, "examples/myrpki.conf")): + for line in open(cleanpath(rpkid_dir, "examples/rpki.conf")): m = section_regexp.match(line) if m: section = m.group(1) @@ -486,7 +486,7 @@ class allocation(object): representing the running daemon. """ basename = os.path.basename(prog) - p = subprocess.Popen((sys.executable, prog, "-d", "-c", self.path("myrpki.conf")), + p = subprocess.Popen((sys.executable, prog, "-d", "-c", self.path("rpki.conf")), cwd = self.path(), stdout = open(self.path(os.path.splitext(basename)[0] + ".log"), "w"), stderr = subprocess.STDOUT) @@ -541,7 +541,7 @@ class allocation(object): os.environ["TZ"] = "UTC" time.tzset() -cfg_file = "yamltest.conf" +cfg_file = None pidfile = None keep_going = False @@ -613,7 +613,7 @@ try: d.dump_asns("asns.csv") d.dump_prefixes("prefixes.csv") d.dump_roas("roas.csv") - d.dump_conf("myrpki.conf") + d.dump_conf("rpki.conf") d.dump_rsyncd("rsyncd.conf") if False: d.dump_children("children.csv") @@ -640,7 +640,7 @@ try: "-signkey", "bpki/servers/ca.key", "-in", "bpki/servers/ca.req", "-out", "publication/root.cer", - "-extfile", "myrpki.conf", + "-extfile", "rpki.conf", "-extensions", "rootd_x509_extensions") |