eva-shell 0.2.34__tar.gz → 0.2.36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.34
3
+ Version: 0.2.36
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,3 +1,3 @@
1
- __version__ = '0.2.34'
1
+ __version__ = '0.2.36'
2
2
 
3
3
  DEFAULT_REPOSITORY_URL = 'https://pub.bma.ai/eva4'
@@ -481,6 +481,10 @@ def append_svc_cli(root_sp):
481
481
  metavar='FILE',
482
482
  help='read call params payload form the file ("-" for stdin)'
483
483
  ).completer = ComplDeployFile()
484
+ p.add_argument('-o', '--output', metavar='FILE', help='output file')
485
+ p.add_argument('--passthrough',
486
+ action='store_true',
487
+ help='do not unpack the result (requires the output file)')
484
488
  p.add_argument('method', metavar='METHOD').completer = ComplSvcRpcMethod()
485
489
  p.add_argument(
486
490
  'params',
@@ -1195,8 +1199,8 @@ def append_generator_cli(root_sp):
1195
1199
  p.add_argument('kind', choices=source_types)
1196
1200
  p.add_argument('-s',
1197
1201
  '--sampling',
1198
- default=1,
1199
- type=int,
1202
+ default=1.0,
1203
+ type=float,
1200
1204
  help='Sampling frequency')
1201
1205
  p.add_argument('--target',
1202
1206
  action='append',
@@ -1215,8 +1219,8 @@ def append_generator_cli(root_sp):
1215
1219
  p.add_argument('kind', choices=source_types)
1216
1220
  p.add_argument('-s',
1217
1221
  '--sampling',
1218
- default=1,
1219
- type=int,
1222
+ default=1.0,
1223
+ type=float,
1220
1224
  help='Sampling frequency')
1221
1225
  p.add_argument('-d',
1222
1226
  '--duration',
@@ -1246,8 +1250,8 @@ def append_generator_cli(root_sp):
1246
1250
  p.add_argument('kind', choices=source_types)
1247
1251
  p.add_argument('-s',
1248
1252
  '--sampling',
1249
- default=1,
1250
- type=int,
1253
+ default=1.0,
1254
+ type=float,
1251
1255
  help='Sampling frequency')
1252
1256
  p.add_argument('--target', action='append', help='target OID')
1253
1257
  p.add_argument('--start', required=True, help='Starting time')
@@ -669,7 +669,14 @@ class CLI:
669
669
  call_rpc('svc.purge', dict(svcs=[i]))
670
670
  ok()
671
671
 
672
- def svc_call(self, i, file, method, params, trace=False):
672
+ def svc_call(self,
673
+ i,
674
+ file,
675
+ output,
676
+ passthrough,
677
+ method,
678
+ params,
679
+ trace=False):
673
680
  if file:
674
681
  import yaml
675
682
  payload = yaml.safe_load(read_file(file))
@@ -678,11 +685,22 @@ class CLI:
678
685
  for p in params:
679
686
  n, v = p.split('=', 1)
680
687
  payload[n] = format_value(v, advanced=True, name=n)
688
+ if passthrough and not output:
689
+ raise ValueError(
690
+ 'output file is required when passthrought is enabled')
681
691
  result = call_rpc(method,
682
692
  payload if payload else None,
683
693
  target=i,
684
- trace=trace)
685
- if current_command.json or isinstance(result, list):
694
+ trace=trace,
695
+ unpack_result=not passthrough)
696
+ if passthrough:
697
+ write_file(output, result, mode='wb')
698
+ ok()
699
+ elif output:
700
+ import json
701
+ write_file(output, json.dumps(result, indent=4, sort_keys=True))
702
+ ok()
703
+ elif current_command.json or isinstance(result, list):
686
704
  print_result(result)
687
705
  elif isinstance(result, dict):
688
706
  print_result(result, name_value=True)
@@ -19,6 +19,7 @@ DEFAULT_GENERATOR_SERVICE = 'eva.generator.default'
19
19
  DEFAULT_ACCOUNTING_SERVICE = 'eva.aaa.accounting'
20
20
  DEFAULT_ALARM_SERVICE = 'eva.alarm.default'
21
21
 
22
+
22
23
  def print_trace_msg(msg):
23
24
  level = msg['l']
24
25
  print('[', end='')
@@ -53,7 +54,7 @@ def connect():
53
54
  common.rpc.on_frame = on_frame
54
55
 
55
56
 
56
- def call_rpc(method, params=None, target='eva.core', trace=False):
57
+ def call_rpc(method, params=None, target='eva.core', trace=False, unpack_result=True):
57
58
  common.bus_conn_no += 1
58
59
  connect()
59
60
  if current_command.debug:
@@ -85,5 +86,7 @@ def call_rpc(method, params=None, target='eva.core', trace=False):
85
86
  print()
86
87
  if result.is_empty():
87
88
  return None
88
- else:
89
+ elif unpack_result:
89
90
  return unpack(result.get_payload())
91
+ else:
92
+ return result.get_payload()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.34
3
+ Version: 0.2.36
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,4 +1,4 @@
1
- __version__ = '0.2.34'
1
+ __version__ = '0.2.36'
2
2
 
3
3
  import setuptools
4
4
 
File without changes
File without changes
File without changes
File without changes