do not convert to json any more
This commit is contained in:
parent
6a5343f663
commit
baff78069c
|
@ -36,10 +36,4 @@ version: {version}"""
|
|||
self.allow_insecure_https = config.get('allow_insecure_https', False)
|
||||
|
||||
|
||||
TO_JSON = {'session.server.get': ['content'],
|
||||
'session.servermodel.get': ['content'],
|
||||
'server.describe': ['configuration'],
|
||||
'server.exec.describe': ['return']}
|
||||
|
||||
|
||||
config = Config()
|
||||
|
|
|
@ -5,7 +5,6 @@ from json import loads
|
|||
from tiramisu_cmdline_parser import TiramisuCmdlineParser
|
||||
from argparse import RawDescriptionHelpFormatter
|
||||
|
||||
from .config import TO_JSON
|
||||
from .common import Common, send_data
|
||||
|
||||
|
||||
|
@ -29,28 +28,13 @@ class Parser(Common):
|
|||
parser.parse_args()
|
||||
|
||||
def get(self):
|
||||
def _to_json(res):
|
||||
for key, value in res.items():
|
||||
if key in TO_JSON[message]:
|
||||
res[key] = loads(value)
|
||||
|
||||
# get current message
|
||||
message = self.remote_config.option('message').value.get()
|
||||
payload = self.get_payload(message)
|
||||
# send message
|
||||
result = send_data(message,
|
||||
return send_data(message,
|
||||
payload)
|
||||
|
||||
# convert some results (file) to json
|
||||
if message in TO_JSON:
|
||||
if isinstance(result, list):
|
||||
for res in result:
|
||||
_to_json(res)
|
||||
else:
|
||||
_to_json(result)
|
||||
|
||||
return result
|
||||
|
||||
def get_payload(self,
|
||||
message: str):
|
||||
# remove symlinkoption and default value from payload
|
||||
|
|
Loading…
Reference in New Issue