Metadata-Version: 1.1
Name: python-otopi-mdp
Version: 0.2.0
Summary: Implements parser for otopi machine dialog.
Home-page: https://github.com/rhevm-qe-automation/python-otopi-mdp
Author: Lukas Bednar
Author-email: lbenar@redhat.com
License: GPLv2
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
        
        
Keywords: otopi
machine
dialog
parser
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Topic :: Utilities
Classifier: Topic :: System :: Installation/Setup
Classifier: Topic :: System :: Systems Administration
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
