コード例 #1
0
                          default="192.169.123.0",
                          help="the ip of the router in your setup")
        parser.add_option("-s",
                          "--safe",
                          dest="safe",
                          default=False,
                          help="Set Safe mode ON",
                          action="store_true")
        parser.add_option(
            "-l",
            "--local",
            dest="local",
            default=False,
            help=
            "Run on localhost (run a node and device on the same machine, for development)",
            action="store_true")
        (options, args) = parser.parse_args()
        option_dict = vars(options)

        local_ip = get_local_ip(option_dict["subnet_ip"],
                                localhost=option_dict["local"])

        (options, args) = parser.parse_args()
        option_dict = vars(options)

        gbw = GenericBackupWrapper(backup_job, option_dict["results_dir"],
                                   option_dict["safe"], local_ip)
        gbw.run()
    except Exception as e:
        logging.error(traceback.format_exc(e))
コード例 #2
0
    logging.getLogger().setLevel(logging.INFO)
    parser = optparse.OptionParser()
    parser.add_option("-D", "--debug", dest="debug", default=False,help="Set DEBUG mode ON", action="store_true")
    parser.add_option("-p", "--port", dest="port", default=80,help="port")
    parser.add_option("-l", "--local", dest="local", default=False, help="Run on localhost (run a node and device on the same machine, for development)", action="store_true")
    parser.add_option("-e", "--results-dir", dest="results_dir", default="/ethoscope_results",help="Where temporary result files are stored")
    parser.add_option("-r", "--subnet-ip", dest="subnet_ip", default="192.168.123.254", help="the ip of the router in your setup")

    (options, args) = parser.parse_args()

    option_dict = vars(options)
    PORT = option_dict["port"]
    DEBUG = option_dict["debug"]
    RESULTS_DIR = option_dict["results_dir"]
    max_address = 255 if DEBUG else 5
    LOCAL_IP = get_local_ip(option_dict["subnet_ip"], max_node_subnet_address=max_address, localhost=option_dict["local"])
    try:
        WWW_IP = get_internet_ip()
    except Exception as e:
        logging.warning("Could not access internet!")
        logging.warning(traceback.format_exc(e))
        WWW_IP = None

    tmp_imgs_dir = tempfile.mkdtemp(prefix="ethoscope_node_imgs")
    device_scanner = None
    try:
        device_scanner = DeviceScanner(LOCAL_IP, results_dir=RESULTS_DIR)
        device_scanner.start()
        #######TO be remove when bottle changes to version 0.13
        server = "cherrypy"
        try: