-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoteMachine.py
52 lines (39 loc) · 1.63 KB
/
RemoteMachine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import abc
from abc import abstractmethod
from exceptions import NotImplementedError
class RemoteMachine(object):
__metaclass__=abc.ABCMeta
def __init__(self, machine_ip, machine_name, machine_username, machine_password):
print "RemoteMachine __init__()"
self.machine_ip=machine_ip
self.machine_name=machine_name
self.machine_username=machine_username
self.machine_password=machine_password
# a method with @abstractmethod decorator has to be implemented in the child class
@abstractmethod
def check_file_exists(self, file_path):
raise NotImplementedError()
@abstractmethod
def check_folder_exists(self, folder_path):
raise NotImplementedError()
@abstractmethod
def download_file(self, local_destination, remote_destination, file_name):
raise NotImplementedError()
@abstractmethod
def download_folder(self, local_destination, remote_destination):
raise NotImplementedError()
@abstractmethod
def upload_file(self, local_destination, remote_destination, file_name):
raise NotImplementedError()
@abstractmethod
def upload_folder(self, local_destination, remote_destination):
raise NotImplementedError()
@abstractmethod
def service_status(self, service_name):
raise NotImplementedError()
@abstractmethod
def service_start(self, service_name, timeout=5):
raise NotImplementedError()
@abstractmethod
def service_stop(self, service_name, timeout=5):
raise NotImplementedError()