From fb14ac15bcb1db14f756e8943f551ba428de4c7f Mon Sep 17 00:00:00 2001 From: Travis Thieman Date: Mon, 14 Sep 2015 10:44:16 -0400 Subject: [PATCH] Create required known_hosts file if it does not exists --- dusty/systems/known_hosts/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dusty/systems/known_hosts/__init__.py b/dusty/systems/known_hosts/__init__.py index e048c943..07976a12 100644 --- a/dusty/systems/known_hosts/__init__.py +++ b/dusty/systems/known_hosts/__init__.py @@ -11,6 +11,8 @@ def _get_known_hosts_path(): def ensure_known_hosts(hosts): known_hosts_path = _get_known_hosts_path() + if not os.path.exists(known_hosts_path): + open(known_hosts_path, 'a+').close() modified = False with open(known_hosts_path, 'r+') as f: contents = f.read()