diff --git a/jc/parsers/rsync.py b/jc/parsers/rsync.py
index fbaf9373..02adbe03 100644
--- a/jc/parsers/rsync.py
+++ b/jc/parsers/rsync.py
@@ -25,25 +25,34 @@ Schema:
[
{
- "type": string, # 'item' or 'summary'
- "filename": string,
- "metadata": string,
- "update_type": string/null,
- "file_type": string/null,
- "checksum_or_value_different": bool/null,
- "size_different": bool/null,
- "modification_time_different": bool/null,
- "permissions_different": bool/null,
- "owner_different": bool/null,
- "group_different": bool/null,
- "future": null,
- "acl_different": bool/null,
- "extended_attribute_different": bool/null,
- "sent": integer, # need to convert
- "received": integer, # need to convert
- "bytes_sec": float, # need to convert
- "total_size": integer, # need to convert
- "speedup": float, # need to convert
+ "summary": {
+ "date": string,
+ "time": string,
+ "process": integer, # need to convert
+ "sent": integer, # need to convert
+ "received": integer, # need to convert
+ "total_size": integer # need to convert
+ },
+ "items": [
+ "filename": string,
+ "metadata": string,
+ "update_type": string/null,
+ "file_type": string/null,
+ "checksum_or_value_different": bool/null,
+ "size_different": bool/null,
+ "modification_time_different": bool/null,
+ "permissions_different": bool/null,
+ "owner_different": bool/null,
+ "group_different": bool/null,
+ "future": null,
+ "acl_different": bool/null,
+ "extended_attribute_different": bool/null,
+ "sent": integer, # need to convert
+ "received": integer, # need to convert
+ "bytes_sec": float, # need to convert
+ "total_size": integer, # need to convert
+ "speedup": float, # need to convert
+ ]
}
]
@@ -85,14 +94,14 @@ def _process(proc_data: List[Dict]) -> List[Dict]:
List of Dictionaries. Structured to conform to the schema.
"""
- int_list = ['sent', 'received', 'total_size']
- float_list = ['bytes_sec', 'speedup']
- for entry in proc_data:
- for key in entry:
- if key in int_list:
- entry[key] = jc.utils.convert_to_int(entry[key])
- if key in float_list:
- entry[key] = jc.utils.convert_to_float(entry[key])
+ # int_list = ['sent', 'received', 'total_size']
+ # float_list = ['bytes_sec', 'speedup']
+ # for entry in proc_data:
+ # for key in entry:
+ # if key in int_list:
+ # entry[key] = jc.utils.convert_to_int(entry[key])
+ # if key in float_list:
+ # entry[key] = jc.utils.convert_to_float(entry[key])
return proc_data
@@ -119,6 +128,9 @@ def parse(
jc.utils.input_type_check(data)
raw_output: List = []
+ rsync_run: Dict = {}
+
+ last_process = ''
update_type = {
'<': 'file sent',
@@ -189,26 +201,35 @@ def parse(
'+': None
}
- summary = {}
-
if jc.utils.has_data(data):
+ rsync_run.update({
+ 'summary': {},
+ 'items': []
+ })
- file_line_re = re.compile(r'(?P^[<>ch.*][fdlDS][c.+][s.+][t.+][p.+][o.+][g.+][u.+][a.+][x.+]) (?P.+)')
+ file_line_re = re.compile(r'(?P[<>ch.*][fdlDS][c.+][s.+][t.+][p.+][o.+][g.+][u.+][a.+][x.+]) (?P.+)')
stat1_line_re = re.compile(r'(sent)\s+(?P[0-9,]+)\s+(bytes)\s+(received)\s+(?P[0-9,]+)\s+(bytes)\s+(?P[0-9,.]+)\s+(bytes/sec)')
stat2_line_re = re.compile(r'(total size is)\s+(?P[0-9,]+)\s+(speedup is)\s+(?P[0-9,.]+)')
+ file_line_log_re = re.compile(r'(?P\d\d\d\d/\d\d/\d\d)\s+(?P