Skip to main content

Implements parser for otopi machine dialog.

Project description

[![Build Status][travisimg]][travis]

# python-otopi-mdp

otopi Machine Dialog Parser for python

This module allows you automate installation process based on
[otopi](https://github.com/oVirt/otopi) installator.

# Requirements

```
otopi
```

# Usage

1. Set otopi environment to enable machine dialect

DIALOG/dialect=str:machine

2. Spawn desired installer and pass stdin and stdout to parser
3. Process all otopi events in the loop


## Example for oVirt Hosted Engine

```python
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)
```

[githubissues]: https://github.com/rhevm-qe-automation/python-otopi-mdp/issues
[travisimg]: https://travis-ci.org/rhevm-qe-automation/python-otopi-mdp.svg?branch=master
[travis]: https://travis-ci.org/rhevm-qe-automation/python-otopi-mdp

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.1.1.zip (20.4 kB view hashes)

Uploaded Source

Built Distributions

python_otopi_mdp-0.1.1-py2.7.egg (9.9 kB view hashes)

Uploaded Source

python-otopi-mdp-0.1.1-1.src.rpm (23.3 kB view hashes)

Uploaded Source

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