From 2a148d44a1ac74cb34f206919e12ba7b84261ffd Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sat, 21 Jan 2023 17:00:22 -0800 Subject: [PATCH] add host to objects --- jc/parsers/ssh_conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jc/parsers/ssh_conf.py b/jc/parsers/ssh_conf.py index b9fc71ce..80b5c727 100644 --- a/jc/parsers/ssh_conf.py +++ b/jc/parsers/ssh_conf.py @@ -87,7 +87,9 @@ def parse( if jc.utils.has_data(data): myconfig = sshconfig.from_text(data) - hostnames = myconfig.get_hostnames() + hostnames = sorted(myconfig.get_hostnames()) raw_output = [myconfig.lookup(x) for x in hostnames] + for host, obj in zip(hostnames, raw_output.copy()): + obj.update({'host': host}) return raw_output if raw else _process(raw_output)