Commit 09bae484 authored by Björn's avatar Björn

adding

parent 68200af5
......@@ -5,6 +5,7 @@ apt install duplicity
pip3 install python-gnupg
pip3 install configparser
pip3 install paramiko
pip3 install termcolor
```
```bash
......
......@@ -15,7 +15,7 @@ from src.config import Config
from termcolor import colored
#
#
# adding
#
#
class Storagebox(Config):
......@@ -151,26 +151,19 @@ class Storagebox(Config):
exit()
#
# testing connection
# get authorized_keys from storagebox
#
#
#
def _connection(self):
command = self._sftp_command('version')
def _download(self):
command = 'sftp -P ' + self._remote_port + ' ' + self._config.get('default', 'remote_host') + ':.ssh/authorized_keys ' + self._homeDir()
process = self._command(command)
if process.stdout.find('SFTP protocol version') == -1:
if process.stdout.find('No route to host') > -1:
print(colored('Connection Failed!', 'yellow'))
print(colored('Exit Script!', 'red'))
exit()
#
# get authorized_keys from storagebox
#
#
#
def _download(self):
command = 'sftp -P ' + self._remote_port + ' ' + self._config.get('default', 'remote_host') + ':.ssh/authorized_keys ' + self._homeDir()
process = self._command(command)
#
# connect to remote, create directory and upload authorized_keys
......@@ -195,7 +188,6 @@ class Storagebox(Config):
#
def run(self):
self._connection()
self._download()
if self._args.command == 'add':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment