示例#1
0
class InstallManager(object):
    def __init__(self):
        super(InstallManager, self).__init__()
        self.util = Util()
        self.ssh_status = ""
        self.logger = Logger()
        self.config_maneger = ConfigManager()
        self.liderahenk_data_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'dist/liderahenk.json')
        self.liderldap_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            '../dist/lider_ldap.json')

    def install_mariadb(self, data):
        db_installer = MariaDbInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Veritabanı sunucu kurulumuna başlanıyor <<<<<======")
        db_installer.install(data)

    def install_ejabberd(self, data):
        ejabberd_installer = EjabberInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Ejabberd sunucu kurulumuna başlanıyor. <<<<<======")
        ejabberd_installer.install(data)

    def install_ldap(self, data):

        ldap_installer = OpenLdapInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> OpenLDAP sunucu kurulumuna başlanıyor. <<<<<======")
        ldap_installer.install(data)

    def install_lider(self, data):
        lider_installer = LiderInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Lider sunucu Kurulumuna başlanıyor. <<<<<======")
        lider_installer.install(data)

    def install_lider_console(self, data):
        lider_console_installer = LiderConsoleInstaller(
            self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Lider Arayüz Kurulumuna başlanıyor. <<<<<======")
        lider_console_installer.install(data)

    def install_ahenk(self, data):
        ahenk_installer = AhenkInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Ahenk Kurulumuna başlanıyor. <<<<<======")
        ahenk_installer.install(data)

    def ssh_connect(self, data):
        ssh_status = self.util.connect(data)
        self.ssh_status = ssh_status
        if self.ssh_status == "Successfully Authenticated":
            return True
        else:
            return False

    def ssh_disconnect(self):
        self.util.disconnect()
示例#2
0
class InstallManager(object):
    def __init__(self):
        super(InstallManager, self).__init__()
        self.util = Util()
        self.ssh_status = ""
        self.logger = Logger()
        self.config_maneger = ConfigManager()
        self.liderahenk_data_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'dist/liderahenk.json')
        self.liderldap_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            '../dist/lider_ldap.json')

    def install_mariadb(self, data):
        db_installer = MariaDbInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Veritabanı sunucu kurulumuna başlanıyor <<<<<======")
        db_installer.install(data)

    def install_ejabberd(self, data):
        ejabberd_installer = EjabberInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Ejabberd sunucu kurulumuna başlanıyor. <<<<<======")
        ejabberd_installer.install(data)

    def install_ldap(self, data):

        ldap_installer = OpenLdapInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> OpenLDAP sunucu kurulumuna başlanıyor. <<<<<======")
        ldap_installer.install(data)

    def install_lider(self, data):
        lider_installer = LiderInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Lider sunucu Kurulumuna başlanıyor. <<<<<======")
        lider_installer.install(data)

    def install_lider_console(self, data):
        lider_console_installer = LiderConsoleInstaller(
            self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Lider Arayüz Kurulumuna başlanıyor. <<<<<======")
        lider_console_installer.install(data)

    def install_ahenk(self, data):
        ahenk_installer = AhenkInstaller(self.util, self.ssh_status)
        self.logger.info(
            "======>>>>> Ahenk Kurulumuna başlanıyor. <<<<<======")
        ahenk_installer.install(data)

    def ssh_connect(self, data):
        ssh_status = self.util.connect(data)
        self.ssh_status = ssh_status
        if self.ssh_status == "Successfully Authenticated":
            return True
        else:
            return False

    def ssh_disconnect(self):
        self.util.disconnect()
        # self.logger.info("installation successfull")

    def start_install(self):
        # copy installer.log file

        with open(self.liderahenk_data_path) as f:
            data = json.load(f)
        self.logger.info("liderahenk.json dosyasından veriler okunuyor")

        if data['location'] == 'remote':
            self.ssh_connect(data)
        if data['db_install'] is True:
            self.install_mariadb(data)
        if data['ldap_install'] is True:
            self.install_ldap(data)
        if data['ejabberd_install'] is True:
            self.install_ejabberd(data)
        if data['lider_install'] is True:
            self.install_lider(data)

        if data['location'] == 'remote':
            self.ssh_disconnect()
        else:
            self.logger.info("Lider Sunucu kurulumu tamamlandı")
            self.logger.info("installation successfull")