예제 #1
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     network_manager = NetworkManager()
     json_data['network_data'] = network_manager.get_node_networks(
         instance.id
     )
     return json_data
예제 #2
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     json_data["ip_ranges"] = [[ir.first, ir.last]
                               for ir in instance.ip_ranges]
     json_data.setdefault("netmask", "")
     json_data.setdefault("gateway", "")
     return json_data
예제 #3
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     json_data["ip_ranges"] = [
         [ir.first, ir.last] for ir in instance.ip_ranges
     ]
     json_data.setdefault("netmask", "")
     json_data.setdefault("gateway", "")
     return json_data
예제 #4
0
파일: node.py 프로젝트: rsokolkov/fuel-web
 def render(cls, instance, fields=None):
     json_data = None
     try:
         json_data = JSONHandler.render(instance, fields=cls.fields)
         network_manager = NetworkManager()
         json_data["network_data"] = network_manager.get_node_networks(instance.id)
     except Exception:
         logger.error(traceback.format_exc())
     return json_data
예제 #5
0
파일: node.py 프로젝트: e0ne/fuel-web
 def render(cls, instance, fields=None):
     json_data = None
     try:
         json_data = JSONHandler.render(instance, fields=cls.fields)
         json_data['network_data'] = NetworkManager.get_node_networks(
             instance.id)
     except Exception:
         logger.error(traceback.format_exc())
     return json_data
예제 #6
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     if instance.changes:
         for i in instance.changes:
             if not i.node_id:
                 json_data.setdefault("changes", []).append(i.name)
             else:
                 json_data.setdefault("changes", []).append([i.name, i.node_id])
     else:
         json_data["changes"] = []
     return json_data
예제 #7
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     if instance.changes:
         for i in instance.changes:
             if not i.node_id:
                 json_data.setdefault("changes", []).append(i.name)
             else:
                 json_data.setdefault("changes", []).append(
                     [i.name, i.node_id, i.node.name])
     else:
         json_data["changes"] = []
     return json_data
예제 #8
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     json_data["time"] = ":".join([
         instance.datetime.strftime("%H"),
         instance.datetime.strftime("%M"),
         instance.datetime.strftime("%S")
     ])
     json_data["date"] = "-".join([
         instance.datetime.strftime("%d"),
         instance.datetime.strftime("%m"),
         instance.datetime.strftime("%Y")
     ])
     return json_data
예제 #9
0
 def render(cls, instance, fields=None):
     json_data = JSONHandler.render(instance, fields=cls.fields)
     json_data["time"] = ":".join([
         instance.datetime.strftime("%H"),
         instance.datetime.strftime("%M"),
         instance.datetime.strftime("%S")
     ])
     json_data["date"] = "-".join([
         instance.datetime.strftime("%d"),
         instance.datetime.strftime("%m"),
         instance.datetime.strftime("%Y")
     ])
     return json_data
예제 #10
0
파일: node.py 프로젝트: rsokolkov/fuel-web
    def render(cls, nodes, fields=None):
        json_list = []
        network_manager = NetworkManager()
        ips_mapped = network_manager.get_grouped_ips_by_node()
        networks_grouped = network_manager.get_networks_grouped_by_cluster()
        for node in nodes:
            try:
                json_data = JSONHandler.render(node, fields=cls.fields)

                json_data["network_data"] = network_manager.get_node_networks_optimized(
                    node, ips_mapped.get(node.id, []), networks_grouped.get(node.cluster_id, [])
                )
                json_list.append(json_data)
            except Exception:
                logger.error(traceback.format_exc())
        return json_list
예제 #11
0
파일: node.py 프로젝트: e0ne/fuel-web
    def render(cls, nodes, fields=None):
        json_list = []
        network_manager = NetworkManager
        ips_mapped = network_manager.get_grouped_ips_by_node()
        networks_grouped = network_manager.get_networks_grouped_by_cluster()
        for node in nodes:
            try:
                json_data = JSONHandler.render(node, fields=cls.fields)

                json_data['network_data'] = network_manager.\
                    get_node_networks_optimized(
                        node, ips_mapped.get(node.id, []),
                        networks_grouped.get(node.cluster_id, []))
                json_list.append(json_data)
            except Exception:
                logger.error(traceback.format_exc())
        return json_list