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 Distributions

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

Uploaded Source

python-otopi-mdp-0.2.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for python-otopi-mdp-0.2.1.zip
Algorithm Hash digest
SHA256 7210c5236af6da792b06a3e74199153fda847b7bebfdd4a8fd2f7b5758404a4d
MD5 ff146fcb9b1abfac9f615ea9b3e2ba01
BLAKE2b-256 065ba533937677154d0d4147af290c196c12c21a8e451e99008e05387f154792

See more details on using hashes here.

Provenance

File details

Details for the file python-otopi-mdp-0.2.1.tar.gz.

File metadata

File hashes

Hashes for python-otopi-mdp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 389c79bad851b6c70cd32a3cbd9ff99c4edac2605b05e3407da8fa008dde3afe
MD5 5681c4605f00fcdf463a44029bb59126
BLAKE2b-256 0c9e44f99e0160c55df9076ef8df0c089d25c30948eefb7a328985194c385dd0

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for python_otopi_mdp-0.2.1-py2.7.egg
Algorithm Hash digest
SHA256 79c50f36b51fe2d36920fdea3a9b1f0c429066570c398f32c8071b99ad80f20f
MD5 21d71d1430743b587ba9a5a1df551fb4
BLAKE2b-256 58513908035a25cf76fd3c3821f8479bd275e5518fd496dc982c2ad6d68df250

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