@expose(hide=True)
    def pre_pref(self, apt_packages):
        if set(EEVariables.ee_postfix).issubset(set(apt_packages)):
            Log.debug(self, "Pre-seeding Postfix")
            try:
                EEShellExec.cmd_exec(self, "echo \"postfix postfix"
                                     "/main_mailer_type string \'Internet Site"
                                     "\'\""
                                     " | debconf-set-selections")
                EEShellExec.cmd_exec(self, "echo \"postfix postfix/mailname"
                                     " string $(hostname -f)\" | "
                                     "debconf-set-selections")
            except CommandExecutionError as e:
                Log.error(self, "Failed to intialize postfix package")

        if set(EEVariables.ee_mysql).issubset(set(apt_packages)):
            Log.info(self, "Adding repository for MySQL, please wait...")
            mysql_pref = ("Package: *\nPin: origin sfo1.mirrors.digitalocean.com"
                          "\nPin-Priority: 1000\n")
            with open('/etc/apt/preferences.d/'
                      'MariaDB.pref', 'w') as mysql_pref_file:
                mysql_pref_file.write(mysql_pref)
        #    if EEVariables.ee_platform_codename != 'jessie':
            EERepo.add(self, repo_url=EEVariables.ee_mysql_repo)
            Log.debug(self, 'Adding key for {0}'
                        .format(EEVariables.ee_mysql_repo))
            EERepo.add_key(self, '0xcbcb082a1bb943db',
                               keyserver="keyserver.ubuntu.com")
            chars = ''.join(random.sample(string.ascii_letters, 8))
            Log.debug(self, "Pre-seeding MySQL")
            Log.debug(self, "echo \"mariadb-server-10.1 "
                      "mysql-server/root_password "
                      "password \" | "
                      "debconf-set-selections")
            try:
                EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 "
                                     "mysql-server/root_password "
                                     "password {chars}\" | "
                                     "debconf-set-selections"
                                     .format(chars=chars),
                                     log=False)
            except CommandExecutionError as e:
                Log.error("Failed to initialize MySQL package")

            Log.debug(self, "echo \"mariadb-server-10.1 "
                      "mysql-server/root_password_again "
                      "password \" | "
                      "debconf-set-selections")
            try:
                EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 "
                                     "mysql-server/root_password_again "
                                     "password {chars}\" | "
                                     "debconf-set-selections"
                                     .format(chars=chars),
                                     log=False)
            except CommandExecutionError as e:
                Log.error("Failed to initialize MySQL package")

            mysql_config = """
            [client]
            user = root
            password = {chars}
            """.format(chars=chars)
            config = configparser.ConfigParser()
            config.read_string(mysql_config)
            Log.debug(self, 'Writting configuration into MySQL file')
            conf_path = "/etc/mysql/conf.d/my.cnf"
            os.makedirs(os.path.dirname(conf_path), exist_ok=True)
            with open(conf_path, encoding='utf-8',
                      mode='w') as configfile:
                config.write(configfile)
            Log.debug(self, 'Setting my.cnf permission')
            EEFileUtils.chmod(self, "/etc/mysql/conf.d/my.cnf", 0o600)


        if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
            Log.info(self, "Adding repository for NGINX, please wait...")
            EERepo.add(self, repo_url=EEVariables.ee_nginx_repo)
            Log.debug(self, 'Adding ppa of Nginx')
            EERepo.add_key(self, EEVariables.ee_nginx_key)

        if set(["nginx-mainline"]).issubset(set(apt_packages)):
            Log.info(self, "Adding repository for NGINX MAINLINE, please wait...")
            EERepo.add(self, repo_url=EEVariables.ee_nginx_dev_repo)
            Log.debug(self, 'Adding ppa of Nginx-mainline')
            EERepo.add_key(self, EEVariables.ee_nginx_key)

        if EEVariables.ee_platform_codename != 'trusty':
            if set(EEVariables.ee_php).issubset(set(apt_packages)):
                Log.info(self, "Adding repository for PHP, please wait...")
                # Add repository for php
                if EEVariables.ee_platform_distro == 'debian':
                    if EEVariables.ee_platform_codename != 'jessie':
                        Log.debug(self, 'Adding repo_url of php for debian')
                        EERepo.add(self, repo_url=EEVariables.ee_php_repo)
                        Log.debug(self, 'Adding Dotdeb/php GPG key')
                        EERepo.add_key(self, '89DF5277')
                else:
                    Log.debug(self, 'Adding ppa for PHP')
                    EERepo.add(self, ppa=EEVariables.ee_php_repo)
        else:
            if set(EEVariables.ee_php7_0).issubset(set(apt_packages)) \
                    or set(EEVariables.ee_php5_6).issubset(set(apt_packages)):
                Log.info(self, "Adding repository for PHP, please wait...")
                Log.debug(self, 'Adding ppa for PHP')
                EERepo.add(self, ppa=EEVariables.ee_php_repo)

        if set(EEVariables.ee_hhvm).issubset(set(apt_packages)):
            Log.info(self, "Adding repository for HHVM, please wait...")
            if EEVariables.ee_platform_codename == 'precise':
                Log.debug(self, 'Adding PPA for Boost')
                EERepo.add(self, ppa=EEVariables.ee_boost_repo)
            Log.debug(self, 'Adding ppa repo for HHVM')
            EERepo.add(self, repo_url=EEVariables.ee_hhvm_repo)
            Log.debug(self, 'Adding HHVM GPG Key')
            EERepo.add_key(self, '0x5a16e7281be7a449')

        if set(EEVariables.ee_mail).issubset(set(apt_packages)):
            Log.debug(self, 'Executing the command debconf-set-selections.')
            try:
                EEShellExec.cmd_exec(self, "echo \"dovecot-core dovecot-core/"
                                     "create-ssl-cert boolean yes\" "
                                     "| debconf-set-selections")
                EEShellExec.cmd_exec(self, "echo \"dovecot-core dovecot-core"
                                     "/ssl-cert-name string $(hostname -f)\""
                                     " | debconf-set-selections")
            except CommandExecutionError as e:
                Log.error("Failed to initialize dovecot packages")

        if set(EEVariables.ee_redis).issubset(set(apt_packages)):
            Log.info(self, "Adding repository for Redis, please wait...")
            if EEVariables.ee_platform_distro == 'debian':
                Log.debug(self, 'Adding repo_url of redis for debian')
                EERepo.add(self, repo_url=EEVariables.ee_redis_repo)
                Log.debug(self, 'Adding Dotdeb GPG key')
                EERepo.add_key(self, '89DF5277')
            else:
                Log.debug(self, 'Adding ppa for redis')
                EERepo.add(self, ppa=EEVariables.ee_redis_repo)
Request listing, return result.
dataset/ETHPy150Open EasyEngine/easyengine/ee/cli/plugins/stack.py/EEStackController.pre_pref--crossover with--dataset/ETHPy150Open babble/babble/include/jython/Lib/poplib.py/POP3.list