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 hashes)
python-otopi-mdp-0.2.0.tar.gz
(17.0 kB
view hashes)
Built Distributions
python-otopi-mdp-0.2.0-1.src.rpm
(26.2 kB
view hashes)
Close
Hashes for python-otopi-mdp-0.2.0-1.src.rpm
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d1c33a56b5a51a358c66c4d1eb843f392c5382f659de73d711929aad00e500f |
|
MD5 | 84ff4d8d41a31472d3eff1540f80d7ab |
|
BLAKE2b-256 | 59977e52e5d7d32f0c63a6b07b127320f0559a5b31859a4dcff749ffc94bfb5d |
Close
Hashes for python-otopi-mdp-0.2.0-1.noarch.rpm
Algorithm | Hash digest | |
---|---|---|
SHA256 | e70e0cf2c566524df993ce94cde5061651e4b52cfd86d3aeb1c5c83c3076c7f4 |
|
MD5 | 898d13a72b6f4dab05f2dfcafa2a4534 |
|
BLAKE2b-256 | 5505f111e5343e72975ad51b3246cfea6a8df21275618c42d39738c8cc68bb39 |