Skip to content

Commit

Permalink
SSH: Added creation of .ssh directory and known_hosts file if not pre…
Browse files Browse the repository at this point in the history
…sent
  • Loading branch information
blackandred committed Oct 30, 2019
1 parent bc19d71 commit 59139e7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions infracheck/infracheck/checklib/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def execute(self, remote_command: Union[str, list]) -> Tuple[str, int]:

def _make_sure_host_is_known(self):
pattern = self.host if self.port == 22 else '[' + self.host + ']:' + str(self.port)
os.system('mkdir -p $(dirname %s); touch %s' % (self.known_hosts_file, self.known_hosts_file))

with open(self.known_hosts_file, 'rb') as f:
current_content = f.read().decode('utf-8')
Expand Down

0 comments on commit 59139e7

Please sign in to comment.