Sync full or partial data down to the client
(params, record_types=False)
| 25 | |
| 26 | |
| 27 | def sync_down(params, record_types=False): # type: (KeeperParams, bool) -> None |
| 28 | """Sync full or partial data down to the client""" |
| 29 | |
| 30 | # Use spinner animation for full sync (only in interactive mode, not batch/automation). |
| 31 | # WARNING: stop() MUST be guaranteed via finally. A leaked spinner thread keeps |
| 32 | # '\r'-overwriting the current console row for the rest of the session, erasing |
| 33 | # lines of any large output printed later - notably base64 KSM config tokens |
| 34 | # (`pam project import` / `pam gateway new` access_token), which then reach the |
| 35 | # user silently corrupted. |
| 36 | spinner = None |
| 37 | if not params.sync_down_token and not params.batch_mode: |
| 38 | spinner = Spinner('Syncing...') |
| 39 | spinner.start() |
| 40 | try: |
| 41 | _sync_down_impl(params, record_types) |
| 42 | finally: |
| 43 | if spinner: |
| 44 | spinner.stop() |
| 45 | |
| 46 | |
| 47 | def _sync_down_impl(params, record_types=False): # type: (KeeperParams, bool) -> None |