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
# 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 details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
python-otopi-mdp-0.1.1-1.src.rpm
(23.3 kB
view details)
File details
Details for the file python-otopi-mdp-0.1.1.zip.
File metadata
- Download URL: python-otopi-mdp-0.1.1.zip
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a11d9b518256bcc16de3439bbac79f3f5b0b3c3edfb0812696b78bbaada2611f
|
|
| MD5 |
a3ae5f9712ef1b385ae2b8a83bc6a226
|
|
| BLAKE2b-256 |
0a97e90780f2899198420c3adedfd4200601b5d1dc5052294c12bf591e4c51fb
|
File details
Details for the file python_otopi_mdp-0.1.1-py2.7.egg.
File metadata
- Download URL: python_otopi_mdp-0.1.1-py2.7.egg
- Upload date:
- Size: 9.9 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b3b5e0d3245a84a9fe0bacf0ea3ce8f8fec15bf26d65bd75de5fb8f7e5ab0c6
|
|
| MD5 |
cd94494329e205e8520d36310196d8f0
|
|
| BLAKE2b-256 |
fe34826827eb950528dd4b89073e5cefefbca7f211ba7fd043f6cbfbeffcb889
|
File details
Details for the file python-otopi-mdp-0.1.1-1.src.rpm.
File metadata
- Download URL: python-otopi-mdp-0.1.1-1.src.rpm
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12095846e6be1222646aa4013cb2e29b1419a01910f179eb7a68bc29777b3396
|
|
| MD5 |
15024f574a900e051bee692f02f71724
|
|
| BLAKE2b-256 |
e13958823d49c4f337f7a55ede472e168e2d7a190e5eec9b6fd9a07f4f7447b5
|