def process_action(self, action, node):
     """ Helper function for processing actions, finds out what does each action do and sets the appropriate attributed of the node
     :param obj action The action to be processed.
     :param obj node The node to be changed."""
     if action.isFormat:
         node.add_emoji("Fmt:")
         node.addAttribute("action", "Format")
     else:
         node.add_emoji("Dev:")
         node.addAttribute("action", "Device")
     if action.isDestroy or action.isRemove:
         print("Adding action: Delete for node: " + node.getName())
         node.addAttribute("action", "delete")
         node.change_color(self.pallete.complement["2"])
         node.add_emoji(emoji.emojize(":fire:"))
     if action.isCreate or action.isAdd:
         print("Adding action: Add for node: " + node.getName())
         node.addAttribute("action", "add")
         node.change_color(self.pallete.primary["2"])
         node.add_emoji(emoji.emojize(":building_construction:"))
     if action.isResize or action.isShrink or action.isGrow:
         print("Adding action: Resize for node: " + node.getName())
         node.addAttribute("action", "resize")
         node.change_color(self.pallete.secondary_second["2"])
         node.add_emoji(emoji.emojize(":wrench:"))
 def process_action(self, action, node):
     """ Helper function for processing actions, finds out what does each action do and sets the appropriate attributed of the node
     :param obj action The action to be processed.
     :param obj node The node to be changed."""
     if action.isFormat:
         node.add_emoji("Fmt:")
         node.addAttribute("action", "Format")
     else:
         node.add_emoji("Dev:")
         node.addAttribute("action", "Device")
     if action.isDestroy or action.isRemove:
         print("Adding action: Delete for node: " + node.getName())
         node.addAttribute("action", "delete")
         node.change_color(self.pallete.complement["2"])
         node.add_emoji(emoji.emojize(":fire:"))
     if action.isCreate or action.isAdd:
         print("Adding action: Add for node: " + node.getName())
         node.addAttribute("action", "add")
         node.change_color(self.pallete.primary["2"])
         node.add_emoji(emoji.emojize(":building_construction:"))
     if action.isResize or action.isShrink or action.isGrow:
         print("Adding action: Resize for node: " + node.getName())
         node.addAttribute("action", "resize")
         node.change_color(self.pallete.secondary_second["2"])
         node.add_emoji(emoji.emojize(":wrench:"))
示例#3
0
 def process_node(self, node, device):
     """ Sorts node based on it's type and starts command related to it.
     :param obj node node that should be sorted
     :param obj device the device from which the node originated, used for getting aditional information"""
     print("Adding device, Name: " + device.name + " Type: " + device.type)
     # Adding entries that are present for all nodes
     if (device.encrypted):
         node.add_emoji(emoji.emojize(":lock:"))
     else:
         node.add_emoji(emoji.emojize(":open_lock:"))
     # End of common entries
     if node.getType() == "luks/dm-crypt":
         self.nodeIsLuks(node)
     if node.getType() == "disk":
         self.nodeIsHarddrive(node)
         if (device.format.type == "disklabel"):
             node.addAttribute("format", device.format.labelType)
     if node.getType() == "partition":
         self.nodeIsPartition(node)
     if node.getType() == "lvmlv":
         self.nodeIsLV(node)
         if (device.cached):
             node.addAttribute("cached", "True")
     if node.getType() == "lvmvg":
         self.nodeIsVG(node)
     if node.getType() == "lvmthinpool":
         self.nodeIsLVMThinPool(node)
     if node.getType() == "lvmthinlv":
         self.nodeIsLVMThinLv(node)
         if (device.cached):
             node.addAttribute("cached", "True")
     if node.getType() == "btrfs volume":
         self.nodeIsBTRFS(node)
     if node.getType() == "mdarray":
         self.nodeIsMDRAID(node)
     if node.getType() == "lvmsnapshot":
         self.nodeIsLVMSnapshot(node)
         new_edge = edge.Edge(device.origin.name, node.getName())
         new_edge.addGvAttribute("style", "dashed")
         self.edge_list.append(new_edge)
         node.addAttribute("Snap. origin", device.origin.name)
     self.node_list.append(node)
     for parent in device.parents:
         edge_to_be_added = edge.Edge(parent.name, device.name)
         self.edge_list.append(edge_to_be_added)
 def process_node(self, node, device):
     """ Sorts node based on it's type and starts command related to it.
     :param obj node node that should be sorted
     :param obj device the device from which the node originated, used for getting aditional information"""
     print("Adding device, Name: " + device.name + " Type: " + device.type)
     # Adding entries that are present for all nodes
     if (device.encrypted):
         node.add_emoji(emoji.emojize(":lock:"))
     else:
         node.add_emoji(emoji.emojize(":open_lock:"))
     # End of common entries
     if node.getType() == "luks/dm-crypt":
         self.nodeIsLuks(node)
     if node.getType() == "disk":
         self.nodeIsHarddrive(node)
         if (device.format.type == "disklabel"):
             node.addAttribute("format", device.format.labelType)
     if node.getType() == "partition":
         self.nodeIsPartition(node)
     if node.getType() == "lvmlv":
         self.nodeIsLV(node)
         if (device.cached):
             node.addAttribute("cached", "True")
     if node.getType() == "lvmvg":
         self.nodeIsVG(node)
     if node.getType() == "lvmthinpool":
         self.nodeIsLVMThinPool(node)
     if node.getType() == "lvmthinlv":
         self.nodeIsLVMThinLv(node)
         if (device.cached):
             node.addAttribute("cached", "True")
     if node.getType() == "btrfs volume":
         self.nodeIsBTRFS(node)
     if node.getType() == "mdarray":
         self.nodeIsMDRAID(node) 
     if node.getType() == "lvmsnapshot":
         self.nodeIsLVMSnapshot(node)
         new_edge = edge.Edge(device.origin.name, node.getName())
         new_edge.addGvAttribute("style", "dashed")
         self.edge_list.append(new_edge)
         node.addAttribute("Snap. origin",device.origin.name)
     self.node_list.append(node)
     for parent in device.parents:
         edge_to_be_added = edge.Edge(parent.name, device.name)
         self.edge_list.append(edge_to_be_added)