Implements parser for otopi machine dialog.
Project description
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
Set otopi environment to enable machine dialect
DIALOG/dialect=str:machine
Spawn desired installer and pass stdin and stdout to parser
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
Built Distribution
File details
Details for the file python-otopi-mdp-0.2.1.zip
.
File metadata
- Download URL: python-otopi-mdp-0.2.1.zip
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7210c5236af6da792b06a3e74199153fda847b7bebfdd4a8fd2f7b5758404a4d |
|
MD5 | ff146fcb9b1abfac9f615ea9b3e2ba01 |
|
BLAKE2b-256 | 065ba533937677154d0d4147af290c196c12c21a8e451e99008e05387f154792 |
Provenance
File details
Details for the file python-otopi-mdp-0.2.1.tar.gz
.
File metadata
- Download URL: python-otopi-mdp-0.2.1.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 389c79bad851b6c70cd32a3cbd9ff99c4edac2605b05e3407da8fa008dde3afe |
|
MD5 | 5681c4605f00fcdf463a44029bb59126 |
|
BLAKE2b-256 | 0c9e44f99e0160c55df9076ef8df0c089d25c30948eefb7a328985194c385dd0 |
Provenance
File details
Details for the file python_otopi_mdp-0.2.1-py2.7.egg
.
File metadata
- Download URL: python_otopi_mdp-0.2.1-py2.7.egg
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79c50f36b51fe2d36920fdea3a9b1f0c429066570c398f32c8071b99ad80f20f |
|
MD5 | 21d71d1430743b587ba9a5a1df551fb4 |
|
BLAKE2b-256 | 58513908035a25cf76fd3c3821f8479bd275e5518fd496dc982c2ad6d68df250 |