Skip to content

Commit

Permalink
Fix ordering of entries in windows config from WSL
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice committed Dec 11, 2023
1 parent 59b145b commit 1dac58c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions milatools/cli/init_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
logger = get_logger(__name__)

WINDOWS_UNSUPPORTED_KEYS = ["ControlMaster", "ControlPath", "ControlPersist"]
HOSTS = ["mila", "mila-cpu", "*.server.mila.quebec !*login.server.mila.quebec"]
"""List of host entries that get added to the SSH configuration by `mila init`."""


if sys.platform == "win32":
Expand Down Expand Up @@ -494,13 +492,15 @@ def _copy_valid_ssh_entries_to_windows_ssh_config_file(
unsupported_keys_lowercase = set(k.lower() for k in WINDOWS_UNSUPPORTED_KEYS)

# NOTE: need to preserve the ordering of entries:
for host in HOSTS + [
host for host in linux_ssh_config.hosts() if host not in HOSTS
entries_to_move = list(MILA_ENTRIES.keys()) + list(DRAC_ENTRIES.keys())
for host in entries_to_move + [
host for host in linux_ssh_config.hosts() if host not in entries_to_move
]:
if host not in linux_ssh_config.hosts():
warnings.warn(
RuntimeWarning(
f"Weird, we expected to have a {host!r} entry in the SSH config..."
f"We expected to have a {host!r} entry in the SSH config. "
f"Did you run `mila init`?"
)
)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,27 @@ Host *.server.mila.quebec !*login.server.mila.quebec
ProxyJump mila
User bob
Host !graham gra??? gra????
ProxyJump graham
User bob
Host !beluga bc????? bg????? bl?????
ProxyJump beluga
User bob
Host beluga cedar graham narval niagara
HostName %h.computecanada.ca
User bob
Host !niagara nia????
ProxyJump niagara
Host !beluga bc????? bg????? bl?????
ProxyJump beluga
User bob
Host !cedar cdr? cdr?? cdr??? cdr????
ProxyJump cedar
User bob
Host !graham gra??? gra????
ProxyJump graham
User bob
Host !narval nc????? ng?????
ProxyJump narval
User bob
Host !niagara nia????
ProxyJump niagara
User bob
```

0 comments on commit 1dac58c

Please sign in to comment.