summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-13 18:07:23 +0200
committerChristian Poessinger <christian@poessinger.com>2019-10-13 18:08:22 +0200
commit64163806044bed98fcb68b46340e767deb0c8acc (patch)
treeab75eb23ebcfbb0eb15990e04a5f13aaabdd8ea8
parentfe7279454c86a2947b23fb0d769483b7fe2a3cc3 (diff)
downloadvyos-1x-64163806044bed98fcb68b46340e767deb0c8acc.tar.gz
vyos-1x-64163806044bed98fcb68b46340e767deb0c8acc.zip
ssh.py: check if file exists before deleting it
-rwxr-xr-xsrc/conf_mode/ssh.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/conf_mode/ssh.py b/src/conf_mode/ssh.py
index 2a5cba99a..e3b11b537 100755
--- a/src/conf_mode/ssh.py
+++ b/src/conf_mode/ssh.py
@@ -267,7 +267,8 @@ def apply(ssh):
else:
# SSH access is removed in the commit
os.system("sudo systemctl stop ssh.service")
- os.unlink(config_file)
+ if os.path.isfile(config_file):
+ os.unlink(config_file)
return None