Browse Source

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

bugfixes
shital.rtcamp 10 years ago
parent
commit
9d0f9c5b9e
  1. 108
      ee/cli/plugins/site.py
  2. 38
      ee/cli/plugins/stack.py
  3. 27
      ee/cli/templates/15-content_filter_mode.mustache
  4. 17
      ee/cli/templates/50-user.mustache
  5. 5
      ee/core/variables.py
  6. 1
      setup.py

108
ee/cli/plugins/site.py

@ -107,59 +107,127 @@ class EESiteCreateController(CementBaseController):
# TODO Default action for ee site command
# data = dict(foo='EESiteCreateController.default().')
# self.app.render((data), 'default.mustache')
if self.app.pargs.html:
if (self.app.pargs.html and not (self.app.pargs.php or
self.app.pargs.mysql or self.app.pargs.wp or self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc or
self.app.pargs.wsubdir or self.app.pargs.wsubdomain)):
data = dict(site_name=self.app.pargs.site_name,
static=True, basic=False, wp=False, w3tc=False,
wpfc=False, wpsc=False, multisite=False,
wpsubdir=False)
if self.app.pargs.php:
if (self.app.pargs.php and not (self.app.pargs.html or
self.app.pargs.mysql or self.app.pargs.wp or self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc or
self.app.pargs.wsubdir or self.app.pargs.wsubdomain)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=False, w3tc=False,
wpfc=False, wpsc=False, multisite=False,
wpsubdir=False)
if self.app.pargs.mysql:
if (self.app.pargs.mysql and not (self.app.pargs.html or
self.app.pargs.php or self.app.pargs.wp or self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc or
self.app.pargs.wsubdir or self.app.pargs.wsubdomain)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=False, w3tc=False,
wpfc=False, wpsc=False, multisite=False,
wpsubdir=False)
if (self.app.pargs.wp or self.app.pargs.w3tc or self.app.pargs.wpfc
or self.app.pargs.wpsc):
if self.app.pargs.wp:
if ((self.app.pargs.wp or self.app.pargs.w3tc or self.app.pargs.wpfc or
self.app.pargs.wpsc) and not (self.app.pargs.html or
self.app.pargs.php or self.app.pargs.mysql or
self.app.pargs.wpsubdir or self.app.pargs.wpsubdomain)):
if (self.app.pargs.wp and not (self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=True, w3tc=False,
wpfc=False, wpsc=False, multisite=False,
wpsubdir=False)
if self.app.pargs.w3tc:
if (self.app.pargs.w3tc and not
(self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=True,
wpfc=False, wpsc=False, multisite=False,
wpsubdir=False)
if self.app.pargs.wpfc:
if (self.app.pargs.wpfc and not
(self.app.pargs.wpsc or self.app.pargs.w3tc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=True, wpsc=False, multisite=False,
wpsubdir=False)
if self.app.pargs.wpsc:
if (self.app.pargs.wpsc and not
(self.app.pargs.w3tc or self.app.pargs.wpfc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=False, wpsc=True, multisite=False,
wpsubdir=False)
if self.app.pargs.wpsubdir:
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=True, w3tc=False,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=True)
if (self.app.pargs.wpsubdir and not (self.app.pargs.html or
self.app.pargs.php or self.app.pargs.mysql or
self.app.pargs.wpsubdomain or self.app.pargs.wp)):
if (self.app.pargs.wpsubdir and not (self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=True, w3tc=False,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=True)
if (self.app.pargs.w3tc and not
(self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=True,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=True)
if (self.app.pargs.wpfc and not
(self.app.pargs.wpsc or self.app.pargs.w3tc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=True, wpsc=False, multisite=True,
wpsubdir=True)
if (self.app.pargs.wpsc and not
(self.app.pargs.w3tc or self.app.pargs.wpfc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=False, wpsc=True, multisite=True,
wpsubdir=True)
if self.app.pargs.wpsubdomain:
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=True, w3tc=False,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=False)
self.app.render((data), 'virtualconf.mustache')
if (self.app.pargs.wpsubdomain and not (self.app.pargs.html or
self.app.pargs.php or self.app.pargs.mysql or
self.app.pargs.wpsubdir or self.app.pargs.wp)):
if (self.app.pargs.wpsubdomain and not (self.app.pargs.w3tc
or self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=True, wp=True, w3tc=False,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=False)
if (self.app.pargs.w3tc and not
(self.app.pargs.wpfc or self.app.pargs.wpsc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=True,
wpfc=False, wpsc=False, multisite=True,
wpsubdir=False)
if (self.app.pargs.wpfc and not
(self.app.pargs.wpsc or self.app.pargs.w3tc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=True, wpsc=False, multisite=True,
wpsubdir=False)
if (self.app.pargs.wpsc and not
(self.app.pargs.w3tc or self.app.pargs.wpfc)):
data = dict(site_name=self.app.pargs.site_name,
static=False, basic=False, wp=True, w3tc=False,
wpfc=False, wpsc=True, multisite=True,
wpsubdir=False)
try:
ee_site_nginx_conf = open('/etc/nginx/sites-available/{0}.conf'
.format(self.app.pargs.site_name), 'w')
self.app.render((data), 'virtualconf.mustache',
out=ee_site_nginx_conf)
ee_site_nginx_conf.close()
except Exception as e:
print("Select proper options for creating site")
class EESiteUpdateController(CementBaseController):

38
ee/cli/plugins/stack.py

@ -309,8 +309,35 @@ class EEStackController(CementBaseController):
EEShellExec.cmd_exec("sievec /var/lib/dovecot/sieve/"
"default.sieve")
if set(EEVariables.ee_mailscanner).issubset(set(apt_packages)):
# Set up Custom amavis configuration
data = dict()
ee_amavis = open('/etc/amavis/conf.d/15-content_filter_mode',
'w')
self.app.render((data), '15-content_filter_mode.mustache',
out=ee_amavis)
ee_amavis.close()
# Amavis postfix configuration
EEShellExec.cmd_exec("postconf -e \"content_filter = "
"smtp-amavis:[127.0.0.1]:10024\"")
EEShellExec.cmd_exec("sed -i \"s/1 pickup/1 pickup"
"\n -o content_filter=\n -o"
" receive_override_options=no_header_body"
"_checks/\" /etc/postfix/master.cf")
# Amavis ClamAV configuration
EEShellExec.cmd_exec("adduser clamav amavis")
EEShellExec.cmd_exec("adduser amavis clamav")
EEShellExec.cmd_exec("chmod -R 775 /var/lib/amavis/tmp")
# Update ClamAV database
EEShellExec.cmd_exec("freshclam")
EEShellExec.cmd_exec("service clamav-daemon restart")
if len(packages):
if any('/usr/bin/wp' == x[1] for x in packages):
EEShellExec.cmd_exec("chmod +x /usr/bin/wp")
if any('/tmp/pma.tar.gz' == x[1]
for x in packages):
@ -511,6 +538,15 @@ class EEStackController(CementBaseController):
out=vm_config)
vm_config.close()
# If Amavis is going to be installed then configure Vimabadmin
# Amvis settings
if set(EEVariables.ee_mailscanner).issubset(set(apt_packages)):
vm_config = open('/etc/amavis/conf.d/50-user',
'w')
self.app.render((data), '50-user.mustache',
out=vm_config)
vm_config.close()
if any('/tmp/roundcube.tar.gz' == x[1] for x in packages):
# Extract RoundCubemail
self.app.log.debug("Extracting file /tmp/roundcube.tar.gz "
@ -581,6 +617,8 @@ class EEStackController(CementBaseController):
"1.0.4/roundcubemail-1.0.4.tar.gz",
"/tmp/roundcube.tar.gz"]
]
if EEVariables.ee_ram > 1024:
apt_packages = apt_packages + EEVariables.ee_mailscanner
if self.app.pargs.nginx:
self.app.log.debug("Setting apt_packages variable for Nginx")

27
ee/cli/templates/15-content_filter_mode.mustache

@ -0,0 +1,27 @@
use strict;
# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.
#
# Default antivirus checking mode
# Please note, that anti-virus checking is DISABLED by
# default.
# If You wish to enable it, please uncomment the following lines:
@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
#
# Default SPAM checking mode
# Please note, that anti-spam checking is DISABLED by
# default.
# If You wish to enable it, please uncomment the following lines:
@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1; # ensure a defined return

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

@ -0,0 +1,17 @@
use strict;
$sa_spam_subject_tag = undef;
$spam_quarantine_to = undef;
$sa_tag_level_deflt = undef;
# Prevent spams from automatically rejected by mail-server
$final_spam_destiny = D_PASS;
# We need to provide list of domains for which filtering need to be done
@lookup_sql_dsn = (
['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306',
'vimbadmin',
'{{password}}']);
$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)';
1; # ensure a defined return

5
ee/core/variables.py

@ -4,6 +4,7 @@ import socket
import configparser
import os
import sys
import psutil
class EEVariables():
@ -27,6 +28,10 @@ class EEVariables():
print("Unable to find GIT user name and Email")
sys.exit(1)
# Get System RAM and SWAP details
ee_ram = psutil.virtual_memory().total / (1024 * 1024)
ee_swap = psutil.swap_memory().total / (1024 * 1024)
# EasyEngine stack installation varibales
# Nginx repo and packages
if ee_platform_distro == 'Ubuntu':

1
setup.py

@ -33,6 +33,7 @@ setup(name='ee',
'python-apt',
'pynginxconfig',
'pymysql3',
'psutil',
],
setup_requires=[],
entry_points="""

Loading…
Cancel
Save