Implements parser for otopi machine dialog.
Project description
[![Build Status][travisimg]][travis]
[![Code Coverage][codecovimg]][codecov]
[![Code Health][codehealthimg]][codehealth]
# 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
[codecovimg]: https://codecov.io/gh/rhevm-qe-automation/python-otopi-mdp/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/rhevm-qe-automation/python-otopi-mdp
[codehealthimg]: https://landscape.io/github/rhevm-qe-automation/python-otopi-mdp/master/landscape.svg?style=flat
[codehealth]: https://landscape.io/github/rhevm-qe-automation/python-otopi-mdp/master
[![Code Coverage][codecovimg]][codecov]
[![Code Health][codehealthimg]][codehealth]
# 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
[codecovimg]: https://codecov.io/gh/rhevm-qe-automation/python-otopi-mdp/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/rhevm-qe-automation/python-otopi-mdp
[codehealthimg]: https://landscape.io/github/rhevm-qe-automation/python-otopi-mdp/master/landscape.svg?style=flat
[codehealth]: https://landscape.io/github/rhevm-qe-automation/python-otopi-mdp/master
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.0.zip
(25.2 kB
view details)
python-otopi-mdp-0.2.0.tar.gz
(17.0 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.2.0-1.src.rpm
(26.2 kB
view details)
File details
Details for the file python-otopi-mdp-0.2.0.zip.
File metadata
- Download URL: python-otopi-mdp-0.2.0.zip
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7b6e5c456ea4dd540eb1e9e18960b626c3d964b90832c0f379169181d4b22b
|
|
| MD5 |
282a32cd79b3c1f26c27185f8be617be
|
|
| BLAKE2b-256 |
d56e7f3defcaa93419e2e7739aecc3ac68af2784f6706aac1ece1be83809e4a2
|
File details
Details for the file python-otopi-mdp-0.2.0.tar.gz.
File metadata
- Download URL: python-otopi-mdp-0.2.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaec1d2bb337344fdcd519097352bc8639819bcd70f74aac2dfe227f0fbe2bdf
|
|
| MD5 |
7615461aa5c6fe6377d817fda37a3305
|
|
| BLAKE2b-256 |
93d37e4fc055aec3a5676b8bef42601660481c271ec257cfd942c042d770aedb
|
File details
Details for the file python-otopi-mdp-0.2.0-1.src.rpm.
File metadata
- Download URL: python-otopi-mdp-0.2.0-1.src.rpm
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d1c33a56b5a51a358c66c4d1eb843f392c5382f659de73d711929aad00e500f
|
|
| MD5 |
84ff4d8d41a31472d3eff1540f80d7ab
|
|
| BLAKE2b-256 |
59977e52e5d7d32f0c63a6b07b127320f0559a5b31859a4dcff749ffc94bfb5d
|
File details
Details for the file python-otopi-mdp-0.2.0-1.noarch.rpm.
File metadata
- Download URL: python-otopi-mdp-0.2.0-1.noarch.rpm
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e70e0cf2c566524df993ce94cde5061651e4b52cfd86d3aeb1c5c83c3076c7f4
|
|
| MD5 |
898d13a72b6f4dab05f2dfcafa2a4534
|
|
| BLAKE2b-256 |
5505f111e5343e72975ad51b3246cfea6a8df21275618c42d39738c8cc68bb39
|