diff --git a/keepercommander/vault.py b/keepercommander/vault.py index 0fa854f82..52a16489f 100644 --- a/keepercommander/vault.py +++ b/keepercommander/vault.py @@ -475,8 +475,7 @@ def export_schedule_field(value): # type: (dict) -> Optional[str] cron = value.get('cron') if isinstance(cron, str): comps = [x for x in cron.split(' ') if x] - if len(comps) >= 6: - comps = comps[1:6] + if comps: return ' '.join(comps) return '' diff --git a/unit-tests/test_importer.py b/unit-tests/test_importer.py index 19217776a..aaa203611 100644 --- a/unit-tests/test_importer.py +++ b/unit-tests/test_importer.py @@ -230,3 +230,13 @@ def test_schedule_parser(self): self.assertEqual(sc.get('type'), 'MONTHLY_BY_WEEKDAY') self.assertEqual(sc.get('weekday'), 'WEDNESDAY') self.assertEqual(sc.get('occurrence'), 'SECOND') + + def test_export_schedule_field_preserves_quartz_cron_seconds(self): + schedule = {"type": "CRON", "cron": "1 5 1 * * ?", "tz": "Etc/UTC"} + self.assertEqual(vault.TypedField.export_schedule_field(schedule), '1 5 1 * * ?') + + schedule = {"type": "CRON", "cron": "0 5 1 * * ?"} + self.assertEqual(vault.TypedField.export_schedule_field(schedule), '0 5 1 * * ?') + + schedule = {"type": "CRON", "cron": "5 1 * * ?"} + self.assertEqual(vault.TypedField.export_schedule_field(schedule), '5 1 * * ?')