|
|
|
@ -5,6 +5,8 @@ from ssh_config_utils.parser import parse_config_text |
|
|
|
|
|
|
|
|
|
|
|
class HostGroup: |
|
|
|
SEPARATOR = "/" |
|
|
|
|
|
|
|
def __init__(self, name): |
|
|
|
self.parent = None |
|
|
|
self.name = name |
|
|
|
@ -24,7 +26,7 @@ class HostGroup: |
|
|
|
def fullpath(self): |
|
|
|
if self.parent is None: |
|
|
|
return "" |
|
|
|
return ".".join(self.parent.fullpath(), self.name) |
|
|
|
return HostGroup.SEPARATOR.join(self.parent.fullpath(), self.name) |
|
|
|
|
|
|
|
def hosts(self): |
|
|
|
for child in self.children.values(): |
|
|
|
@ -106,7 +108,7 @@ class GroupedConfigFile(ConfigFile): |
|
|
|
host: Host |
|
|
|
for host in hosts: |
|
|
|
current = self.root_group |
|
|
|
parts = host.name.split(".") |
|
|
|
parts = host.name.split(HostGroup.SEPARATOR) |
|
|
|
host.name = parts[-1] |
|
|
|
for path in parts[:-1]: |
|
|
|
current = current.add_child_group(path) |
|
|
|
|