def cleanup_on_failure(): cleanup_syndicate() if stored_private_key: keys.delete_private_key_from_volume( email, volume=vol ) if stored_private_key_locally: keys.delete_private_key( email ) if stored_public_key: keys.delete_public_key( email ) if stored_volume_public_key: delete_volume_pubkey( existing_volume_name ) if stored_syndicate_account_name: delete_syndicate_user_id( vol )
have_data = False if syndicate_user_verifykey_str is None: log.error("Need Syndicate user public (verifying) key to delete gateway and volume") have_data = False if have_data: gateway_name = read_gateway_name() # delete the gateway rc = delete_gateway( syndicate_user_id, syndicate_user_privkey_str, syndicate_user_verifykey_str, MS_url( parsed_email.MS, nossl=test ), gateway_name ) if not rc: log.critical("!!! Failed to delete gateway %s !!!" % gateway_name ) keys.delete_private_key_from_volume( email ) keys.delete_private_key( email ) keys.delete_public_key( email ) delete_gateway_name() delete_gateway_port() return True # ------------------------------------- def read_account_volume_pubkey( email_addr, storage_root=None ): try: email_addr_parsed = contact.parse_addr( email_addr ) except: log.error("Invalid email address %s" % email_addr) return None