#!/usr/bin/env python

import argparse
import os
import shutil
import subprocess
import sys


class ConfigInstaller(object):

    def __init__(self):
        self.options = []
        self.home = os.environ['HOME']
        self.command = ''

    def parse_arguments(self):
        formatter = argparse.RawDescriptionHelpFormatter
        uses = '''Examples:
 *Install availability monitoring and centralized logging on localhost:
    opstools-server-installation --am-hosts localhost --log-hosts localhost
 *Install performance monitoring on a server IP:
    opstools-server-installation --pm-hosts IP
 *Install performance and availability monitoring on a server:
    opstools-server-installation --pm-hosts IP --am-hosts IP
 *Just create the inventory and overwritten if it exits:
    opstools-server-installation -f --no-x '''

        parser = argparse.ArgumentParser(prog='opstools-server-installation',
                                         formatter_class=formatter,
                                         description=(
                                             'Script to set up the'
                                             ' operational servers.'
                                         ),
                                         epilog=uses)
        parser.add_argument('-i', '--inventory',
                            dest='opstoolinvpath',
                            help=(
                                'Opstool inventory path. '
                                'default= ~/.opstools.inventory'
                            ),
                            default=self.home + '/.opstools.inventory')
        parser.add_argument('--pm-hosts',
                            dest='pm_hosts',
                            action='append',
                            help=(
                                'Performance monitoring server IP. '
                                'default = []'
                            ),
                            default=[])
        parser.add_argument('--am-hosts',
                            dest='am_hosts',
                            action='append',
                            help=(
                                'Available monitoring server IP. '
                                'default = []'
                            ),
                            default=[])
        parser.add_argument('--log-hosts',
                            dest='logging_hosts',
                            action='append',
                            help=(
                                'Logging monitoring server IP. '
                                'default = localhost'
                            ),
                            default=[])
        parser.add_argument('-qs',
                            dest='ooo_ssh_ansible',
                            help=(
                                'Quickstart config path. '