Ensure deployer CLI can resume a deployment by using --contract-name single contract deployments. Increase Deployer timeout to 600 seconds.

pull/1124/head
Kieran Prasch 2019-07-22 17:43:36 -07:00
parent 30aa51c1f2
commit db7d1944da
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
3 changed files with 28 additions and 26 deletions

View File

@ -218,7 +218,7 @@ class DeployerActor(NucypherTokenActor):
return Deployer
@staticmethod
def __collect_deployment_secret(deployer) -> str:
def collect_deployment_secret(deployer) -> str:
secret = click.prompt(f'Enter {deployer.contract_name} Deployment Secret',
hide_input=True,
confirmation_prompt=True)
@ -227,7 +227,7 @@ class DeployerActor(NucypherTokenActor):
def collect_deployment_secrets(self) -> dict:
secrets = dict()
for deployer in self.upgradeable_deployer_classes:
secrets[deployer.contract_name] = self.__collect_deployment_secret(deployer)
secrets[deployer.contract_name] = self.collect_deployment_secret(deployer)
return secrets
def deploy_contract(self,

View File

@ -455,6 +455,7 @@ class BlockchainInterface:
class BlockchainDeployerInterface(BlockchainInterface):
TIMEOUT = 600 # seconds
_contract_factory = Contract
class NoDeployerAddress(RuntimeError):

View File

@ -171,6 +171,31 @@ def deploy(action,
elif action == "contracts":
#
# Deploy Single Contract
#
if contract_name:
try:
contract_deployer = deployer.deployers[contract_name]
except KeyError:
message = f"No such contract {contract_name}. Available contracts are {deployer.deployers.keys()}"
click.secho(message, fg='red', bold=True)
raise click.Abort()
else:
click.secho(f"Deploying {contract_name}")
if contract_deployer._upgradeable:
secret = deployer.collect_deployment_secret(deployer=contract_deployer)
receipts, agent = deployer.deploy_contract(contract_name=contract_name, plaintext_secret=secret)
else:
receipts, agent = deployer.deploy_contract(contract_name=contract_name)
paint_contract_deployment(contract_name=contract_name,
contract_address=agent.contract_address,
receipts=receipts)
if ETH_NODE:
ETH_NODE.stop()
return
registry_filepath = deployer.blockchain.registry.filepath
if os.path.isfile(registry_filepath):
click.secho(f"\nThere is an existing contract registry at {registry_filepath}.\n"
@ -179,30 +204,6 @@ def deploy(action,
click.confirm(f"Confirm deletion of contract registry '{registry_filepath}'?", abort=True)
os.remove(registry_filepath)
#
# Deploy Single Contract
#
if contract_name:
deployment_secret = click.prompt(f"Enter deployment secret for {contract_name}", confirmation_prompt=True)
try:
deployer.deployers[contract_name]
except KeyError:
message = f"No such contract {contract_name}. Available contracts are {deployer.deployers.keys()}"
click.secho(message, fg='red', bold=True)
raise click.Abort()
else:
# Deploy single contract
receipts, agent = deployer.deploy_contract(contract_name=contract_name,
plaintext_secret=deployment_secret)
paint_contract_deployment(contract_name=contract_name,
contract_address=agent.contract_address,
receipts=receipts)
if ETH_NODE:
ETH_NODE.stop()
return
#
# Stage Deployment
#