MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / execute

Method execute

keepercommander/commands/utils.py:2246–2271  ·  view source on GitHub ↗
(self, params, **kwargs)

Source from the content-addressed store, hash-verified

2244
2245class DeleteCorruptedCommand(Command):
2246 def execute(self, params, **kwargs):
2247 bad_records = set()
2248 for record_uid in params.record_cache:
2249 record = params.record_cache[record_uid]
2250 if not record.get('data_unencrypted'):
2251 if record_uid in params.record_owner_cache:
2252 own = params.record_owner_cache[record_uid]
2253 if own.owner is True:
2254 bad_records.add(record_uid)
2255 if len(bad_records) > 0:
2256 uc = user_choice('Do you want to delete {0} corrupted records?'.format(len(bad_records)), 'yn', default='n')
2257 if uc.lower() == 'y':
2258 request = {
2259 'command': 'record_update',
2260 'delete_records': list(bad_records)
2261 }
2262 logging.info('Deleting %s records from Keeper', len(params.record_cache))
2263 response_json = api.communicate(params, request)
2264 success = [info for info in response_json['delete_records'] if info['status'] == 'success']
2265 if len(success) > 0:
2266 logging.info("%s records deleted successfully", len(success))
2267 failures = [info for info in response_json['delete_records'] if info['status'] != 'success']
2268 if len(failures) > 0:
2269 logging.warning("%s records failed to delete", len(failures))
2270 else:
2271 logging.info('No corrupted records are found.')
2272
2273
2274class GenerateCommand(Command):

Callers

nothing calls this directly

Calls 7

user_choiceFunction · 0.85
formatMethod · 0.80
communicateMethod · 0.80
warningMethod · 0.80
getMethod · 0.45
addMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected