Browse Source

Improved ee stack install

bugfixes
gau1991 10 years ago
parent
commit
59fad213c6
  1. 14
      ee/cli/plugins/stack.py
  2. 12
      ee/core/apt_repo.py

14
ee/cli/plugins/stack.py

@ -7,6 +7,7 @@ from ee.core.aptget import EEAptGet
from ee.core.download import EEDownload from ee.core.download import EEDownload
from ee.core.shellexec import EEShellExec from ee.core.shellexec import EEShellExec
from ee.core.fileutils import EEFileUtils from ee.core.fileutils import EEFileUtils
from ee.core.apt_repo import EERepo
from pynginxconfig import NginxConfig from pynginxconfig import NginxConfig
import random import random
import string import string
@ -49,16 +50,17 @@ class EEStackController(CementBaseController):
@expose(hide=True) @expose(hide=True)
def pre_pref(self, apt_packages): def pre_pref(self, apt_packages):
if "postfix" in apt_packages: if set(EEVariables.ee_postfix).issubset(set(apt_packages)):
EEShellExec.cmd_exec("echo \"postfix postfix/main_mailer_type " EEShellExec.cmd_exec("echo \"postfix postfix/main_mailer_type "
"string 'Internet Site'\" | " "string 'Internet Site'\" | "
"debconf-set-selections") "debconf-set-selections")
EEShellExec.cmd_exec("echo \"postfix postfix/mailname string " EEShellExec.cmd_exec("echo \"postfix postfix/mailname string "
"$(hostname -f)\" | debconf-set-selections") "$(hostname -f)\" | debconf-set-selections")
if "mysql" in apt_packages: if set(EEVariables.ee_mysql).issubset(set(apt_packages)):
EERepo.add(repo_url="deb http://repo.percona.com/apt " EERepo.add(ppa='deb http://repo.percona.com/apt '
+ EEVariables.ee_platform_codename + " main") + EEVariables.ee_platform_codename + " main")
EERepo.add_key('hkp://keys.gnupg.net', '1C4CBDCDCD2EFD2A ') EERepo.add_key('hkp://keys.gnupg.net', '1C4CBDCDCD2EFD2A ')
chars = ''.join(random.sample(string.letters, 8)) chars = ''.join(random.sample(string.letters, 8))
EEShellExec.cmd_exec("echo \"percona-server-server-5.6 " EEShellExec.cmd_exec("echo \"percona-server-server-5.6 "
"percona-server-server/root_password " "percona-server-server/root_password "
@ -72,11 +74,9 @@ class EEStackController(CementBaseController):
@expose(hide=True) @expose(hide=True)
def post_pref(self, apt_packages, packages): def post_pref(self, apt_packages, packages):
if len(apt_packages): if len(apt_packages):
print("In post") if set(EEVariables.ee_postfix).issubset(set(apt_packages)):
print(apt_packages)
if "postfix" in apt_packages:
pass pass
if 'nginx-custom' in apt_packages: if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
# Nginx core configuration change using configparser # Nginx core configuration change using configparser
nc = NginxConfig() nc = NginxConfig()
print('in nginx') print('in nginx')

12
ee/core/apt_repo.py

@ -1,6 +1,4 @@
import os.path import os.path
import gnupg
from ee.core.shellexec import EEShellExec from ee.core.shellexec import EEShellExec
from ee.core.variables import EEVariables from ee.core.variables import EEVariables
@ -33,20 +31,20 @@ class EERepo():
print("Cannot add repo for {distro}" print("Cannot add repo for {distro}"
.format(distro=EEVariables.ee_platform_distro)) .format(distro=EEVariables.ee_platform_distro))
else: else:
EEShellExec.cmd_exec("add-apt-repository -y {ppa_name}" EEShellExec.cmd_exec("add-apt-repository -y '{ppa_name}'"
.format(ppa_name=ppa)) .format(ppa_name=ppa))
def remove(repo_url=None): def remove(repo_url=None):
# TODO remove repository # TODO remove repository
EEShellExec.cmd_exec("add-apt-repository -y" EEShellExec.cmd_exec("add-apt-repository -y "
"--remove '{ppa_name}'".format(ppa_name=repo_url)) "--remove '{ppa_name}'".format(ppa_name=repo_url))
pass pass
def add_key(keyserver, keyids): def add_key(keyserver, keyids):
EEShellExec.cmd_exec("gpg --keyserver {0}".format(keyserver) EEShellExec.cmd_exec("gpg --keyserver {serv}".format(serv=keyserver)
"--recv-keys {0}".format(keyids)) + " --recv-keys {key}".format(key=keyids))
EEShellExec.cmd_exec("gpg -a --export --armor {0}".format(keyids) EEShellExec.cmd_exec("gpg -a --export --armor {0}".format(keyids)
"| apt-key add - ") + " | apt-key add - ")
# if __name__ == '__main__': # if __name__ == '__main__':
# EERepo().add(repo_url="http://ds.asf", codename="trusty", repo_type="main") # EERepo().add(repo_url="http://ds.asf", codename="trusty", repo_type="main")

Loading…
Cancel
Save