Browse Source

Added HostGroup class

neo
Raphael Roberts 6 years ago
parent
commit
e300de2554
  1. 19
      ssh_config_utils/config_file.py

19
ssh_config_utils/config_file.py

@ -4,6 +4,25 @@ from ssh_config_utils.host import GlobalHost, Host
from ssh_config_utils.parser import parse_config_text
class HostGroup:
def __init__(self, name):
self.parent = None
self.name = name
self.children = []
def add_child_group(self, name):
child = HostGroup(name)
child.parent = self
self.children.append(self)
return child
@property
def fullpath(self):
if self.parent is None:
return ""
return ".".join(self.parent.fullpath(), self.name)
class ConfigFile:
def __init__(self, global_host, hosts):
self.hosts = {}

Loading…
Cancel
Save