Fix in test_etc_hosts
diff --git a/cvp_checks/tests/test_etc_hosts.py b/cvp_checks/tests/test_etc_hosts.py
index 72581c0..1db29c8 100644
--- a/cvp_checks/tests/test_etc_hosts.py
+++ b/cvp_checks/tests/test_etc_hosts.py
@@ -1,12 +1,15 @@
import pytest
import json
+import os
+from cvp_checks import utils
def test_etc_hosts(local_salt_client):
+ active_nodes = utils.get_active_nodes()
nodes_info = local_salt_client.cmd(
- '*', 'cmd.run',
- ['cat /etc/hosts']
- )
+ utils.list_to_target_string(active_nodes, 'or'), 'cmd.run',
+ ['cat /etc/hosts'],
+ expr_form='compound')
result = {}
for node in nodes_info.keys():
for nd in nodes_info.keys():
diff --git a/cvp_checks/utils/__init__.py b/cvp_checks/utils/__init__.py
index 746b5bf..83b867d 100644
--- a/cvp_checks/utils/__init__.py
+++ b/cvp_checks/utils/__init__.py
@@ -40,7 +40,7 @@
result = ''
for node in node_list:
result += node + ' ' + separator + ' '
- return result.strip(' ' + separator + ' ')
+ return result[:-(len(separator)+2)]
def get_monitoring_ip(param_name):
@@ -62,7 +62,6 @@
testname = test.split('.')[0]
if 'skipped_nodes' in config.get(testname).keys():
skipped_nodes += config.get(testname)['skipped_nodes'] or []
-
if skipped_nodes != ['']:
print "\nNotice: {0} nodes will be skipped".format(skipped_nodes)
nodes = local_salt_client.cmd(