Get group fix,flake8 errors fix,readme and config fix
diff --git a/cvp_checks/utils/__init__.py b/cvp_checks/utils/__init__.py
index 85f5a61..4475683 100644
--- a/cvp_checks/utils/__init__.py
+++ b/cvp_checks/utils/__init__.py
@@ -2,19 +2,25 @@
import yaml
import requests
import re
-import pytest
+
class salt_remote:
- def cmd(self, tgt, fun, param=None,expr_form=None,tgt_type=None):
+ def cmd(self, tgt, fun, param=None, expr_form=None, tgt_type=None):
config = get_configuration()
- headers = {'Accept':'application/json'}
- login_payload = {'username':config['SALT_USERNAME'],'password':config['SALT_PASSWORD'],'eauth':'pam'}
- accept_key_payload = {'fun': fun,'tgt':tgt,'client':'local','expr_form':expr_form,'tgt_type':tgt_type}
+ headers = {'Accept': 'application/json'}
+ login_payload = {'username': config['SALT_USERNAME'],
+ 'password': config['SALT_PASSWORD'], 'eauth': 'pam'}
+ accept_key_payload = {'fun': fun, 'tgt': tgt, 'client': 'local',
+ 'expr_form': expr_form, 'tgt_type': tgt_type}
if param:
- accept_key_payload['arg']=param
+ accept_key_payload['arg'] = param
- login_request = requests.post(os.path.join(config['SALT_URL'],'login'),headers=headers,data=login_payload)
- request = requests.post(config['SALT_URL'],headers=headers,data=accept_key_payload,cookies=login_request.cookies)
+ login_request = requests.post(os.path.join(config['SALT_URL'],
+ 'login'),
+ headers=headers, data=login_payload)
+ request = requests.post(config['SALT_URL'], headers=headers,
+ data=accept_key_payload,
+ cookies=login_request.cookies)
return request.json()['return'][0]
@@ -40,12 +46,12 @@
if 'skipped_nodes' in config.get(testname).keys():
skipped_nodes += config.get(testname)['skipped_nodes'] or []
- if skipped_nodes:
+ if skipped_nodes != ['']:
print "\nNotice: {0} nodes will be skipped".format(skipped_nodes)
nodes = local_salt_client.cmd(
- '* and not '+list_to_target_string(skipped_nodes, 'and not'),
- 'test.ping',
- expr_form='compound')
+ '* and not ' + list_to_target_string(skipped_nodes, 'and not'),
+ 'test.ping',
+ expr_form='compound')
else:
nodes = local_salt_client.cmd('*', 'test.ping')
return nodes
@@ -76,8 +82,8 @@
if group_name not in skipped_groups:
groups.append(group_name)
else:
- if group_name+" - skipped" not in groups:
- groups.append(group_name+" - skipped")
+ if group_name + " - skipped" not in groups:
+ groups.append(group_name + " - skipped")
return groups
@@ -92,10 +98,10 @@
for param in global_config.keys():
if param in os.environ.keys():
if ',' in os.environ[param]:
- global_config[param]=[]
+ global_config[param] = []
for item in os.environ[param].split(','):
global_config[param].append(item)
else:
- global_config[param]=os.environ[param]
+ global_config[param] = os.environ[param]
return global_config