Пример #1
0
def do_request(logger, conf, local):
    logger.info('Requesting %s as instance of %s...',
                conf.reference, conf.software_url)

    conf.software_url = _getSoftwareReleaseFromSoftwareString(
        logger, conf.software_url, local['product'])

    if conf.software_url in local:
        conf.software_url = local[conf.software_url]
    try:
        partition = local['slap'].registerOpenOrder().request(
            software_release=conf.software_url,
            partition_reference=conf.reference,
            partition_parameter_kw=conf.parameters,
            software_type=conf.type,
            filter_kw=conf.node,
            state=conf.state,
            shared=conf.slave
        )
        logger.info('Instance requested.\nState is : %s.', partition.getState())
        logger.info('Connection parameters of instance are:')
        logger.info(pprint.pformat(partition.getConnectionParameterDict()))
        logger.info('You can rerun the command to get up-to-date information.')
    except ResourceNotReady:
        logger.warning('Instance requested. Master is provisioning it. Please rerun in a '
                       'couple of minutes to get connection information.')
        exit(2)
Пример #2
0
def do_supply(logger, software_release, computer_id, local):
    """
    Request installation of Software Release
    'software_release' on computer 'computer_id'.
    """
    logger.info('Requesting software installation of %s...',
                software_release)

    software_release = _getSoftwareReleaseFromSoftwareString(
        logger, software_release, local['product'])

    local['supply'](
        software_release=software_release,
        computer_guid=computer_id,
        state='available'
    )
    logger.info('Done.')