Revision 0a71aa17 lib/daemon.py

b/lib/daemon.py
245 245
  optionparser.add_option("-d", "--debug", dest="debug",
246 246
                          help="Enable some debug messages",
247 247
                          default=False, action="store_true")
248

  
248 249
  if daemon_name in constants.DAEMONS_PORTS:
249
    # for networked daemons we also allow choosing the bind port and address.
250
    # by default we use the port provided by utils.GetDaemonPort, and bind to
251
    # 0.0.0.0 (which is represented by and empty bind address.
252
    port = utils.GetDaemonPort(daemon_name)
250
    default_bind_address = "0.0.0.0"
251
    default_port = utils.GetDaemonPort(daemon_name)
252

  
253
    # For networked daemons we allow choosing the port and bind address
253 254
    optionparser.add_option("-p", "--port", dest="port",
254
                            help="Network port (%s default)." % port,
255
                            default=port, type="int")
255
                            help="Network port (default: %s)" % default_port,
256
                            default=default_port, type="int")
256 257
    optionparser.add_option("-b", "--bind", dest="bind_address",
257
                            help="Bind address",
258
                            default="", metavar="ADDRESS")
258
                            help=("Bind address (default: %s)" %
259
                                  default_bind_address),
260
                            default=default_bind_address, metavar="ADDRESS")
259 261

  
260 262
  if daemon_name in constants.DAEMONS_SSL:
261 263
    default_cert, default_key = constants.DAEMONS_SSL[daemon_name]

Also available in: Unified diff