Deprecate unused helpers

get_yaml_to_json
put_json_on_remote_from_dict

Change-Id: I45d5b963aa3d3aad1ef52ebcdab14feb462b77f8
This commit is contained in:
Alexey Stepanov 2016-08-29 13:29:42 +03:00
parent 1e09aed3e1
commit 041b8ea904
2 changed files with 28 additions and 8 deletions

View File

@ -54,6 +54,13 @@ from gates_tests.helpers import exceptions
@logwrap
def get_yaml_to_json(node_ssh, filename):
msg = (
'get_yaml_to_json helper is unused in fuel-qa and planned '
'for deletion on 14.09.2016')
warn(msg, DeprecationWarning)
traceback.print_stack()
logger.critical(msg)
cmd = ("python -c 'import sys, yaml, json; json.dump("
"yaml.load(sys.stdin),"
" sys.stdout)' < {0}").format(filename)
@ -69,6 +76,13 @@ def get_yaml_to_json(node_ssh, filename):
@logwrap
def put_json_on_remote_from_dict(remote, src_dict, cluster_id):
msg = (
'put_json_on_remote_from_dict helper is unused in fuel-qa and planned '
'for deletion on 14.09.2016')
warn(msg, DeprecationWarning)
traceback.print_stack()
logger.critical(msg)
cmd = ('python -c "import json; '
'data=json.dumps({0}); print data"').format(src_dict)
result = remote.execute(
@ -538,6 +552,11 @@ def json_deserialize(json_string):
:return: obj
:raise: Exception
"""
msg = (
'put_json_on_remote_from_dict helper is unused in fuel-qa and planned '
'for deletion on 14.09.2016')
warn(msg, DeprecationWarning)
logger.critical(msg)
if isinstance(json_string, list):
json_string = ''.join(json_string)
@ -1116,12 +1135,11 @@ def get_package_versions_from_node(ip, name, os_type):
@logwrap
def get_file_size(ip, file_name, file_path):
# Moved from checkers.py for improvement of code
file_size = SSHManager().execute(
ip, 'stat -c "%s" {0}/{1}'.format(file_path, file_name))
assert_equal(
int(file_size['exit_code']), 0, "Failed to get '{0}/{1}' file stats on"
" remote node".format(file_path,
file_name))
file_size = SSHManager().check_call(
ip, 'stat -c "%s" {0}/{1}'.format(file_path, file_name),
error_info="Failed to get '{0}/{1}' file stats on"
" remote node".format(file_path, file_name)
)
return int(file_size['stdout'][0].rstrip())

View File

@ -159,8 +159,10 @@ class TestMultipleClusterNets(TestNetworkTemplatesBase):
# need to push to remote
self.show_step(8)
utils.put_json_on_remote_from_dict(
remote, updated_network, cluster_id)
with remote.open(
'/var/log/network_{0}.json'.format(cluster_id),
mode='w') as file_obj:
json.dump(updated_network, file_obj)
check_update_network_data_over_cli(self.ssh_manager.admin_ip,
cluster_id,