summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgy Frolov <gosha@fro.lv>2021-01-18 20:54:40 +0300
committerGitHub <noreply@github.com>2021-01-18 20:54:40 +0300
commitbb5b52989943297e91954b0fa0b83727c68ad2a4 (patch)
treef3c1de216438ddfa850d87273c33c17d80a709e2
parentb7beaae422f6c40ecf1bad2d9f33b34c38ad7432 (diff)
parent2b10c8f15b01acd4fb1802ac03141ff9644cbd0f (diff)
Merge pull request #945 from dbcli/RW/unreached-exception
make FileNotFound exception reachable
-rw-r--r--changelog.md8
-rwxr-xr-xmycli/main.py6
2 files changed, 9 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md
index 3df6b86..c80c859 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
-TODO
-===
+TBD
+=======
+
+Bug Fixes:
+----------
+* Allow `FileNotFound` exception for SSH config files.
Features:
---------
diff --git a/mycli/main.py b/mycli/main.py
index 210e3d9..4069ebe 100755
--- a/mycli/main.py
+++ b/mycli/main.py
@@ -1350,6 +1350,9 @@ def read_ssh_config(ssh_config_path):
try:
with open(ssh_config_path) as f:
ssh_config.parse(f)
+ except FileNotFoundError as e:
+ click.secho(str(e), err=True, fg='red')
+ sys.exit(1)
# Paramiko prior to version 2.7 raises Exception on parse errors.
# In 2.7 it has become paramiko.ssh_exception.SSHException,
# but let's catch everything for compatibility
@@ -1359,9 +1362,6 @@ def read_ssh_config(ssh_config_path):
err=True, fg='red'
)
sys.exit(1)
- except FileNotFoundError as e:
- click.secho(str(e), err=True, fg='red')
- sys.exit(1)
else:
return ssh_config