Changeset 206 for trunk/src


Ignore:
Timestamp:
12/18/12 12:53:42 (11 years ago)
Author:
bas
Message:

added a new option to skip hostname lookup failures

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/pxeconfig.py

    r203 r206  
    7474START        = 'start'
    7575END          = 'end'
    76 VERSION      = '3.1.0'
     76VERSION      = '4.2.0'
    7777
    7878def select_pxe_configfile():
     
    233233        SCRIPT_HOOK_ADD = False,
    234234        SCRIPT_HOOK_REMOVE = False,
     235        SKIP_HOSTNAME_ERRORS = False,
    235236    )
    236237
     
    263264        dest   = 'VERBOSE',
    264265        help   = 'Make the program more verbose (default: False)'
     266    )
     267
     268    p.add_option('-H', '--skip-hostname-lookup-error',
     269        action = 'store_true',
     270        dest   = 'SKIP_HOSTNAME_LOOKUP_ERROR',
     271        help   = 'When hostname lookup fails, skip it (default: False)'
    265272    )
    266273
     
    309316
    310317
     318    if not options.SKIP_HOSTNAME_LOOKUP_ERROR:
     319        try:
     320            options.SKIP_HOSTNAME_LOOKUP_ERROR = defaults['skip_hostname_lookup_error']
     321        except KeyError, detail:
     322            pass
     323
    311324    ## This will be obsoleted by client_script_hook_add
    312325    #
     
    343356            mac_2_hex(host, options)
    344357        else:
    345             host_2_hex(host, options)
     358            try:
     359                host_2_hex(host, options)
     360            except PxeConfig, detail:
     361
     362                if options.SKIP_HOSTNAME_LOOKUP_ERROR:
     363                    print 'Skipping Hostname lookup failed for: %s' %(host)
     364                    continue
     365                else:
     366                    print detail
     367                    sys.exit(1)
    346368
    347369def main():
  • trunk/src/pxeconfigd.py

    r196 r206  
    2626        config file which tells how the node must boot. This daemon
    2727        enables a client to remove his/here pxe config file. With the
    28         next boot it will use the default one.
    29 
    30         command line option:
    31           -V/--version
    32             Prints the version number and exits
     28        next boot it will use the default one.
     29
     30        command line option:
     31          -V/--version
     32            Prints the version number and exits
    3333         
    3434        Note:
    35           This server can ONLY be started from inetd.
     35          This server can ONLY be started from inetd/xinetd.
    3636"""
    3737import time
     
    5959
    6060PXE_CONF_DIR = '/tftpboot/pxelinux.cfg'
    61 VERSION = '3.1.0'
     61VERSION = '4.2.0'
    6262
    6363# Give the current time
Note: See TracChangeset for help on using the changeset viewer.