Exemple #1
0
def create_initial_state(event: "ReadyEvent"):
    try:
        LOG.info("Uploading our DAR...")
        event.client.ensure_dar(PostOffice)

        LOG.info("DAR uploaded. Creating the initial postman role contract...")
        return CreateCommand("Main:PostmanRole", dict(postman=event.party))
    except:
        LOG.exception("Failed to set up our initial state!")
def create_initial_state(event: 'ReadyEvent'):
    try:
        LOG.info('Uploading our DAR...')
        event.client.ensure_dar(PostOffice)
        while not event.package_store.resolve_template('Main:PostmanRole'):
            logging.info("Waiting for our DAR to be uploaded...")
            sleep(1)

        LOG.info('DAR uploaded. Creating the initial postman role contract...')
        return create('Main:PostmanRole', dict(postman=event.party))
    except:
        LOG.exception('Failed to set up our initial state!')