コード例 #1
0
 def uninstall(cls, bool):
     if bool is True:
         LogHelper.info(
             "Prepare to uninstall Mozy Restore Manager, it will take about 1 minute."
         )
         commands = 'wmic product where name="Mozy Restore Manager x64" call uninstall'
         CmdHelper.runas_admin(commands)
         time.sleep(60)
     else:
         LogHelper.info("Skip the uninstalling process.")
コード例 #2
0
    def install_fb(cls):
        installer = cls.download_fb()
        LogHelper.info("start to install")

        if PlatformHelper.is_Linux() and PlatformHelper.get_arch() == "deb-64":
            install_cmd = "dpkg -i %s" % installer
            cls.__set_fb_path("/etc/filebeat/")

        if PlatformHelper.is_Linux() and PlatformHelper.get_arch() == "deb-32":
            install_cmd = "rpm -vi %s" % installer
            cls.__set_fb_path("/etc/filebeat/")

        if PlatformHelper.is_win():
            import zipfile
            win_fb_dir = "C:\\filebeat"
            target = os.path.join(win_fb_dir, "filebeat-5.2.0-windows-x86_64")
            installcommnd = os.path.join(target,
                                         "install-service-filebeat.ps1")

            zip_ref = zipfile.ZipFile(installer, 'r')
            zip_ref.extractall(win_fb_dir)
            zip_ref.close()
            # FileHelper.rename()

            install_cmd = "powershell.exe %s" % (installcommnd)

            cls.__set_fb_path(target)

            cmd_output = CmdHelper.runas_admin(install_cmd)
            return cmd_output
            # # TODO: Unzip to start" service
            # install_cmd = "to be implemented"
            # win_fb_dir = "C:\\filebeat"
            # if not FileHelper.dir_exist(win_fb_dir):
            #     FileHelper.create_directory(win_fb_dir)
            # cls.__set_fb_path(win_fb_dir)
            # install_cmd = "unzip %s -C %s" % (installer, win_fb_dir)

        if PlatformHelper.is_mac():
            mac_fb_dir = "/filebeat"
            if not FileHelper.dir_exist(mac_fb_dir):
                FileHelper.create_directory(mac_fb_dir)

            cls.__set_fb_path(mac_fb_dir)

            install_cmd = "tar xzvf %s -C %s" % (installer, mac_fb_dir)

        cmd_output = CmdHelper.run(install_cmd)
        LogHelper.info(cmd_output)
コード例 #3
0
 def clear_restore_folder(folder_name):
     directory = "C:/" + folder_name
     if os.path.exists(directory):
         CmdHelper.runas_admin('RMDIR "' + directory + '" /S /Q')
         time.sleep(3)
     os.makedirs(directory)
コード例 #4
0
 def write_reg_as_admin(hkey, name, value, type):
     cmd = 'REG ADD \"' + hkey + '\" /v ' + name + ' /t ' + type + ' /d ' + value + ' /f'
     CmdHelper.runas_admin(cmd)