Ejemplo n.º 1
0
def node_info():  #, device):
    try:
        assert_node(is_node)
        host = bottle.request.get_header('host')
        return {'ip': "http://{}".format(host), 'status': "NA", "id": "node"}

    except Exception as e:
        logging.error(e)
        return {'error': traceback.format_exc()}
Ejemplo n.º 2
0
def scan_subnet():
    try:
        assert_node(is_node)
        devices_map = generate_new_device_map()
        return devices_map

    except Exception as e:
        logging.error("Unexpected exception when scanning for devices:")
        logging.error(traceback.format_exc())
        return {'error': traceback.format_exc()}
Ejemplo n.º 3
0
def bare(action):
    try:
        assert_node(is_node)
        if action == 'update':
            #out format looks like  {branch:up_to_date}. e.g. out["dev"]=True
            out = bare_repo_updater.update_all_visible_branches()
            return out
        elif action == 'discover_branches':
            out = bare_repo_updater.discover_branches()
            return out
        else:
            raise UnexpectedAction()

    except Exception as e:
        logging.error(traceback.format_exc())
        return {'error': traceback.format_exc()}
Ejemplo n.º 4
0
def index():
    assert_node(is_node)
    return bottle.static_file('index.html', root=STATIC_DIR)
Ejemplo n.º 5
0
def server_static(filepath):
    assert_node(is_node)
    return bottle.static_file(filepath, root=STATIC_DIR)
Ejemplo n.º 6
0
def get_favicon():
    assert_node(is_node)
    return server_static('/img/favicon.ico')