Browse Source

Merge branch 'python' of github.com:rtCamp/easyengine into python

bugfixes
harshadyeola 10 years ago
parent
commit
cf8192278b
  1. 2
      .travis.yml
  2. 38
      ee/cli/plugins/stack.py
  3. 2
      ee/cli/templates/50-user.mustache
  4. 22
      ee/core/checkfqdn.py

2
.travis.yml

@ -13,6 +13,8 @@ before_install:
- rm -rf ~/.gnupg - rm -rf ~/.gnupg
before_script: before_script:
- sudo bash -c 'echo example.com > /etc/hostname'
- sudo service hostname restart
- sudo apt-get -qq purge mysql* graphviz* - sudo apt-get -qq purge mysql* graphviz*
- sudo apt-get -qq autoremove - sudo apt-get -qq autoremove

38
ee/cli/plugins/stack.py

@ -12,6 +12,7 @@ from ee.core.extract import EEExtract
from ee.core.mysql import EEMysql from ee.core.mysql import EEMysql
from ee.core.addswap import EESwap from ee.core.addswap import EESwap
from ee.core.git import EEGit from ee.core.git import EEGit
from ee.core.checkfqdn import check_fqdn
from pynginxconfig import NginxConfig from pynginxconfig import NginxConfig
from ee.core.services import EEService from ee.core.services import EEService
import random import random
@ -44,6 +45,8 @@ class EEStackController(CementBaseController):
dict(help='Install admin tools stack', action='store_true')), dict(help='Install admin tools stack', action='store_true')),
(['--mail'], (['--mail'],
dict(help='Install mail server stack', action='store_true')), dict(help='Install mail server stack', action='store_true')),
(['--mailscanner'],
dict(help='Install mail scanner stack', action='store_true')),
(['--nginx'], (['--nginx'],
dict(help='Install Nginx stack', action='store_true')), dict(help='Install Nginx stack', action='store_true')),
(['--php'], (['--php'],
@ -589,6 +592,20 @@ class EEStackController(CementBaseController):
out=ee_amavis) out=ee_amavis)
ee_amavis.close() ee_amavis.close()
# Amavis ViMbadmin configuration
if os.path.isfile("/etc/postfix/mysql/virtual_alias_maps.cf"):
vm_host = os.popen("grep hosts /etc/postfix/mysql/virtual_"
"alias_maps.cf | awk \'{ print $3 }\' |"
" tr -d '\\n'").read()
vm_pass = os.popen("grep password /etc/postfix/mysql/"
"virtual_alias_maps.cf | awk \'{ print "
"$3 }\' | tr -d '\\n'").read()
data = dict(host=vm_host, password=vm_pass)
vm_config = open('/etc/amavis/conf.d/50-user', 'w')
self.app.render((data), '50-user.mustache', out=vm_config)
vm_config.close()
# Amavis postfix configuration # Amavis postfix configuration
EEShellExec.cmd_exec(self, "postconf -e \"content_filter = " EEShellExec.cmd_exec(self, "postconf -e \"content_filter = "
"smtp-amavis:[127.0.0.1]:10024\"") "smtp-amavis:[127.0.0.1]:10024\"")
@ -949,7 +966,8 @@ class EEStackController(CementBaseController):
(not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and (not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.phpmyadmin) and
(not self.app.pargs.adminer) and (not self.app.pargs.utils)): (not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.mailscanner)):
self.app.pargs.web = True self.app.pargs.web = True
if self.app.pargs.web: if self.app.pargs.web:
@ -976,6 +994,8 @@ class EEStackController(CementBaseController):
self.app.pargs.postfix = True self.app.pargs.postfix = True
if not EEAptGet.is_installed(self, 'dovecot-core'): if not EEAptGet.is_installed(self, 'dovecot-core'):
check_fqdn(self,
os.popen("hostname -f | tr -d '\n'").read())
Log.debug(self, "Setting apt_packages variable for mail") Log.debug(self, "Setting apt_packages variable for mail")
apt_packages = apt_packages + EEVariables.ee_mail apt_packages = apt_packages + EEVariables.ee_mail
packages = packages + [["https://github.com/opensolutions/" packages = packages + [["https://github.com/opensolutions/"
@ -991,8 +1011,11 @@ class EEStackController(CementBaseController):
"Roundcube"]] "Roundcube"]]
if EEVariables.ee_ram > 1024: if EEVariables.ee_ram > 1024:
apt_packages = (apt_packages + self.app.pargs.mailscanner = True
EEVariables.ee_mailscanner) else:
Log.info(self, "System RAM is less than 1GB\nMail "
"scanner packages are not going to install"
" automatically")
else: else:
Log.info(self, "Mail server is already installed") Log.info(self, "Mail server is already installed")
@ -1051,6 +1074,9 @@ class EEStackController(CementBaseController):
"htdocs/db/adminer/index.php", "htdocs/db/adminer/index.php",
"Adminer"]] "Adminer"]]
if self.app.pargs.mailscanner:
apt_packages = (apt_packages + EEVariables.ee_mailscanner)
if self.app.pargs.utils: if self.app.pargs.utils:
Log.debug(self, "Setting packages variable for utils") Log.debug(self, "Setting packages variable for utils")
packages = packages + [["http://phpmemcacheadmin.googlecode" packages = packages + [["http://phpmemcacheadmin.googlecode"
@ -1150,6 +1176,9 @@ class EEStackController(CementBaseController):
EEMysql.execute(self, "drop database IF EXISTS vimbadmin") EEMysql.execute(self, "drop database IF EXISTS vimbadmin")
EEMysql.execute(self, "drop database IF EXISTS roundcubemail") EEMysql.execute(self, "drop database IF EXISTS roundcubemail")
if self.app.pargs.mailscanner:
apt_packages = (apt_packages + EEVariables.ee_mailscanner)
if self.app.pargs.nginx: if self.app.pargs.nginx:
Log.debug(self, "Removing apt_packages variable of Nginx") Log.debug(self, "Removing apt_packages variable of Nginx")
apt_packages = apt_packages + EEVariables.ee_nginx apt_packages = apt_packages + EEVariables.ee_nginx
@ -1226,6 +1255,9 @@ class EEStackController(CementBaseController):
EEMysql.execute(self, "drop database IF EXISTS vimbadmin") EEMysql.execute(self, "drop database IF EXISTS vimbadmin")
EEMysql.execute(self, "drop database IF EXISTS roundcubemail") EEMysql.execute(self, "drop database IF EXISTS roundcubemail")
if self.app.pargs.mailscanner:
apt_packages = (apt_packages + EEVariables.ee_mailscanner)
if self.app.pargs.nginx: if self.app.pargs.nginx:
Log.debug(self, "Purge apt_packages variable of Nginx") Log.debug(self, "Purge apt_packages variable of Nginx")
apt_packages = apt_packages + EEVariables.ee_nginx apt_packages = apt_packages + EEVariables.ee_nginx

2
ee/cli/templates/50-user.mustache

@ -8,7 +8,7 @@ $final_spam_destiny = D_PASS;
# We need to provide list of domains for which filtering need to be done # We need to provide list of domains for which filtering need to be done
@lookup_sql_dsn = ( @lookup_sql_dsn = (
['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306', ['DBI:mysql:database=vimbadmin;host={{host}};port=3306',
'vimbadmin', 'vimbadmin',
'{{password}}']); '{{password}}']);

22
ee/core/checkfqdn.py

@ -0,0 +1,22 @@
from ee.core.shellexec import EEShellExec
from ee.core.variables import EEVariables
import os
def check_fqdn(self, ee_host):
#ee_host=os.popen("hostname -f | tr -d '\n'").read()
if '.' in ee_host:
EEVariables.ee_fqdn = ee_host
with open('/etc/hostname', 'w') as hostfile:
hostfile.write(ee_host)
EEShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
.format(ee_host))
if EEVariables.ee_platform_distro == 'debian':
EEShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
else:
EEShellExec.cmd_exec(self, "service hostname restart")
else:
ee_host = input("Enter hostname [fqdn]:")
check_fqdn(self, ee_host)
Loading…
Cancel
Save