summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Studenov <astudenov@mirantis.com>2017-02-01 10:45:34 +0300
committerAnton Studenov <astudenov@mirantis.com>2017-02-01 10:45:34 +0300
commit7eb1f4a03865f4260e89124a555989a1a69b5371 (patch)
treed8cf3a194876f0f93e8790ce5f7a39d7d5dfb136
parent3ddf8dda8583a5e8e1a13ab857f9ef5373d6d0b6 (diff)
Remove brackets from Service.GREP variables0.1.10
This patch makes content of GREP variables more readable and clear. Also it helps to protect users/developers from missing brackets in GREP variables. * Use `grep -v grep` to to filter grep from ps output. Change-Id: I8455a347912d853b5245e654781f8f117d340298
Notes
Notes (review): Code-Review+2: Ilya Shakhat <ishakhat@mirantis.com> Code-Review+2: Yaroslav Lobankov <ylobankov@mirantis.com> Workflow+1: Yaroslav Lobankov <ylobankov@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 01 Feb 2017 08:59:18 +0000 Reviewed-on: https://review.openstack.org/427118 Project: openstack/os-faults Branch: refs/heads/master
-rw-r--r--os_faults/ansible/modules/freeze.py1
-rw-r--r--os_faults/ansible/modules/kill.py2
-rw-r--r--os_faults/common/service.py2
-rw-r--r--os_faults/drivers/devstack.py18
-rw-r--r--os_faults/drivers/fuel.py84
-rw-r--r--os_faults/drivers/tcpcloud.py48
-rw-r--r--os_faults/tests/unit/ansible/modules/test_freeze.py1
-rw-r--r--os_faults/tests/unit/ansible/modules/test_kill.py4
-rw-r--r--os_faults/tests/unit/drivers/test_devstack.py12
-rw-r--r--os_faults/tests/unit/drivers/test_fuel_management.py3
-rw-r--r--os_faults/tests/unit/drivers/test_fuel_service.py28
-rw-r--r--os_faults/tests/unit/drivers/test_tcpcloud.py12
12 files changed, 113 insertions, 102 deletions
diff --git a/os_faults/ansible/modules/freeze.py b/os_faults/ansible/modules/freeze.py
index 179a4dd..05639f7 100644
--- a/os_faults/ansible/modules/freeze.py
+++ b/os_faults/ansible/modules/freeze.py
@@ -28,6 +28,7 @@ def main():
28 cmd = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);' 28 cmd = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
29 'echo -n \'#!\' > $tf; ' 29 'echo -n \'#!\' > $tf; '
30 'echo -en \'/bin/bash\\npids=`ps ax | ' 30 'echo -en \'/bin/bash\\npids=`ps ax | '
31 'grep -v grep | '
31 'grep %s | awk {{\\047print $1\\047}}`; ' 32 'grep %s | awk {{\\047print $1\\047}}`; '
32 'echo $pids | xargs kill -19; sleep %s; ' 33 'echo $pids | xargs kill -19; sleep %s; '
33 'echo $pids | xargs kill -18; rm \' >> $tf; ' 34 'echo $pids | xargs kill -18; rm \' >> $tf; '
diff --git a/os_faults/ansible/modules/kill.py b/os_faults/ansible/modules/kill.py
index 4ae6065..e8c825e 100644
--- a/os_faults/ansible/modules/kill.py
+++ b/os_faults/ansible/modules/kill.py
@@ -25,7 +25,7 @@ def main():
25 grep = module.params['grep'] 25 grep = module.params['grep']
26 sig = module.params['sig'] 26 sig = module.params['sig']
27 27
28 cmd = ('bash -c "ps ax | grep \'%s\' | awk {\'print $1\'} ' 28 cmd = ('bash -c "ps ax | grep -v grep | grep \'%s\' | awk {\'print $1\'} '
29 '| xargs kill -%s"') % (grep, sig) 29 '| xargs kill -%s"') % (grep, sig)
30 rc, stdout, stderr = module.run_command(cmd, check_rc=True) 30 rc, stdout, stderr = module.run_command(cmd, check_rc=True)
31 module.exit_json(cmd=cmd, rc=rc, stderr=stderr, stdout=stdout) 31 module.exit_json(cmd=cmd, rc=rc, stderr=stderr, stdout=stdout)
diff --git a/os_faults/common/service.py b/os_faults/common/service.py
index f514d6f..613115b 100644
--- a/os_faults/common/service.py
+++ b/os_faults/common/service.py
@@ -47,7 +47,7 @@ class ServiceAsProcess(service.Service):
47 def get_nodes(self): 47 def get_nodes(self):
48 nodes = self.cloud_management.get_nodes() 48 nodes = self.cloud_management.get_nodes()
49 ips = nodes.get_ips() 49 ips = nodes.get_ips()
50 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(self.GREP) 50 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(self.GREP)
51 results = self.cloud_management.execute_on_cloud( 51 results = self.cloud_management.execute_on_cloud(
52 ips, {'command': cmd}, False) 52 ips, {'command': cmd}, False)
53 success_ips = [r.host for r in results 53 success_ips = [r.host for r in results
diff --git a/os_faults/drivers/devstack.py b/os_faults/drivers/devstack.py
index 65cadaa..1bc6269 100644
--- a/os_faults/drivers/devstack.py
+++ b/os_faults/drivers/devstack.py
@@ -59,7 +59,7 @@ class ServiceInScreen(service.ServiceAsProcess):
59 59
60class KeystoneService(service.ServiceAsProcess): 60class KeystoneService(service.ServiceAsProcess):
61 SERVICE_NAME = 'keystone' 61 SERVICE_NAME = 'keystone'
62 GREP = '[k]eystone-' 62 GREP = 'keystone-'
63 RESTART_CMD = 'sudo service apache2 restart' 63 RESTART_CMD = 'sudo service apache2 restart'
64 TERMINATE_CMD = 'sudo service apache2 stop' 64 TERMINATE_CMD = 'sudo service apache2 stop'
65 START_CMD = 'sudo service apache2 start' 65 START_CMD = 'sudo service apache2 start'
@@ -67,7 +67,7 @@ class KeystoneService(service.ServiceAsProcess):
67 67
68class MySQLService(service.ServiceAsProcess): 68class MySQLService(service.ServiceAsProcess):
69 SERVICE_NAME = 'mysql' 69 SERVICE_NAME = 'mysql'
70 GREP = '[m]ysqld' 70 GREP = 'mysqld'
71 RESTART_CMD = 'sudo service mysql restart' 71 RESTART_CMD = 'sudo service mysql restart'
72 TERMINATE_CMD = 'sudo service mysql stop' 72 TERMINATE_CMD = 'sudo service mysql stop'
73 START_CMD = 'sudo service mysql start' 73 START_CMD = 'sudo service mysql start'
@@ -76,7 +76,7 @@ class MySQLService(service.ServiceAsProcess):
76 76
77class RabbitMQService(service.ServiceAsProcess): 77class RabbitMQService(service.ServiceAsProcess):
78 SERVICE_NAME = 'rabbitmq' 78 SERVICE_NAME = 'rabbitmq'
79 GREP = '[r]abbitmq-server' 79 GREP = 'rabbitmq-server'
80 RESTART_CMD = 'sudo service rabbitmq-server restart' 80 RESTART_CMD = 'sudo service rabbitmq-server restart'
81 TERMINATE_CMD = 'sudo service rabbitmq-server stop' 81 TERMINATE_CMD = 'sudo service rabbitmq-server stop'
82 START_CMD = 'sudo service rabbitmq-server start' 82 START_CMD = 'sudo service rabbitmq-server start'
@@ -84,37 +84,37 @@ class RabbitMQService(service.ServiceAsProcess):
84 84
85class NovaAPIService(ServiceInScreen): 85class NovaAPIService(ServiceInScreen):
86 SERVICE_NAME = 'nova-api' 86 SERVICE_NAME = 'nova-api'
87 GREP = '[n]ova-api' 87 GREP = 'nova-api'
88 WINDOW_NAME = 'n-api' 88 WINDOW_NAME = 'n-api'
89 89
90 90
91class GlanceAPIService(ServiceInScreen): 91class GlanceAPIService(ServiceInScreen):
92 SERVICE_NAME = 'glance-api' 92 SERVICE_NAME = 'glance-api'
93 GREP = '[g]lance-api' 93 GREP = 'glance-api'
94 WINDOW_NAME = 'g-api' 94 WINDOW_NAME = 'g-api'
95 95
96 96
97class NovaComputeService(ServiceInScreen): 97class NovaComputeService(ServiceInScreen):
98 SERVICE_NAME = 'nova-compute' 98 SERVICE_NAME = 'nova-compute'
99 GREP = '[n]ova-compute' 99 GREP = 'nova-compute'
100 WINDOW_NAME = 'n-cpu' 100 WINDOW_NAME = 'n-cpu'
101 101
102 102
103class NovaSchedulerService(ServiceInScreen): 103class NovaSchedulerService(ServiceInScreen):
104 SERVICE_NAME = 'nova-scheduler' 104 SERVICE_NAME = 'nova-scheduler'
105 GREP = '[n]ova-scheduler' 105 GREP = 'nova-scheduler'
106 WINDOW_NAME = 'n-sch' 106 WINDOW_NAME = 'n-sch'
107 107
108 108
109class IronicApiService(ServiceInScreen): 109class IronicApiService(ServiceInScreen):
110 SERVICE_NAME = 'ironic-api' 110 SERVICE_NAME = 'ironic-api'
111 GREP = '[i]ronic-api' 111 GREP = 'ironic-api'
112 WINDOW_NAME = 'ir-api' 112 WINDOW_NAME = 'ir-api'
113 113
114 114
115class IronicConductorService(ServiceInScreen): 115class IronicConductorService(ServiceInScreen):
116 SERVICE_NAME = 'ironic-conductor' 116 SERVICE_NAME = 'ironic-conductor'
117 GREP = '[i]ronic-conductor' 117 GREP = 'ironic-conductor'
118 WINDOW_NAME = 'ir-cond' 118 WINDOW_NAME = 'ir-cond'
119 119
120 120
diff --git a/os_faults/drivers/fuel.py b/os_faults/drivers/fuel.py
index a3c66ad..b765d2d 100644
--- a/os_faults/drivers/fuel.py
+++ b/os_faults/drivers/fuel.py
@@ -86,257 +86,257 @@ class PcsOrLinuxService(service.ServiceAsProcess):
86 86
87class KeystoneService(service.LinuxService): 87class KeystoneService(service.LinuxService):
88 SERVICE_NAME = 'keystone' 88 SERVICE_NAME = 'keystone'
89 GREP = '[k]eystone' 89 GREP = 'keystone'
90 LINUX_SERVICE = 'apache2' 90 LINUX_SERVICE = 'apache2'
91 91
92 92
93class HorizonService(service.LinuxService): 93class HorizonService(service.LinuxService):
94 SERVICE_NAME = 'horizon' 94 SERVICE_NAME = 'horizon'
95 GREP = '[a]pache2' 95 GREP = 'apache2'
96 LINUX_SERVICE = 'apache2' 96 LINUX_SERVICE = 'apache2'
97 97
98 98
99class MemcachedService(service.LinuxService): 99class MemcachedService(service.LinuxService):
100 SERVICE_NAME = 'memcached' 100 SERVICE_NAME = 'memcached'
101 GREP = '[m]emcached' 101 GREP = 'memcached'
102 LINUX_SERVICE = 'memcached' 102 LINUX_SERVICE = 'memcached'
103 103
104 104
105class MySQLService(PcsService): 105class MySQLService(PcsService):
106 SERVICE_NAME = 'mysql' 106 SERVICE_NAME = 'mysql'
107 GREP = '[m]ysqld' 107 GREP = 'mysqld'
108 PCS_SERVICE = 'p_mysqld' 108 PCS_SERVICE = 'p_mysqld'
109 PORT = ('tcp', 3307) 109 PORT = ('tcp', 3307)
110 110
111 111
112class RabbitMQService(PcsService): 112class RabbitMQService(PcsService):
113 SERVICE_NAME = 'rabbitmq' 113 SERVICE_NAME = 'rabbitmq'
114 GREP = '[r]abbit tcp_listeners' 114 GREP = 'rabbit tcp_listeners'
115 PCS_SERVICE = 'p_rabbitmq-server' 115 PCS_SERVICE = 'p_rabbitmq-server'
116 116
117 117
118class GlanceAPIService(service.LinuxService): 118class GlanceAPIService(service.LinuxService):
119 SERVICE_NAME = 'glance-api' 119 SERVICE_NAME = 'glance-api'
120 GREP = '[g]lance-api' 120 GREP = 'glance-api'
121 LINUX_SERVICE = 'glance-api' 121 LINUX_SERVICE = 'glance-api'
122 122
123 123
124class GlanceGlareService(service.LinuxService): 124class GlanceGlareService(service.LinuxService):
125 SERVICE_NAME = 'glance-glare' 125 SERVICE_NAME = 'glance-glare'
126 GREP = '[g]lance-glare' 126 GREP = 'glance-glare'
127 LINUX_SERVICE = 'glance-glare' 127 LINUX_SERVICE = 'glance-glare'
128 128
129 129
130class GlanceRegistryService(service.LinuxService): 130class GlanceRegistryService(service.LinuxService):
131 SERVICE_NAME = 'glance-registry' 131 SERVICE_NAME = 'glance-registry'
132 GREP = '[g]lance-registry' 132 GREP = 'glance-registry'
133 LINUX_SERVICE = 'glance-registry' 133 LINUX_SERVICE = 'glance-registry'
134 134
135 135
136class NovaAPIService(service.LinuxService): 136class NovaAPIService(service.LinuxService):
137 SERVICE_NAME = 'nova-api' 137 SERVICE_NAME = 'nova-api'
138 GREP = '[n]ova-api' 138 GREP = 'nova-api'
139 LINUX_SERVICE = 'nova-api' 139 LINUX_SERVICE = 'nova-api'
140 140
141 141
142class NovaComputeService(service.LinuxService): 142class NovaComputeService(service.LinuxService):
143 SERVICE_NAME = 'nova-compute' 143 SERVICE_NAME = 'nova-compute'
144 GREP = '[n]ova-compute' 144 GREP = 'nova-compute'
145 LINUX_SERVICE = 'nova-compute' 145 LINUX_SERVICE = 'nova-compute'
146 146
147 147
148class NovaSchedulerService(service.LinuxService): 148class NovaSchedulerService(service.LinuxService):
149 SERVICE_NAME = 'nova-scheduler' 149 SERVICE_NAME = 'nova-scheduler'
150 GREP = '[n]ova-scheduler' 150 GREP = 'nova-scheduler'
151 LINUX_SERVICE = 'nova-scheduler' 151 LINUX_SERVICE = 'nova-scheduler'
152 152
153 153
154class NovaCertService(service.LinuxService): 154class NovaCertService(service.LinuxService):
155 SERVICE_NAME = 'nova-cert' 155 SERVICE_NAME = 'nova-cert'
156 GREP = '[n]ova-cert' 156 GREP = 'nova-cert'
157 LINUX_SERVICE = 'nova-cert' 157 LINUX_SERVICE = 'nova-cert'
158 158
159 159
160class NovaConductorService(service.LinuxService): 160class NovaConductorService(service.LinuxService):
161 SERVICE_NAME = 'nova-conductor' 161 SERVICE_NAME = 'nova-conductor'
162 GREP = '[n]ova-conductor' 162 GREP = 'nova-conductor'
163 LINUX_SERVICE = 'nova-conductor' 163 LINUX_SERVICE = 'nova-conductor'
164 164
165 165
166class NovaConsoleAuthService(service.LinuxService): 166class NovaConsoleAuthService(service.LinuxService):
167 SERVICE_NAME = 'nova-consoleauth' 167 SERVICE_NAME = 'nova-consoleauth'
168 GREP = '[n]ova-consoleauth' 168 GREP = 'nova-consoleauth'
169 LINUX_SERVICE = 'nova-consoleauth' 169 LINUX_SERVICE = 'nova-consoleauth'
170 170
171 171
172class NovaNoVNCProxyService(service.LinuxService): 172class NovaNoVNCProxyService(service.LinuxService):
173 SERVICE_NAME = 'nova-novncproxy' 173 SERVICE_NAME = 'nova-novncproxy'
174 GREP = '[n]ova-novncproxy' 174 GREP = 'nova-novncproxy'
175 LINUX_SERVICE = 'nova-novncproxy' 175 LINUX_SERVICE = 'nova-novncproxy'
176 176
177 177
178class NeutronServerService(service.LinuxService): 178class NeutronServerService(service.LinuxService):
179 SERVICE_NAME = 'neutron-server' 179 SERVICE_NAME = 'neutron-server'
180 GREP = '[n]eutron-server' 180 GREP = 'neutron-server'
181 LINUX_SERVICE = 'neutron-server' 181 LINUX_SERVICE = 'neutron-server'
182 182
183 183
184class NeutronDhcpAgentService(PcsService): 184class NeutronDhcpAgentService(PcsService):
185 SERVICE_NAME = 'neutron-dhcp-agent' 185 SERVICE_NAME = 'neutron-dhcp-agent'
186 GREP = '[n]eutron-dhcp-agent' 186 GREP = 'neutron-dhcp-agent'
187 PCS_SERVICE = 'neutron-dhcp-agent' 187 PCS_SERVICE = 'neutron-dhcp-agent'
188 188
189 189
190class NeutronMetadataAgentService(PcsOrLinuxService): 190class NeutronMetadataAgentService(PcsOrLinuxService):
191 SERVICE_NAME = 'neutron-metadata-agent' 191 SERVICE_NAME = 'neutron-metadata-agent'
192 GREP = '[n]eutron-metadata-agent' 192 GREP = 'neutron-metadata-agent'
193 PCS_SERVICE = 'neutron-metadata-agent' 193 PCS_SERVICE = 'neutron-metadata-agent'
194 LINUX_SERVICE = 'neutron-metadata-agent' 194 LINUX_SERVICE = 'neutron-metadata-agent'
195 195
196 196
197class NeutronOpenvswitchAgentService(PcsOrLinuxService): 197class NeutronOpenvswitchAgentService(PcsOrLinuxService):
198 SERVICE_NAME = 'neutron-openvswitch-agent' 198 SERVICE_NAME = 'neutron-openvswitch-agent'
199 GREP = '[n]eutron-openvswitch-agent' 199 GREP = 'neutron-openvswitch-agent'
200 PCS_SERVICE = 'neutron-openvswitch-agent' 200 PCS_SERVICE = 'neutron-openvswitch-agent'
201 LINUX_SERVICE = 'neutron-openvswitch-agent' 201 LINUX_SERVICE = 'neutron-openvswitch-agent'
202 202
203 203
204class NeutronL3AgentService(PcsOrLinuxService): 204class NeutronL3AgentService(PcsOrLinuxService):
205 SERVICE_NAME = 'neutron-l3-agent' 205 SERVICE_NAME = 'neutron-l3-agent'
206 GREP = '[n]eutron-l3-agent' 206 GREP = 'neutron-l3-agent'
207 PCS_SERVICE = 'neutron-l3-agent' 207 PCS_SERVICE = 'neutron-l3-agent'
208 LINUX_SERVICE = 'neutron-l3-agent' 208 LINUX_SERVICE = 'neutron-l3-agent'
209 209
210 210
211class HeatAPIService(service.LinuxService): 211class HeatAPIService(service.LinuxService):
212 SERVICE_NAME = 'heat-api' 212 SERVICE_NAME = 'heat-api'
213 GREP = '[h]eat-api' 213 GREP = 'heat-api'
214 LINUX_SERVICE = 'heat-api' 214 LINUX_SERVICE = 'heat-api'
215 215
216 216
217class HeatEngineService(PcsService): 217class HeatEngineService(PcsService):
218 SERVICE_NAME = 'heat-engine' 218 SERVICE_NAME = 'heat-engine'
219 GREP = '[h]eat-engine' 219 GREP = 'heat-engine'
220 PCS_SERVICE = 'p_heat-engine' 220 PCS_SERVICE = 'p_heat-engine'
221 221
222 222
223class CinderAPIService(service.LinuxService): 223class CinderAPIService(service.LinuxService):
224 SERVICE_NAME = 'cinder-api' 224 SERVICE_NAME = 'cinder-api'
225 GREP = '[c]inder-api' 225 GREP = 'cinder-api'
226 LINUX_SERVICE = 'cinder-api' 226 LINUX_SERVICE = 'cinder-api'
227 227
228 228
229class CinderSchedulerService(service.LinuxService): 229class CinderSchedulerService(service.LinuxService):
230 SERVICE_NAME = 'cinder-scheduler' 230 SERVICE_NAME = 'cinder-scheduler'
231 GREP = '[c]inder-scheduler' 231 GREP = 'cinder-scheduler'
232 LINUX_SERVICE = 'cinder-scheduler' 232 LINUX_SERVICE = 'cinder-scheduler'
233 233
234 234
235class CinderVolumeService(service.LinuxService): 235class CinderVolumeService(service.LinuxService):
236 SERVICE_NAME = 'cinder-volume' 236 SERVICE_NAME = 'cinder-volume'
237 GREP = '[c]inder-volume' 237 GREP = 'cinder-volume'
238 LINUX_SERVICE = 'cinder-volume' 238 LINUX_SERVICE = 'cinder-volume'
239 239
240 240
241class CinderBackupService(service.LinuxService): 241class CinderBackupService(service.LinuxService):
242 SERVICE_NAME = 'cinder-backup' 242 SERVICE_NAME = 'cinder-backup'
243 GREP = '[c]inder-backup' 243 GREP = 'cinder-backup'
244 LINUX_SERVICE = 'cinder-backup' 244 LINUX_SERVICE = 'cinder-backup'
245 245
246 246
247class IronicApiService(service.LinuxService): 247class IronicApiService(service.LinuxService):
248 SERVICE_NAME = 'ironic-api' 248 SERVICE_NAME = 'ironic-api'
249 GREP = '[i]ronic-api' 249 GREP = 'ironic-api'
250 LINUX_SERVICE = 'ironic-api' 250 LINUX_SERVICE = 'ironic-api'
251 251
252 252
253class IronicConductorService(service.LinuxService): 253class IronicConductorService(service.LinuxService):
254 SERVICE_NAME = 'ironic-conductor' 254 SERVICE_NAME = 'ironic-conductor'
255 GREP = '[i]ronic-conductor' 255 GREP = 'ironic-conductor'
256 LINUX_SERVICE = 'ironic-conductor' 256 LINUX_SERVICE = 'ironic-conductor'
257 257
258 258
259class SwiftAccountService(service.LinuxService): 259class SwiftAccountService(service.LinuxService):
260 SERVICE_NAME = 'swift-account' 260 SERVICE_NAME = 'swift-account'
261 GREP = '[s]wift-account' 261 GREP = 'swift-account'
262 LINUX_SERVICE = 'swift-account' 262 LINUX_SERVICE = 'swift-account'
263 263
264 264
265class SwiftAccountAuditorService(service.LinuxService): 265class SwiftAccountAuditorService(service.LinuxService):
266 SERVICE_NAME = 'swift-account-auditor' 266 SERVICE_NAME = 'swift-account-auditor'
267 GREP = '[s]wift-account-auditor' 267 GREP = 'swift-account-auditor'
268 LINUX_SERVICE = 'swift-account-auditor' 268 LINUX_SERVICE = 'swift-account-auditor'
269 269
270 270
271class SwiftAccountReaperService(service.LinuxService): 271class SwiftAccountReaperService(service.LinuxService):
272 SERVICE_NAME = 'swift-account-reaper' 272 SERVICE_NAME = 'swift-account-reaper'
273 GREP = '[s]wift-account-reaper' 273 GREP = 'swift-account-reaper'
274 LINUX_SERVICE = 'swift-account-reaper' 274 LINUX_SERVICE = 'swift-account-reaper'
275 275
276 276
277class SwiftAccountReplicatorService(service.LinuxService): 277class SwiftAccountReplicatorService(service.LinuxService):
278 SERVICE_NAME = 'swift-account-replicator' 278 SERVICE_NAME = 'swift-account-replicator'
279 GREP = '[s]wift-account-replicator' 279 GREP = 'swift-account-replicator'
280 LINUX_SERVICE = 'swift-account-replicator' 280 LINUX_SERVICE = 'swift-account-replicator'
281 281
282 282
283class SwiftContainerService(service.LinuxService): 283class SwiftContainerService(service.LinuxService):
284 SERVICE_NAME = 'swift-container' 284 SERVICE_NAME = 'swift-container'
285 GREP = '[s]wift-container' 285 GREP = 'swift-container'
286 LINUX_SERVICE = 'swift-container' 286 LINUX_SERVICE = 'swift-container'
287 287
288 288
289class SwiftContainerAuditorService(service.LinuxService): 289class SwiftContainerAuditorService(service.LinuxService):
290 SERVICE_NAME = 'swift-container-auditor' 290 SERVICE_NAME = 'swift-container-auditor'
291 GREP = '[s]wift-container-auditor' 291 GREP = 'swift-container-auditor'
292 LINUX_SERVICE = 'swift-container-auditor' 292 LINUX_SERVICE = 'swift-container-auditor'
293 293
294 294
295class SwiftContainerReplicatorService(service.LinuxService): 295class SwiftContainerReplicatorService(service.LinuxService):
296 SERVICE_NAME = 'swift-container-replicator' 296 SERVICE_NAME = 'swift-container-replicator'
297 GREP = '[s]wift-container-replicator' 297 GREP = 'swift-container-replicator'
298 LINUX_SERVICE = 'swift-container-replicator' 298 LINUX_SERVICE = 'swift-container-replicator'
299 299
300 300
301class SwiftContainerSyncService(service.LinuxService): 301class SwiftContainerSyncService(service.LinuxService):
302 SERVICE_NAME = 'swift-container-sync' 302 SERVICE_NAME = 'swift-container-sync'
303 GREP = '[s]wift-container-sync' 303 GREP = 'swift-container-sync'
304 LINUX_SERVICE = 'swift-container-sync' 304 LINUX_SERVICE = 'swift-container-sync'
305 305
306 306
307class SwiftContainerUpdaterService(service.LinuxService): 307class SwiftContainerUpdaterService(service.LinuxService):
308 SERVICE_NAME = 'swift-container-updater' 308 SERVICE_NAME = 'swift-container-updater'
309 GREP = '[s]wift-container-updater' 309 GREP = 'swift-container-updater'
310 LINUX_SERVICE = 'swift-container-updater' 310 LINUX_SERVICE = 'swift-container-updater'
311 311
312 312
313class SwiftObjectService(service.LinuxService): 313class SwiftObjectService(service.LinuxService):
314 SERVICE_NAME = 'swift-object' 314 SERVICE_NAME = 'swift-object'
315 GREP = '[s]wift-object' 315 GREP = 'swift-object'
316 LINUX_SERVICE = 'swift-object' 316 LINUX_SERVICE = 'swift-object'
317 317
318 318
319class SwiftObjectAuditorService(service.LinuxService): 319class SwiftObjectAuditorService(service.LinuxService):
320 SERVICE_NAME = 'swift-object-auditor' 320 SERVICE_NAME = 'swift-object-auditor'
321 GREP = '[s]wift-object-auditor' 321 GREP = 'swift-object-auditor'
322 LINUX_SERVICE = 'swift-object-auditor' 322 LINUX_SERVICE = 'swift-object-auditor'
323 323
324 324
325class SwiftObjectReplicatorService(service.LinuxService): 325class SwiftObjectReplicatorService(service.LinuxService):
326 SERVICE_NAME = 'swift-object-replicator' 326 SERVICE_NAME = 'swift-object-replicator'
327 GREP = '[s]wift-object-replicator' 327 GREP = 'swift-object-replicator'
328 LINUX_SERVICE = 'swift-object-replicator' 328 LINUX_SERVICE = 'swift-object-replicator'
329 329
330 330
331class SwiftObjectUpdaterService(service.LinuxService): 331class SwiftObjectUpdaterService(service.LinuxService):
332 SERVICE_NAME = 'swift-object-updater' 332 SERVICE_NAME = 'swift-object-updater'
333 GREP = '[s]wift-object-updater' 333 GREP = 'swift-object-updater'
334 LINUX_SERVICE = 'swift-object-updater' 334 LINUX_SERVICE = 'swift-object-updater'
335 335
336 336
337class SwiftProxyService(service.LinuxService): 337class SwiftProxyService(service.LinuxService):
338 SERVICE_NAME = 'swift-proxy' 338 SERVICE_NAME = 'swift-proxy'
339 GREP = '[s]wift-proxy' 339 GREP = 'swift-proxy'
340 LINUX_SERVICE = 'swift-proxy' 340 LINUX_SERVICE = 'swift-proxy'
341 341
342 342
diff --git a/os_faults/drivers/tcpcloud.py b/os_faults/drivers/tcpcloud.py
index f25e8e7..e671dcc 100644
--- a/os_faults/drivers/tcpcloud.py
+++ b/os_faults/drivers/tcpcloud.py
@@ -54,25 +54,25 @@ class SaltService(service.ServiceAsProcess):
54 54
55class KeystoneService(SaltService): 55class KeystoneService(SaltService):
56 SERVICE_NAME = 'keystone' 56 SERVICE_NAME = 'keystone'
57 GREP = '[k]eystone-all' 57 GREP = 'keystone-all'
58 SALT_SERVICE = 'keystone' 58 SALT_SERVICE = 'keystone'
59 59
60 60
61class HorizonService(SaltService): 61class HorizonService(SaltService):
62 SERVICE_NAME = 'horizon' 62 SERVICE_NAME = 'horizon'
63 GREP = '[a]pache2' 63 GREP = 'apache2'
64 SALT_SERVICE = 'apache2' 64 SALT_SERVICE = 'apache2'
65 65
66 66
67class MemcachedService(SaltService): 67class MemcachedService(SaltService):
68 SERVICE_NAME = 'memcached' 68 SERVICE_NAME = 'memcached'
69 GREP = '[m]emcached' 69 GREP = 'memcached'
70 SALT_SERVICE = 'memcached' 70 SALT_SERVICE = 'memcached'
71 71
72 72
73class MySQLService(SaltService): 73class MySQLService(SaltService):
74 SERVICE_NAME = 'mysql' 74 SERVICE_NAME = 'mysql'
75 GREP = '[m]ysqld' 75 GREP = 'mysqld'
76 SALT_SERVICE = 'mysql' 76 SALT_SERVICE = 'mysql'
77 PORT = ('tcp', 3307) 77 PORT = ('tcp', 3307)
78 78
@@ -85,121 +85,121 @@ class RabbitMQService(SaltService):
85 85
86class GlanceAPIService(SaltService): 86class GlanceAPIService(SaltService):
87 SERVICE_NAME = 'glance-api' 87 SERVICE_NAME = 'glance-api'
88 GREP = '[g]lance-api' 88 GREP = 'glance-api'
89 SALT_SERVICE = 'glance-api' 89 SALT_SERVICE = 'glance-api'
90 90
91 91
92class GlanceRegistryService(SaltService): 92class GlanceRegistryService(SaltService):
93 SERVICE_NAME = 'glance-registry' 93 SERVICE_NAME = 'glance-registry'
94 GREP = '[g]lance-registry' 94 GREP = 'glance-registry'
95 SALT_SERVICE = 'glance-registry' 95 SALT_SERVICE = 'glance-registry'
96 96
97 97
98class NovaAPIService(SaltService): 98class NovaAPIService(SaltService):
99 SERVICE_NAME = 'nova-api' 99 SERVICE_NAME = 'nova-api'
100 GREP = '[n]ova-api' 100 GREP = 'nova-api'
101 SALT_SERVICE = 'nova-api' 101 SALT_SERVICE = 'nova-api'
102 102
103 103
104class NovaComputeService(SaltService): 104class NovaComputeService(SaltService):
105 SERVICE_NAME = 'nova-compute' 105 SERVICE_NAME = 'nova-compute'
106 GREP = '[n]ova-compute' 106 GREP = 'nova-compute'
107 SALT_SERVICE = 'nova-compute' 107 SALT_SERVICE = 'nova-compute'
108 108
109 109
110class NovaSchedulerService(SaltService): 110class NovaSchedulerService(SaltService):
111 SERVICE_NAME = 'nova-scheduler' 111 SERVICE_NAME = 'nova-scheduler'
112 GREP = '[n]ova-scheduler' 112 GREP = 'nova-scheduler'
113 SALT_SERVICE = 'nova-scheduler' 113 SALT_SERVICE = 'nova-scheduler'
114 114
115 115
116class NovaCertService(SaltService): 116class NovaCertService(SaltService):
117 SERVICE_NAME = 'nova-cert' 117 SERVICE_NAME = 'nova-cert'
118 GREP = '[n]ova-cert' 118 GREP = 'nova-cert'
119 SALT_SERVICE = 'nova-cert' 119 SALT_SERVICE = 'nova-cert'
120 120
121 121
122class NovaConductorService(SaltService): 122class NovaConductorService(SaltService):
123 SERVICE_NAME = 'nova-conductor' 123 SERVICE_NAME = 'nova-conductor'
124 GREP = '[n]ova-conductor' 124 GREP = 'nova-conductor'
125 SALT_SERVICE = 'nova-conductor' 125 SALT_SERVICE = 'nova-conductor'
126 126
127 127
128class NovaConsoleAuthService(SaltService): 128class NovaConsoleAuthService(SaltService):
129 SERVICE_NAME = 'nova-consoleauth' 129 SERVICE_NAME = 'nova-consoleauth'
130 GREP = '[n]ova-consoleauth' 130 GREP = 'nova-consoleauth'
131 SALT_SERVICE = 'nova-consoleauth' 131 SALT_SERVICE = 'nova-consoleauth'
132 132
133 133
134class NovaNoVNCProxyService(SaltService): 134class NovaNoVNCProxyService(SaltService):
135 SERVICE_NAME = 'nova-novncproxy' 135 SERVICE_NAME = 'nova-novncproxy'
136 GREP = '[n]ova-novncproxy' 136 GREP = 'nova-novncproxy'
137 SALT_SERVICE = 'nova-novncproxy' 137 SALT_SERVICE = 'nova-novncproxy'
138 138
139 139
140class NeutronServerService(SaltService): 140class NeutronServerService(SaltService):
141 SERVICE_NAME = 'neutron-server' 141 SERVICE_NAME = 'neutron-server'
142 GREP = '[n]eutron-server' 142 GREP = 'neutron-server'
143 SALT_SERVICE = 'neutron-server' 143 SALT_SERVICE = 'neutron-server'
144 144
145 145
146class NeutronDhcpAgentService(SaltService): 146class NeutronDhcpAgentService(SaltService):
147 SERVICE_NAME = 'neutron-dhcp-agent' 147 SERVICE_NAME = 'neutron-dhcp-agent'
148 GREP = '[n]eutron-dhcp-agent' 148 GREP = 'neutron-dhcp-agent'
149 SALT_SERVICE = 'neutron-dhcp-agent' 149 SALT_SERVICE = 'neutron-dhcp-agent'
150 150
151 151
152class NeutronMetadataAgentService(SaltService): 152class NeutronMetadataAgentService(SaltService):
153 SERVICE_NAME = 'neutron-metadata-agent' 153 SERVICE_NAME = 'neutron-metadata-agent'
154 GREP = '[n]eutron-metadata-agent' 154 GREP = 'neutron-metadata-agent'
155 SALT_SERVICE = 'neutron-metadata-agent' 155 SALT_SERVICE = 'neutron-metadata-agent'
156 156
157 157
158class NeutronOpenvswitchAgentService(SaltService): 158class NeutronOpenvswitchAgentService(SaltService):
159 SERVICE_NAME = 'neutron-openvswitch-agent' 159 SERVICE_NAME = 'neutron-openvswitch-agent'
160 GREP = '[n]eutron-openvswitch-agent' 160 GREP = 'neutron-openvswitch-agent'
161 SALT_SERVICE = 'neutron-openvswitch-agent' 161 SALT_SERVICE = 'neutron-openvswitch-agent'
162 162
163 163
164class NeutronL3AgentService(SaltService): 164class NeutronL3AgentService(SaltService):
165 SERVICE_NAME = 'neutron-l3-agent' 165 SERVICE_NAME = 'neutron-l3-agent'
166 GREP = '[n]eutron-l3-agent' 166 GREP = 'neutron-l3-agent'
167 SALT_SERVICE = 'neutron-l3-agent' 167 SALT_SERVICE = 'neutron-l3-agent'
168 168
169 169
170class HeatAPIService(SaltService): 170class HeatAPIService(SaltService):
171 SERVICE_NAME = 'heat-api' 171 SERVICE_NAME = 'heat-api'
172 GREP = '[h]eat-api ' 172 GREP = 'heat-api ' # space at the end filters heat-api-* services
173 SALT_SERVICE = 'heat-api' 173 SALT_SERVICE = 'heat-api'
174 174
175 175
176class HeatEngineService(SaltService): 176class HeatEngineService(SaltService):
177 SERVICE_NAME = 'heat-engine' 177 SERVICE_NAME = 'heat-engine'
178 GREP = '[h]eat-engine' 178 GREP = 'heat-engine'
179 SALT_SERVICE = 'heat-engine' 179 SALT_SERVICE = 'heat-engine'
180 180
181 181
182class CinderAPIService(SaltService): 182class CinderAPIService(SaltService):
183 SERVICE_NAME = 'cinder-api' 183 SERVICE_NAME = 'cinder-api'
184 GREP = '[c]inder-api' 184 GREP = 'cinder-api'
185 SALT_SERVICE = 'cinder-api' 185 SALT_SERVICE = 'cinder-api'
186 186
187 187
188class CinderSchedulerService(SaltService): 188class CinderSchedulerService(SaltService):
189 SERVICE_NAME = 'cinder-scheduler' 189 SERVICE_NAME = 'cinder-scheduler'
190 GREP = '[c]inder-scheduler' 190 GREP = 'cinder-scheduler'
191 SALT_SERVICE = 'cinder-scheduler' 191 SALT_SERVICE = 'cinder-scheduler'
192 192
193 193
194class CinderVolumeService(SaltService): 194class CinderVolumeService(SaltService):
195 SERVICE_NAME = 'cinder-volume' 195 SERVICE_NAME = 'cinder-volume'
196 GREP = '[c]inder-volume' 196 GREP = 'cinder-volume'
197 SALT_SERVICE = 'cinder-volume' 197 SALT_SERVICE = 'cinder-volume'
198 198
199 199
200class CinderBackupService(SaltService): 200class CinderBackupService(SaltService):
201 SERVICE_NAME = 'cinder-backup' 201 SERVICE_NAME = 'cinder-backup'
202 GREP = '[c]inder-backup' 202 GREP = 'cinder-backup'
203 SALT_SERVICE = 'cinder-backup' 203 SALT_SERVICE = 'cinder-backup'
204 204
205 205
diff --git a/os_faults/tests/unit/ansible/modules/test_freeze.py b/os_faults/tests/unit/ansible/modules/test_freeze.py
index 537bb67..f217e8b 100644
--- a/os_faults/tests/unit/ansible/modules/test_freeze.py
+++ b/os_faults/tests/unit/ansible/modules/test_freeze.py
@@ -33,6 +33,7 @@ class FreezeTestCase(test.TestCase):
33 cmd = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);' 33 cmd = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
34 'echo -n \'#!\' > $tf; ' 34 'echo -n \'#!\' > $tf; '
35 'echo -en \'/bin/bash\\npids=`ps ax | ' 35 'echo -en \'/bin/bash\\npids=`ps ax | '
36 'grep -v grep | '
36 'grep foo | awk {{\\047print $1\\047}}`; ' 37 'grep foo | awk {{\\047print $1\\047}}`; '
37 'echo $pids | xargs kill -19; sleep 15; ' 38 'echo $pids | xargs kill -19; sleep 15; '
38 'echo $pids | xargs kill -18; rm \' >> $tf; ' 39 'echo $pids | xargs kill -18; rm \' >> $tf; '
diff --git a/os_faults/tests/unit/ansible/modules/test_kill.py b/os_faults/tests/unit/ansible/modules/test_kill.py
index 241568a..c93d02f 100644
--- a/os_faults/tests/unit/ansible/modules/test_kill.py
+++ b/os_faults/tests/unit/ansible/modules/test_kill.py
@@ -22,9 +22,9 @@ from os_faults.tests.unit import test
22@ddt.ddt 22@ddt.ddt
23class KillTestCase(test.TestCase): 23class KillTestCase(test.TestCase):
24 24
25 @ddt.data(['foo', 9, 'bash -c "ps ax | grep \'foo\' ' 25 @ddt.data(['foo', 9, 'bash -c "ps ax | grep -v grep | grep \'foo\' '
26 '| awk {\'print $1\'} | xargs kill -9"'], 26 '| awk {\'print $1\'} | xargs kill -9"'],
27 ['bar', 3, 'bash -c "ps ax | grep \'bar\' ' 27 ['bar', 3, 'bash -c "ps ax | grep -v grep | grep \'bar\' '
28 '| awk {\'print $1\'} | xargs kill -3"']) 28 '| awk {\'print $1\'} | xargs kill -3"'])
29 @ddt.unpack 29 @ddt.unpack
30 @mock.patch("os_faults.ansible.modules.kill.AnsibleModule") 30 @mock.patch("os_faults.ansible.modules.kill.AnsibleModule")
diff --git a/os_faults/tests/unit/drivers/test_devstack.py b/os_faults/tests/unit/drivers/test_devstack.py
index de06bd2..1b996f9 100644
--- a/os_faults/tests/unit/drivers/test_devstack.py
+++ b/os_faults/tests/unit/drivers/test_devstack.py
@@ -181,7 +181,8 @@ class DevStackManagementTestCase(test.TestCase):
181 181
182 nodes = service.get_nodes() 182 nodes = service.get_nodes()
183 183
184 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 184 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
185 service_cls.GREP)
185 ansible_runner_inst.execute.assert_has_calls([ 186 ansible_runner_inst.execute.assert_has_calls([
186 mock.call( 187 mock.call(
187 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}), 188 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}),
@@ -219,7 +220,8 @@ class DevStackServiceTestCase(test.TestCase):
219 220
220 service.restart() 221 service.restart()
221 222
222 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 223 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
224 service_cls.GREP)
223 ansible_runner_inst.execute.assert_has_calls([ 225 ansible_runner_inst.execute.assert_has_calls([
224 mock.call( 226 mock.call(
225 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}), 227 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}),
@@ -246,7 +248,8 @@ class DevStackServiceTestCase(test.TestCase):
246 248
247 service.terminate() 249 service.terminate()
248 250
249 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 251 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
252 service_cls.GREP)
250 ansible_runner_inst.execute.assert_has_calls([ 253 ansible_runner_inst.execute.assert_has_calls([
251 mock.call( 254 mock.call(
252 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}), 255 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}),
@@ -273,7 +276,8 @@ class DevStackServiceTestCase(test.TestCase):
273 276
274 service.start() 277 service.start()
275 278
276 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 279 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
280 service_cls.GREP)
277 ansible_runner_inst.execute.assert_has_calls([ 281 ansible_runner_inst.execute.assert_has_calls([
278 mock.call( 282 mock.call(
279 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}), 283 ['10.0.0.2'], {'command': 'cat /sys/class/net/eth0/address'}),
diff --git a/os_faults/tests/unit/drivers/test_fuel_management.py b/os_faults/tests/unit/drivers/test_fuel_management.py
index de5bada..b73246f 100644
--- a/os_faults/tests/unit/drivers/test_fuel_management.py
+++ b/os_faults/tests/unit/drivers/test_fuel_management.py
@@ -158,7 +158,8 @@ class FuelManagementTestCase(test.TestCase):
158 self.assertIsInstance(service, service_cls) 158 self.assertIsInstance(service, service_cls)
159 159
160 nodes = service.get_nodes() 160 nodes = service.get_nodes()
161 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 161 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
162 service_cls.GREP)
162 ansible_runner_inst.execute.assert_has_calls([ 163 ansible_runner_inst.execute.assert_has_calls([
163 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 164 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
164 mock.call(['10.0.0.2', '10.0.0.3'], 165 mock.call(['10.0.0.2', '10.0.0.3'],
diff --git a/os_faults/tests/unit/drivers/test_fuel_service.py b/os_faults/tests/unit/drivers/test_fuel_service.py
index 44e755f..7844108 100644
--- a/os_faults/tests/unit/drivers/test_fuel_service.py
+++ b/os_faults/tests/unit/drivers/test_fuel_service.py
@@ -57,7 +57,7 @@ class FuelServiceTestCase(test.TestCase):
57 57
58 service.kill() 58 service.kill()
59 59
60 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 60 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
61 service_cls.GREP) 61 service_cls.GREP)
62 ansible_runner_inst.execute.assert_has_calls([ 62 ansible_runner_inst.execute.assert_has_calls([
63 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 63 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -91,7 +91,7 @@ class FuelServiceTestCase(test.TestCase):
91 91
92 service.freeze() 92 service.freeze()
93 93
94 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 94 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
95 service_cls.GREP) 95 service_cls.GREP)
96 ansible_runner_inst.execute.assert_has_calls([ 96 ansible_runner_inst.execute.assert_has_calls([
97 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 97 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -126,7 +126,7 @@ class FuelServiceTestCase(test.TestCase):
126 delay_sec = 10 126 delay_sec = 10
127 service.freeze(nodes=None, sec=delay_sec) 127 service.freeze(nodes=None, sec=delay_sec)
128 128
129 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 129 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
130 service_cls.GREP) 130 service_cls.GREP)
131 ansible_runner_inst.execute.assert_has_calls([ 131 ansible_runner_inst.execute.assert_has_calls([
132 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 132 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -161,7 +161,7 @@ class FuelServiceTestCase(test.TestCase):
161 161
162 service.unfreeze() 162 service.unfreeze()
163 163
164 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 164 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
165 service_cls.GREP) 165 service_cls.GREP)
166 ansible_runner_inst.execute.assert_has_calls([ 166 ansible_runner_inst.execute.assert_has_calls([
167 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 167 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -195,7 +195,7 @@ class FuelServiceTestCase(test.TestCase):
195 195
196 service.unplug() 196 service.unplug()
197 197
198 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 198 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
199 service_cls.GREP) 199 service_cls.GREP)
200 ansible_runner_inst.execute.assert_has_calls([ 200 ansible_runner_inst.execute.assert_has_calls([
201 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 201 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -232,7 +232,7 @@ class FuelServiceTestCase(test.TestCase):
232 232
233 service.plug() 233 service.plug()
234 234
235 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 235 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
236 service_cls.GREP) 236 service_cls.GREP)
237 ansible_runner_inst.execute.assert_has_calls([ 237 ansible_runner_inst.execute.assert_has_calls([
238 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 238 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -269,8 +269,8 @@ class FuelServiceTestCase(test.TestCase):
269 269
270 service.restart() 270 service.restart()
271 271
272 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 272 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
273 service.GREP) 273 service_cls.GREP)
274 ansible_runner_inst.execute.assert_has_calls([ 274 ansible_runner_inst.execute.assert_has_calls([
275 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 275 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
276 mock.call(['10.0.0.2', '10.0.0.3'], 276 mock.call(['10.0.0.2', '10.0.0.3'],
@@ -303,8 +303,8 @@ class FuelServiceTestCase(test.TestCase):
303 303
304 service.terminate() 304 service.terminate()
305 305
306 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 306 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
307 service.GREP) 307 service_cls.GREP)
308 ansible_runner_inst.execute.assert_has_calls([ 308 ansible_runner_inst.execute.assert_has_calls([
309 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 309 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
310 mock.call(['10.0.0.2', '10.0.0.3'], 310 mock.call(['10.0.0.2', '10.0.0.3'],
@@ -337,8 +337,8 @@ class FuelServiceTestCase(test.TestCase):
337 337
338 service.start() 338 service.start()
339 339
340 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 340 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
341 service.GREP) 341 service_cls.GREP)
342 ansible_runner_inst.execute.assert_has_calls([ 342 ansible_runner_inst.execute.assert_has_calls([
343 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 343 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
344 mock.call(['10.0.0.2', '10.0.0.3'], 344 mock.call(['10.0.0.2', '10.0.0.3'],
@@ -369,7 +369,7 @@ class FuelServiceTestCase(test.TestCase):
369 exception = self.assertRaises(error.ServiceError, service.restart) 369 exception = self.assertRaises(error.ServiceError, service.restart)
370 self.assertEqual('Task failed on some nodes', str(exception)) 370 self.assertEqual('Task failed on some nodes', str(exception))
371 371
372 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 372 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
373 service.GREP) 373 service.GREP)
374 ansible_runner_inst.execute.assert_has_calls([ 374 ansible_runner_inst.execute.assert_has_calls([
375 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 375 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
@@ -398,7 +398,7 @@ class FuelServiceTestCase(test.TestCase):
398 exception = self.assertRaises(error.ServiceError, service.restart) 398 exception = self.assertRaises(error.ServiceError, service.restart)
399 self.assertEqual('Node collection is empty', str(exception)) 399 self.assertEqual('Node collection is empty', str(exception))
400 400
401 get_nodes_cmd = 'bash -c "ps ax | grep \'{}\'"'.format( 401 get_nodes_cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
402 service.GREP) 402 service.GREP)
403 ansible_runner_inst.execute.assert_has_calls([ 403 ansible_runner_inst.execute.assert_has_calls([
404 mock.call(['fuel.local'], {'command': 'fuel node --json'}), 404 mock.call(['fuel.local'], {'command': 'fuel node --json'}),
diff --git a/os_faults/tests/unit/drivers/test_tcpcloud.py b/os_faults/tests/unit/drivers/test_tcpcloud.py
index f95e3dc..332b438 100644
--- a/os_faults/tests/unit/drivers/test_tcpcloud.py
+++ b/os_faults/tests/unit/drivers/test_tcpcloud.py
@@ -251,7 +251,8 @@ class TCPCloudManagementTestCase(test.TestCase):
251 self.assertIsInstance(service, service_cls) 251 self.assertIsInstance(service, service_cls)
252 252
253 nodes = service.get_nodes() 253 nodes = service.get_nodes()
254 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 254 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
255 service_cls.GREP)
255 ansible_runner_inst.execute.assert_has_calls([ 256 ansible_runner_inst.execute.assert_has_calls([
256 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}), 257 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}),
257 mock.call(['tcp.local'], {'command': self.get_ips_cmd}), 258 mock.call(['tcp.local'], {'command': self.get_ips_cmd}),
@@ -327,7 +328,8 @@ class TcpServiceTestCase(test.TestCase):
327 328
328 service.restart() 329 service.restart()
329 330
330 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 331 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
332 service_cls.GREP)
331 ansible_runner_inst.execute.assert_has_calls([ 333 ansible_runner_inst.execute.assert_has_calls([
332 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}), 334 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}),
333 mock.call(['tcp.local'], {'command': self.get_ips_cmd}), 335 mock.call(['tcp.local'], {'command': self.get_ips_cmd}),
@@ -362,7 +364,8 @@ class TcpServiceTestCase(test.TestCase):
362 364
363 service.terminate() 365 service.terminate()
364 366
365 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 367 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
368 service_cls.GREP)
366 ansible_runner_inst.execute.assert_has_calls([ 369 ansible_runner_inst.execute.assert_has_calls([
367 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}), 370 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}),
368 mock.call(['tcp.local'], {'command': self.get_ips_cmd}), 371 mock.call(['tcp.local'], {'command': self.get_ips_cmd}),
@@ -397,7 +400,8 @@ class TcpServiceTestCase(test.TestCase):
397 400
398 service.start() 401 service.start()
399 402
400 cmd = 'bash -c "ps ax | grep \'{}\'"'.format(service_cls.GREP) 403 cmd = 'bash -c "ps ax | grep -v grep | grep \'{}\'"'.format(
404 service_cls.GREP)
401 ansible_runner_inst.execute.assert_has_calls([ 405 ansible_runner_inst.execute.assert_has_calls([
402 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}), 406 mock.call(['tcp.local'], {'command': self.get_nodes_cmd}),
403 mock.call(['tcp.local'], {'command': self.get_ips_cmd}), 407 mock.call(['tcp.local'], {'command': self.get_ips_cmd}),