@@ -37,9 +37,11 @@ def get_systemd_status(command):
37
37
38
38
def get_commands (command , directories = None ):
39
39
"""Returns the commands of a running linux system
40
+
40
41
Args:
41
42
command (CommandProtocol): An instance of a Driver implementing the CommandProtocol
42
43
directories (list): An optional list of directories to include
44
+
43
45
Returns:
44
46
list: list of commands available under linux
45
47
"""
@@ -60,9 +62,11 @@ def get_commands(command, directories=None):
60
62
61
63
def get_systemd_service_active (command , service ):
62
64
"""Returns True if service is active, False in all other cases
65
+
63
66
Args:
64
67
command (CommandProtocol): An instance of a Driver implementing the CommandProtocol
65
68
service (str): name of the service
69
+
66
70
Returns:
67
71
bool: True if service is active, False otherwise
68
72
"""
@@ -75,9 +79,11 @@ def get_systemd_service_active(command, service):
75
79
def get_interface_ip (command , interface = "eth0" ):
76
80
import re
77
81
"""Returns the global valid IPv4 address of the supplied interface
82
+
78
83
Args:
79
84
command (CommandProtocol): An instance of a Driver implementing the CommandProtocol
80
85
interface (string): name of the interface
86
+
81
87
Returns:
82
88
str: IPv4 address of the interface, None otherwise
83
89
"""
@@ -108,8 +114,10 @@ def get_interface_ip(command, interface="eth0"):
108
114
109
115
def get_hostname (command ):
110
116
"""Returns the hostname
117
+
111
118
Args:
112
119
command (CommandProtocol): An instance of a Driver implementing the CommandProtocol
120
+
113
121
Returns:
114
122
str: hostname of the target, None otherwise
115
123
"""
@@ -121,10 +129,12 @@ def get_hostname(command):
121
129
122
130
def systemd_unit_properties (command , unit_properties , unit = '' ):
123
131
"""Yields the values of the properties of a unit
132
+
124
133
Args:
125
134
command (CommandProtocol): An instance of a Driver implementing the CommandProtocol
126
135
unit_properties (iterable): Names of the properties of interest
127
136
unit (str, optional): The systemd unit of interest, defaults to empty (systemd manager itself)
137
+
128
138
Yields:
129
139
str: Property value of the unit
130
140
"""
0 commit comments