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()}
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()}
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()}
def index(): assert_node(is_node) return bottle.static_file('index.html', root=STATIC_DIR)
def server_static(filepath): assert_node(is_node) return bottle.static_file(filepath, root=STATIC_DIR)
def get_favicon(): assert_node(is_node) return server_static('/img/favicon.ico')