Skip to content

Commit

Permalink
Disable printing final config when logged in a file
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Jan 11, 2022
1 parent 02560e3 commit 909ae88
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

0.5.2 (01/10/2022)
------------------
- Disable printing final config when logged in a file

0.5.1 (01/10/2022)
------------------
- Change configuration input to match regex
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version_info = (0, 5, 1)
version_info = (0, 5, 2)
11 changes: 8 additions & 3 deletions vpn/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ def interactive_ssh(hostname: str, username: str, pem_file: str, logger: logging
elif isinstance(response, tuple):
logger.info(f"Sending {response[0]}")
interact.send(send_string=response[0])
sys.stdout = sys.__stdout__
interact.expect(timeout=timeout) # Expect comes after releasing print, so the final stages of config gets printed
ssh_client.close()
if 'FILE' in str(logger):
interact.expect(timeout=timeout)
sys.stdout = sys.__stdout__
ssh_client.close()
else:
sys.stdout = sys.__stdout__
interact.expect(timeout=timeout)
ssh_client.close()
return True

0 comments on commit 909ae88

Please sign in to comment.