Merge branch 'develop' into coretk-fix

This commit is contained in:
Huy Pham 2020-01-20 09:12:17 -08:00
commit 8bcacf0a04
8 changed files with 15 additions and 11 deletions

View file

@ -54,7 +54,7 @@ class DistributedServer:
user's home directory user's home directory
:param wait: True to wait for status, False to background process :param wait: True to wait for status, False to background process
:return: stdout when success :return: stdout when success
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
replace_env = env is not None replace_env = env is not None

View file

@ -181,7 +181,7 @@ class Session:
:param _class: node class to get a node type for :param _class: node class to get a node type for
:return: node type :return: node type
:raises CoreError: when node type does not exist :raises CoreError: when node type does not exist
""" """
node_type = NODES_TYPE.get(_class) node_type = NODES_TYPE.get(_class)
if node_type is None: if node_type is None:
@ -749,7 +749,7 @@ class Session:
:param node_id: id of node to update :param node_id: id of node to update
:param options: data to update node with :param options: data to update node with
:return: True if node updated, False otherwise :return: True if node updated, False otherwise
:raises core.CoreError: when node to update does not exist :raises core.CoreError: when node to update does not exist
""" """
# get node to update # get node to update
node = self.get_node(node_id) node = self.get_node(node_id)
@ -1362,7 +1362,7 @@ class Session:
:param _id: node id to retrieve :param _id: node id to retrieve
:return: node for the given id :return: node for the given id
:raises core.CoreError: when node does not exist :raises core.CoreError: when node does not exist
""" """
if _id not in self.nodes: if _id not in self.nodes:
raise CoreError(f"unknown node id {_id}") raise CoreError(f"unknown node id {_id}")

View file

@ -108,7 +108,7 @@ class NodeBase:
:param wait: True to wait for status, False otherwise :param wait: True to wait for status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
if self.server is None: if self.server is None:
return utils.cmd(args, env, cwd, wait, shell) return utils.cmd(args, env, cwd, wait, shell)
@ -410,7 +410,7 @@ class CoreNodeBase(NodeBase):
:param wait: True to wait for status, False otherwise :param wait: True to wait for status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
raise NotImplementedError raise NotImplementedError
@ -591,7 +591,7 @@ class CoreNode(CoreNodeBase):
:param wait: True to wait for status, False otherwise :param wait: True to wait for status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
if self.server is None: if self.server is None:
return self.client.check_cmd(args, wait=wait, shell=shell) return self.client.check_cmd(args, wait=wait, shell=shell)

View file

@ -60,7 +60,7 @@ class VnodeClient:
:param wait: True to wait for command status, False otherwise :param wait: True to wait for command status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises core.CoreCommandError: when there is a non-zero exit status :raises core.CoreCommandError: when there is a non-zero exit status
""" """
self._verify_connection() self._verify_connection()
args = self.create_cmd(args) args = self.create_cmd(args)

View file

@ -80,7 +80,7 @@ class CoreInterface:
:param wait: True to wait for status, False otherwise :param wait: True to wait for status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
if self.server is None: if self.server is None:
return utils.cmd(args, env, cwd, wait, shell) return utils.cmd(args, env, cwd, wait, shell)

View file

@ -309,7 +309,7 @@ class CoreNetwork(CoreNetworkBase):
:param wait: True to wait for status, False otherwise :param wait: True to wait for status, False otherwise
:param shell: True to use shell, False otherwise :param shell: True to use shell, False otherwise
:return: combined stdout and stderr :return: combined stdout and stderr
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
logging.debug("network node(%s) cmd", self.name) logging.debug("network node(%s) cmd", self.name)
output = utils.cmd(args, env, cwd, wait, shell) output = utils.cmd(args, env, cwd, wait, shell)

View file

@ -373,7 +373,7 @@ class Rj45Node(CoreNodeBase, CoreInterface):
:param ifindex: interface index :param ifindex: interface index
:param ifname: interface name :param ifname: interface name
:return: interface index :return: interface index
:raises ValueError: when an interface has already been created, one max :raises ValueError: when an interface has already been created, one max
""" """
with self.lock: with self.lock:
if ifindex is None: if ifindex is None:

View file

@ -762,7 +762,9 @@ class CoreXmlReader:
node_id = get_int(device_element, "id") node_id = get_int(device_element, "id")
name = device_element.get("name") name = device_element.get("name")
model = device_element.get("type") model = device_element.get("type")
icon = device_element.get("icon")
options = NodeOptions(name, model) options = NodeOptions(name, model)
options.icon = icon
service_elements = device_element.find("services") service_elements = device_element.find("services")
if service_elements is not None: if service_elements is not None:
@ -788,7 +790,9 @@ class CoreXmlReader:
node_id = get_int(network_element, "id") node_id = get_int(network_element, "id")
name = network_element.get("name") name = network_element.get("name")
node_type = NodeTypes[network_element.get("type")] node_type = NodeTypes[network_element.get("type")]
icon = network_element.get("icon")
options = NodeOptions(name) options = NodeOptions(name)
options.icon = icon
position_element = network_element.find("position") position_element = network_element.find("position")
if position_element is not None: if position_element is not None: