Merge pull request #2087 from KPrasch/playground

Restore Alice and Bob Init via CLI
pull/2090/head
K Prasch 2020-06-10 10:25:11 -07:00 committed by GitHub
commit 9f15fb7942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 11 deletions

View File

@ -330,7 +330,7 @@ def config(general_config, config_file, full_config_options):
emitter = setup_emitter(general_config)
if not config_file:
config_file = select_config_file(emitter=emitter,
checksum_address=full_config_options.pay_with,
checksum_address=full_config_options.config_options.pay_with,
config_class=AliceConfiguration)
updates = full_config_options.get_updates()
get_or_update_configuration(emitter=emitter,

View File

@ -73,7 +73,7 @@ class BobConfigOptions:
self.provider_uri = provider_uri
self.signer_uri = signer_uri
self.gas_strategy = gas_strategy,
self.gas_strategy = gas_strategy
self.domains = {network} if network else None
self.registry_filepath = registry_filepath
self.checksum_address = checksum_address
@ -116,6 +116,7 @@ class BobConfigOptions:
checksum_address = self.checksum_address
if not checksum_address and not self.federated_only:
checksum_address = select_client_account(emitter=emitter,
signer_uri=self.signer_uri,
provider_uri=self.provider_uri) # TODO: See #1888
return BobConfiguration.generate(

View File

@ -174,13 +174,17 @@ class UrsulaConfigOptions:
def generate_config(self, emitter, config_root, force):
assert not self.dev # TODO: Raise instead
if self.dev:
raise RuntimeError('Persistent configurations cannot be created in development mode.')
worker_address = self.worker_address
if (not worker_address) and not self.federated_only:
if not worker_address:
prompt = "Select worker account"
worker_address = select_client_account(emitter=emitter, prompt=prompt, provider_uri=self.provider_uri, signer_uri=self.signer_uri)
worker_address = select_client_account(emitter=emitter,
prompt=prompt,
provider_uri=self.provider_uri,
signer_uri=self.signer_uri)
rest_host = self.rest_host
if not rest_host:
@ -258,8 +262,11 @@ class UrsulaCharacterOptions:
def create_character(self, emitter, config_file, json_ipc, load_seednodes=True):
# TODO: embed compatibility layer?
ursula_config = self.config_options.create_config(emitter, config_file)
is_clef = ClefSigner.is_valid_clef_uri(self.config_options.signer_uri)
# TODO: Oh
client_password = None
if not ursula_config.federated_only:
if not self.config_options.dev and not json_ipc and not is_clef:

View File

@ -88,13 +88,9 @@ def make_cli_character(character_config,
#
# Produce Character
try:
CHARACTER = character_config(known_nodes=teacher_nodes,
network_middleware=character_config.network_middleware,
**config_args)
except (CryptoError, ValueError):
raise character_config.keyring.AuthenticationFailed(f"Failed to unlock nucypher keyring. "
"Are you sure you provided the correct password?")
CHARACTER = character_config(known_nodes=teacher_nodes,
network_middleware=character_config.network_middleware,
**config_args)
#
# Post-Init