Changeset 585
- Timestamp:
- 03/27/08 21:50:38 (10 months ago)
- Files:
-
- ChangeLog (modified) (1 diff)
- buildbot/scripts/checkconfig.py (added)
- buildbot/scripts/runner.py (modified) (4 diffs)
- docs/buildbot.texinfo (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ChangeLog
r584 r585 1 2008-03-27 Brian Warner <warner@lothar.com> 2 3 * buildbot/scripts/runner.py (doCheckConfig): patch from Ben 4 Hearsum to implement 'buildbot checkconfig': validate that your 5 master.cfg is good without actually touching the buildmaster. 6 Closes #37. Thanks! 7 * buildbot/scripts/checkconfig.py: same 8 * docs/buildbot.texinfo (Testing the Config File): document it 9 1 10 2008-03-22 Brian Warner <warner@lothar.com> 2 11 buildbot/scripts/runner.py
r471 r585 4 4 # subcommands want to load modules that need the gtk reactor. 5 5 import os, sys, stat, re, time 6 import traceback 6 7 from twisted.python import usage, util, runtime 7 8 … … 810 811 811 812 813 class CheckConfigOptions(usage.Options): 814 optFlags = [ 815 ['quiet', 'q', "Don't display error messages or tracebacks"], 816 ] 817 818 def getSynopsis(self): 819 return "Usage :buildbot checkconfig [configFile]\n" + \ 820 " If not specified, 'master.cfg' will be used as 'configFile'" 821 822 def parseArgs(self, *args): 823 if len(args) >= 1: 824 self['configFile'] = args[0] 825 else: 826 self['configFile'] = 'master.cfg' 827 828 829 def doCheckConfig(config): 830 quiet = config.get('quiet') 831 configFile = config.get('configFile') 832 try: 833 from buildbot.scripts.checkconfig import ConfigLoader 834 ConfigLoader(configFile) 835 except: 836 if not quiet: 837 # Print out the traceback in a nice format 838 t, v, tb = sys.exc_info() 839 traceback.print_exception(t, v, tb) 840 sys.exit(1) 841 842 if not quiet: 843 print "Config file is good!" 844 845 812 846 class Options(usage.Options): 813 847 synopsis = "Usage: buildbot <command> [command options]" … … 847 881 ['tryserver', None, TryServerOptions, 848 882 "buildmaster-side 'try' support function, not for users"], 883 884 ['checkconfig', None, CheckConfigOptions, 885 "test the validity of a master.cfg config file"], 849 886 850 887 # TODO: 'watch' … … 907 944 elif command == "tryserver": 908 945 doTryServer(so) 909 910 946 elif command == "checkconfig": 947 doCheckConfig(so) 948 949 docs/buildbot.texinfo
r580 r585 129 129 * Config File Format:: 130 130 * Loading the Config File:: 131 * Testing the Config File:: 131 132 * Defining the Project:: 132 133 * Listing Change Sources and Schedulers:: … … 1923 1924 * Config File Format:: 1924 1925 * Loading the Config File:: 1926 * Testing the Config File:: 1925 1927 * Defining the Project:: 1926 1928 * Listing Change Sources and Schedulers:: … … 1995 1997 1996 1998 1997 @node Loading the Config File, Defining the Project, Config File Format, Configuration1999 @node Loading the Config File, Testing the Config File, Config File Format, Configuration 1998 2000 @section Loading the Config File 1999 2001 … … 2029 2031 which get queued after the reconfig) will use the new process. 2030 2032 2031 @node Defining the Project, Listing Change Sources and Schedulers, Loading the Config File, Configuration 2033 @node Testing the Config File, Defining the Project, Loading the Config File, Configuration 2034 @section Testing the Config File 2035 2036 To verify that the config file is well-formed and contains no 2037 deprecated or invalid elements, use the ``checkconfig'' command: 2038 2039 @example 2040 % buildbot checkconfig master.cfg 2041 Config file is good! 2042 @end example 2043 2044 If the config file has deprecated features (perhaps because you've 2045 upgraded the buildmaster and need to update the config file to match), 2046 they will be announced by checkconfig. In this case, the config file 2047 will work, but you should really remove the deprecated items and use 2048 the recommended replacements instead: 2049 2050 @example 2051 % buildbot checkconfig master.cfg 2052 /usr/lib/python2.4/site-packages/buildbot/master.py:559: DeprecationWarning: c['sources'] is deprecated as of 0.7.6 and will be removed by 0.8.0 . Please use c['change_source'] instead. 2053 warnings.warn(m, DeprecationWarning) 2054 Config file is good! 2055 @end example 2056 2057 If the config file is simply broken, that will be caught too: 2058 2059 @example 2060 % buildbot checkconfig master.cfg 2061 Traceback (most recent call last): 2062 File "/usr/lib/python2.4/site-packages/buildbot/scripts/runner.py", line 834, in doCheckConfig 2063 ConfigLoader(configFile) 2064 File "/usr/lib/python2.4/site-packages/buildbot/scripts/checkconfig.py", line 31, in __init__ 2065 self.loadConfig(configFile) 2066 File "/usr/lib/python2.4/site-packages/buildbot/master.py", line 480, in loadConfig 2067 exec f in localDict 2068 File "/home/warner/BuildBot/master/foolscap/master.cfg", line 90, in ? 2069 c[bogus] = "stuff" 2070 NameError: name 'bogus' is not defined 2071 @end example 2072 2073 2074 @node Defining the Project, Listing Change Sources and Schedulers, Testing the Config File, Configuration 2032 2075 @section Defining the Project 2033 2076
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)