|
|
@ -4,6 +4,25 @@ from ssh_config_utils.host import GlobalHost, Host |
|
|
from ssh_config_utils.parser import parse_config_text |
|
|
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: |
|
|
class ConfigFile: |
|
|
def __init__(self, global_host, hosts): |
|
|
def __init__(self, global_host, hosts): |
|
|
self.hosts = {} |
|
|
self.hosts = {} |
|
|
|