Parser: makes keys case-insensitive
This commit is contained in:
parent
5b9fc5033c
commit
299f1db167
11 changed files with 98 additions and 98 deletions
12
src/main.py
12
src/main.py
|
@ -45,7 +45,7 @@ def expand_for_loop(props):
|
|||
expanded_props = dict()
|
||||
|
||||
for loop in props.get("for", []):
|
||||
prop = loop["property"]
|
||||
prop = loop["property"].lower()
|
||||
|
||||
if expanded_props.get(prop) is None:
|
||||
expanded_props[prop] = list()
|
||||
|
@ -74,8 +74,8 @@ def parse_props(host, props, hosts):
|
|||
parsed = dict()
|
||||
|
||||
# Standard ssh properties
|
||||
for k, v in props.get("ssh_props", {}).items():
|
||||
parsed[k] = v if isinstance(v, list) else [v]
|
||||
for prop, v in props.get("ssh_props", {}).items():
|
||||
parsed[prop.lower()] = v if isinstance(v, list) else [v]
|
||||
|
||||
# For-loops in config
|
||||
for prop, values in expand_for_loop(props).items():
|
||||
|
@ -92,9 +92,9 @@ def parse_props(host, props, hosts):
|
|||
f"Template `{template}` required by `{host}` is not declared above `{host}` in the yaml"
|
||||
)
|
||||
elif template:
|
||||
for k, v in hosts[props.get("template")].items():
|
||||
if k not in parsed:
|
||||
parsed[k] = v
|
||||
for prop, v in hosts[props.get("template")].items():
|
||||
if prop not in parsed:
|
||||
parsed[prop] = v
|
||||
|
||||
return parsed
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
Host ohaton
|
||||
ForwardX11 no
|
||||
Hostname ohaton.cs.ualberta.ca
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
Port 22
|
||||
User emiliko
|
||||
forwardx11 no
|
||||
hostname ohaton.cs.ualberta.ca
|
||||
identitiesonly yes
|
||||
identityfile ~/.ssh/id_ed25519
|
||||
port 22
|
||||
user emiliko
|
||||
|
||||
Host coronation
|
||||
ForwardX11 no
|
||||
Hostname coronation.cs.ualberta.ca
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
Port 22
|
||||
User emiliko
|
||||
forwardx11 no
|
||||
hostname coronation.cs.ualberta.ca
|
||||
identitiesonly yes
|
||||
identityfile ~/.ssh/id_ed25519
|
||||
port 22
|
||||
user emiliko
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Host orca
|
||||
Hostname 10.42.43.1
|
||||
SendEnv BAR=foo
|
||||
SendEnv FOO=bar
|
||||
User emiliko
|
||||
hostname 10.42.43.1
|
||||
sendenv BAR=foo
|
||||
sendenv FOO=bar
|
||||
user emiliko
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
Host orca
|
||||
Hostname 10.42.43.1
|
||||
LocalForward 9026 localhost:9026
|
||||
LocalForward 9027 localhost:9027
|
||||
LocalForward 9028 localhost:9028
|
||||
LocalForward 9029 localhost:9029
|
||||
LocalForward 9030 localhost:9030
|
||||
LocalForward 9031 localhost:9031
|
||||
LocalForward 9032 localhost:9032
|
||||
LocalForward 9033 localhost:9033
|
||||
LocalForward 9034 localhost:9034
|
||||
LocalForward 9035 localhost:9035
|
||||
LocalForward 9036 localhost:9036
|
||||
LocalForward 9037 localhost:9037
|
||||
LocalForward 9038 localhost:9038
|
||||
LocalForward 9039 localhost:9039
|
||||
LocalForward 9040 localhost:9040
|
||||
LocalForward 9041 localhost:9041
|
||||
User emiliko
|
||||
hostname 10.42.43.1
|
||||
localforward 9026 localhost:9026
|
||||
localforward 9027 localhost:9027
|
||||
localforward 9028 localhost:9028
|
||||
localforward 9029 localhost:9029
|
||||
localforward 9030 localhost:9030
|
||||
localforward 9031 localhost:9031
|
||||
localforward 9032 localhost:9032
|
||||
localforward 9033 localhost:9033
|
||||
localforward 9034 localhost:9034
|
||||
localforward 9035 localhost:9035
|
||||
localforward 9036 localhost:9036
|
||||
localforward 9037 localhost:9037
|
||||
localforward 9038 localhost:9038
|
||||
localforward 9039 localhost:9039
|
||||
localforward 9040 localhost:9040
|
||||
localforward 9041 localhost:9041
|
||||
user emiliko
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
Host orca
|
||||
Hostname 10.42.43.1
|
||||
LocalForward 1026 localhost:1026
|
||||
LocalForward 1251 localhost:1251
|
||||
LocalForward 1476 localhost:1476
|
||||
LocalForward 1701 localhost:1701
|
||||
LocalForward 1926 localhost:1926
|
||||
LocalForward 9026 localhost:9026
|
||||
LocalForward 9028 localhost:9028
|
||||
LocalForward 9030 localhost:9030
|
||||
LocalForward 9032 localhost:9032
|
||||
LocalForward 9034 localhost:9034
|
||||
LocalForward 9036 localhost:9036
|
||||
LocalForward 9038 localhost:9038
|
||||
LocalForward 9040 localhost:9040
|
||||
User emiliko
|
||||
hostname 10.42.43.1
|
||||
localforward 1026 localhost:1026
|
||||
localforward 1251 localhost:1251
|
||||
localforward 1476 localhost:1476
|
||||
localforward 1701 localhost:1701
|
||||
localforward 1926 localhost:1926
|
||||
localforward 9026 localhost:9026
|
||||
localforward 9028 localhost:9028
|
||||
localforward 9030 localhost:9030
|
||||
localforward 9032 localhost:9032
|
||||
localforward 9034 localhost:9034
|
||||
localforward 9036 localhost:9036
|
||||
localforward 9038 localhost:9038
|
||||
localforward 9040 localhost:9040
|
||||
user emiliko
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
Host orca
|
||||
Hostname 10.42.43.1
|
||||
LocalForward 1006 localhost:1006
|
||||
LocalForward 1007 localhost:1007
|
||||
LocalForward 1008 localhost:1008
|
||||
LocalForward 1009 localhost:1009
|
||||
LocalForward 1010 localhost:1010
|
||||
LocalForward 1011 localhost:1011
|
||||
LocalForward 1012 localhost:1012
|
||||
LocalForward 1013 localhost:1013
|
||||
LocalForward 1014 localhost:1014
|
||||
LocalForward 1015 localhost:1015
|
||||
LocalForward 1016 localhost:1016
|
||||
LocalForward 1017 localhost:1017
|
||||
LocalForward 1018 localhost:1018
|
||||
LocalForward 1019 localhost:1019
|
||||
SendEnv BAR=foo
|
||||
SendEnv BAZ=baz
|
||||
SendEnv FOO=bar
|
||||
User emiliko
|
||||
hostname 10.42.43.1
|
||||
localforward 1006 localhost:1006
|
||||
localforward 1007 localhost:1007
|
||||
localforward 1008 localhost:1008
|
||||
localforward 1009 localhost:1009
|
||||
localforward 1010 localhost:1010
|
||||
localforward 1011 localhost:1011
|
||||
localforward 1012 localhost:1012
|
||||
localforward 1013 localhost:1013
|
||||
localforward 1014 localhost:1014
|
||||
localforward 1015 localhost:1015
|
||||
localforward 1016 localhost:1016
|
||||
localforward 1017 localhost:1017
|
||||
localforward 1018 localhost:1018
|
||||
localforward 1019 localhost:1019
|
||||
sendenv BAR=foo
|
||||
sendenv BAZ=baz
|
||||
sendenv FOO=bar
|
||||
user emiliko
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Host uni
|
||||
LocalForward 3000 localhost:3000
|
||||
LocalForward 3302 localhost:3302
|
||||
LocalForward 3306 localhost:3306
|
||||
localforward 3000 localhost:3000
|
||||
localforward 3302 localhost:3302
|
||||
localforward 3306 localhost:3306
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Host github.com
|
||||
Hostname github.com
|
||||
IdentityFile ~/.ssh/github_main
|
||||
LocalForward 3000 localhost:3000
|
||||
LocalForward 3302 localhost:3302
|
||||
LocalForward 3306 localhost:3306
|
||||
hostname github.com
|
||||
identityfile ~/.ssh/github_main
|
||||
localforward 3000 localhost:3000
|
||||
localforward 3302 localhost:3302
|
||||
localforward 3306 localhost:3306
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Host ohaton
|
||||
LocalForward 9000 localhost:9000
|
||||
localforward 9000 localhost:9000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Host ohaton
|
||||
LocalForward 3000 localhost:3000
|
||||
LocalForward 3302 localhost:3302
|
||||
LocalForward 3306 localhost:3306
|
||||
localforward 3000 localhost:3000
|
||||
localforward 3302 localhost:3302
|
||||
localforward 3306 localhost:3306
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
Host ohaton
|
||||
ForwardX11 no
|
||||
Hostname ohaton.cs.ualberta.ca
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
Port 22
|
||||
User emiliko
|
||||
forwardx11 no
|
||||
hostname ohaton.cs.ualberta.ca
|
||||
identitiesonly yes
|
||||
identityfile ~/.ssh/id_ed25519
|
||||
port 22
|
||||
user emiliko
|
||||
|
||||
Host coronation
|
||||
ForwardX11 no
|
||||
Hostname coronation.cs.ualberta.ca
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
Port 22
|
||||
User emiliko
|
||||
forwardx11 no
|
||||
hostname coronation.cs.ualberta.ca
|
||||
identitiesonly yes
|
||||
identityfile ~/.ssh/id_ed25519
|
||||
port 22
|
||||
user emiliko
|
||||
|
|
Loading…
Reference in a new issue