You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
InstallScript_Odoo/wk_backup_restore/models/lib/check_connectivity.py

24 lines
786 B

import os, time, sys
import re, shutil
import logging
import paramiko
_logger = logging.getLogger(__name__)
def ishostaccessible(details):
response = dict(
status=True,
message='Success'
)
try:
ssh_obj = paramiko.SSHClient()
ssh_obj.set_missing_host_key_policy(paramiko.AutoAddPolicy())
_logger.info("Database Backup In check_connectivity scipt at Line {}".format(17))
ssh_obj.connect(hostname = details['host'], username = details['user'], password = details['password'], port = details['port'])
response['result'] = ssh_obj
return response
except Exception as e:
_logger.info("Couldn't connect remote %r"%e)
response['status'] = False
response['message'] = e
return response