diff options
-rwxr-xr-x | host-control | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/host-control b/host-control index 4fb6014..f337bf1 100755 --- a/host-control +++ b/host-control @@ -7,9 +7,11 @@ import socket import subprocess import yaml -data_path_base = ".config/host-control.yaml" +config_base = ".config/host-control" +config_path = os.path.join(config_base, "host-control.yaml") class host_control(): + hosts = [ ] host = None verbose = False interactive = True @@ -483,7 +485,7 @@ class host_control(): user = os.environ["USER"] data_path_user = os.path.expanduser("~" + user) - data_path = os.path.join(data_path_user, data_path_base) + data_path = os.path.join(data_path_user, config_path) s = open(data_path, "r") y = yaml.load(s, Loader = yaml.SafeLoader) @@ -491,7 +493,20 @@ class host_control(): self.hostname = socket.gethostname() self.config = y["config"] - self.hosts = y["hosts"] + + self.hosts = [ ] + + for host in y["hosts"]: + if "path" in host: + data_path = os.path.join(data_path_user, config_base) + data_path = os.path.join(data_path, host["path"]) + s = open(data_path, "r") + y = yaml.load(s, Loader = yaml.SafeLoader) + s.close() + + self.hosts.append(y) + else: + self.hosts.append(host) def main(self): action = None |