Exemplo n.º 1
0
 def __init__(self, argv=sys.argv):
     Daemon.__init__(self, pidfile="/var/run/xbeinstd.pid",
                     umask=0007, name="xbeinstd", user="******", group="root")
     p = self.parser
     p.add_option("-H", "--host", dest="server", type="string",
                  help="the server uri (stomp://host[:port]/queue)",
                  default=os.environ.get("XBE_SERVER"))
     p.add_option("-D", "--no-daemonize", dest="daemonize", action="store_false",
                   help="do not daemonize",
                  default=True)
     p.add_option("-S", "--schema-dir", dest="schema_dir", type="string",
                  help="path to a directory that contains schema documents",
                  default="/root/xenbee/etc/xml/schema")
     p.add_option("-l", "--logfile", dest="logfile", type="string",
                  help="the logfile to use",
                  default="/var/log/xenbee/xbeinstd.log")
     p.add_option("--pidfile", dest="pidfile", type="string",
                  help="the pidfile to use",
                  default="/var/run/xbeinstd.pid")
     p.add_option("-u", "--uuid", dest="uuid", type="string",
                  help="the uuid to use",
                  default=os.environ.get("XBE_UUID"))
     p.add_option("-U", "--user", dest="user", type="string",
                  help="the user to switch to",
                  default=os.getuid())
     p.add_option("-G", "--group", dest="group", type="string",
                  help="the group to switch to",
                  default=os.getgid())
     p.add_option("-T", "--timeout", dest="timeout", type="int",
                  help="the maximum timeout to wait for a connection in seconds",
                  default=5)
Exemplo n.º 2
0
    def __init__(self, argv=sys.argv):
	"""Initializes the Daemon."""
        Daemon.__init__(self, pidfile="/var/run/xbebroker.pid", umask=0007, name="xbebroker", user="******", group="root")
        self.server_queue = "xenbee.daemon.1"
        
        p = self.parser
        p.add_option(
            "-c", "--config", dest="config", type="string",
            help="config file to use, default: %default")
        p.add_option(
            "-u", "--uri", dest="uri", type="string",
            help="the uri through which I'am reachable")
        p.add_option(
            "--server", dest="server", type="string",
            help="the server to connect to")
        p.add_option(
            "-U", "--user-database", dest="user_db", type="string",
            help="list CNs that are allowed to use this server")
        p.add_option(
            "--pidfile", dest="pidfile", type="string",
            help="the pidfile to use")
        p.add_option(
            "-S", "--schema-dir", dest="schema_dir", type="string",
            help="path to a directory where schema definitions can be found.")
        p.add_option(
            "-l", "--logfile", dest="log_file", type="string",
            help="the logfile to use")
        p.add_option(
            "-L", "--logconf", dest="log_conf", type="string",
            help="configuration file for the logging module")
        p.add_option(
            "-D", "--no-daemonize", dest="daemonize", action="store_false",
            default=True,
            help="do not daemonize")
        p.add_option(
            "--key", dest="p_key", type="string",
            help="path to the private key")
        p.add_option(
            "--x509", dest="x509", type="string",
            help="path to the x509 certificate")
        p.add_option(
            "--ca-cert", dest="ca_cert", type="string",
            help="path to the CA x509 certificate")

        p.add_option(
            "--stomp-user", dest="stomp_user", type="string",
            help="username for the stomp connection")
        p.add_option(
            "--stomp-pass", dest="stomp_pass", type="string",
            help="password for the stomp connection")

        p.add_option(
            "--bid-timeout", dest="bid_timeout", type="int",
            help="Timeout for waiting for Auction BIDs")

        try:
            import optcomplete
        except ImportError:
            # no optcompletion available
            pass
        else:
            optcomplete.autocomplete(p)