Skip to main content

Implements parser for otopi machine dialog.

Project description

Build Status Code Coverage Code Health

python-otopi-mdp

otopi Machine Dialog Parser for python

This module allows you automate installation process based on otopi installator.

Requirements

six
otopi

WARNING: The otopi package is not hosted on PyPi site, so it couldn’t be included as dependency of this package. It is maintaned by oVirt community, they ship this module for several package managements.

Usage

  1. Set otopi environment to enable machine dialect

DIALOG/dialect=str:machine
  1. Spawn desired installer and pass stdin and stdout to parser

  2. Process all otopi events in the loop

Example for oVirt Hosted Engine

import subprocess
import otopimdp as mdp

# 1. Set machine dialog option
with open("/etc/ovirt-hosted-engine-setup.env.d/mycustom.env") as fd:
    fd.write(
        'export environment="${environment} DIALOG/dialect=str:machine"\n'
    )

# 2. Spawn installer
installer = subprocess.Popen(["hosted-engine", "--deploy"])
parser = mdp.MachineDialogParser(
    input_=installer.stdout, output=installer.stdin
)

# 3. Process events
while True:
    event = parser.next_event()
    if event is None:
        continue
    event_type = event[mdp.TYPE_KEY]
    if event_type == mdp.TERMINATE_EVENT:
        break

    event_name = event[mdp.ATTRIBUTES_KEY]['name']
    if event_name == "OVEHOSTED_HOST_ID":
        event[mdp.REPLY_KEY] = "1"
    ....
    parser.send_response(event)

Run tests

tox

NOTE: For testing purposes, the otopi package is being run from sources.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-otopi-mdp-0.2.2.zip (25.9 kB view details)

Uploaded Source

Built Distributions

python_otopi_mdp-0.2.2-py2.7.egg (16.0 kB view details)

Uploaded Source

python-otopi-mdp-0.2.2-1.src.rpm (26.8 kB view details)

Uploaded Source

python-otopi-mdp-0.2.2-1.noarch.rpm (22.0 kB view details)

Uploaded Source

File details

Details for the file python-otopi-mdp-0.2.2.zip.

File metadata

File hashes

Hashes for python-otopi-mdp-0.2.2.zip
Algorithm Hash digest
SHA256 91d785fd8a69e2841fc7d2b13fd9fd63ad6bd41717ed6d8f039450eb36c5755e
MD5 71671dedd7e9cd6fd5c8dc5cee1fb819
BLAKE2b-256 fcd8b22474ba35f26a9b6847f3ea90959d20c9b42dc8bf1caf8592689befdb43

See more details on using hashes here.

Provenance

File details

Details for the file python_otopi_mdp-0.2.2-py2.7.egg.

File metadata

File hashes

Hashes for python_otopi_mdp-0.2.2-py2.7.egg
Algorithm Hash digest
SHA256 922a7476e489c58f91efa81b2d13b55c0b972780ac7874e2042003e59ccd20c4
MD5 59008b7cb13120030747f9ae0a44f541
BLAKE2b-256 7b252339c0cc9aa8b072780a9019fb880f7140bb8b1e2b636e24b51546ed82bc

See more details on using hashes here.

Provenance

File details

Details for the file python-otopi-mdp-0.2.2-1.src.rpm.

File metadata

File hashes

Hashes for python-otopi-mdp-0.2.2-1.src.rpm
Algorithm Hash digest
SHA256 08fb13bc27722d62457e0b6f624d167c1dcc9d0103a0b31aec05aafd3ddb18ce
MD5 bcb8a9a81d8604687c3bdeb0ab04fc69
BLAKE2b-256 24139a964e6a92b3ba4fec8b362df8a5919ebb3d604fe834931d8be4feac6286

See more details on using hashes here.

Provenance

File details

Details for the file python-otopi-mdp-0.2.2-1.noarch.rpm.

File metadata

File hashes

Hashes for python-otopi-mdp-0.2.2-1.noarch.rpm
Algorithm Hash digest
SHA256 c715c885e2552967369cd84437cba9b0de089ff66939755d88091b6801a8f2f9
MD5 03c752861a802a396aba9d9c990f2d93
BLAKE2b-256 22164e9e4adff80facca2742c5ce7c3d96bc386ad7663bd4e42a8474407ba046

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page