Browse Source

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

bugfixes
shital.rtcamp 10 years ago
parent
commit
e095e43eda
  1. 1
      .travis.yml
  2. 44
      ee/cli/plugins/site_functions.py
  3. 7
      ee/cli/plugins/stack.py
  4. 31
      ee/core/aptget.py
  5. 5
      ee/core/shellexec.py
  6. 2
      ee/core/variables.py

1
.travis.yml

@ -17,6 +17,7 @@ before_script:
- sudo service hostname restart
- sudo apt-get -qq purge mysql* graphviz*
- sudo apt-get -qq autoremove
- sudo apt-get update
script:
- sudo echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > ~/.gitconfig

44
ee/cli/plugins/site_functions.py

@ -177,6 +177,15 @@ def setupwordpress(self, data):
Log.debug(self, "Setting up wp-config file")
if not data['multisite']:
Log.debug(self, "Generating wp-config for WordPress Single site")
Log.debug(self, "bash -c \"php /usr/bin/wp --allow-root "
+ "core config "
+ "--dbname={0} --dbprefix={1} --dbuser={2} "
.format(data['ee_db_name'], ee_wp_prefix,
data['ee_db_user'])
+ "--dbpass= "
"--extra-php<<PHP \n {1}\nPHP\""
.format(data['ee_db_pass'],
"\n\ndefine(\'WP_DEBUG\', false);"))
EEShellExec.cmd_exec(self, "bash -c \"php /usr/bin/wp --allow-root "
+ "core config "
+ "--dbname={0} --dbprefix={1} --dbuser={2} "
@ -185,10 +194,23 @@ def setupwordpress(self, data):
+ "--dbpass={0} "
"--extra-php<<PHP \n {1}\nPHP\""
.format(data['ee_db_pass'],
"\n\ndefine(\'WP_DEBUG\', false);")
"\n\ndefine(\'WP_DEBUG\', false);"),
log=False
)
else:
Log.debug(self, "Generating wp-config for WordPress multisite")
Log.debug(self, "bash -c \"php /usr/bin/wp --allow-root "
+ "core config "
+ "--dbname={0} --dbprefix={1} "
.format(data['ee_db_name'], ee_wp_prefix)
+ "--dbuser={0} --dbpass= "
"--extra-php<<PHP \n {2} {3} {4}\nPHP\""
.format(data['ee_db_user'], data['ee_db_pass'],
"\ndefine(\'WP_ALLOW_MULTISITE\', "
"true);",
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
" true);",
"\n\ndefine(\'WP_DEBUG\', false);"))
EEShellExec.cmd_exec(self, "bash -c \"php /usr/bin/wp --allow-root "
+ "core config "
+ "--dbname={0} --dbprefix={1} "
@ -200,7 +222,8 @@ def setupwordpress(self, data):
"true);",
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
" true);",
"\n\ndefine(\'WP_DEBUG\', false);")
"\n\ndefine(\'WP_DEBUG\', false);"),
log=False
)
EEFileUtils.mvfile(self, os.getcwd()+'/wp-config.php',
os.path.abspath(os.path.join(os.getcwd(), os.pardir)))
@ -233,14 +256,29 @@ def setupwordpress(self, data):
if not data['multisite']:
Log.debug(self, "Creating tables for WordPress Single site")
Log.debug(self, "php /usr/bin/wp --allow-root core install "
"--url={0} --title={0} --admin_name={1} "
.format(data['www_domain'], ee_wp_user)
+ "--admin_password= --admin_email={1}"
.format(ee_wp_pass, ee_wp_email))
EEShellExec.cmd_exec(self, "php /usr/bin/wp --allow-root core install "
"--url={0} --title={0} --admin_name={1} "
.format(data['www_domain'], ee_wp_user)
+ "--admin_password={0} --admin_email={1}"
.format(ee_wp_pass, ee_wp_email),
errormsg="Unable to setup WordPress Tables")
errormsg="Unable to setup WordPress Tables",
log=False)
else:
Log.debug(self, "Creating tables for WordPress multisite")
Log.debug(self, "php /usr/bin/wp --allow-root "
"core multisite-install "
"--url={0} --title={0} --admin_name={1} "
.format(data['www_domain'], ee_wp_user)
+ "--admin_password= --admin_email={1} "
"{subdomains}"
.format(ee_wp_pass, ee_wp_email,
subdomains='--subdomains'
if not data['wpsubdir'] else ''))
EEShellExec.cmd_exec(self, "php /usr/bin/wp --allow-root "
"core multisite-install "
"--url={0} --title={0} --admin_name={1} "

7
ee/cli/plugins/stack.py

@ -668,8 +668,6 @@ class EEStackController(CementBaseController):
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,""" +
"""no_unknown_recipient_check
-o local_header_rewrite_clients=""")
with open("/etc/postfix/master.cf", "a") as am_config:
@ -965,6 +963,11 @@ class EEStackController(CementBaseController):
'{0}roundcubemail/htdocs'
.format(EEVariables.ee_webroot))
# Install Roundcube depednet pear packages
EEShellExec.cmd_exec(self, "pear install Mail_Mime Net_SMTP"
" Mail_mimeDecode Net_IDNA2-beta "
"Auth_SASL Net_Sieve Crypt_GPG")
# Configure roundcube database
rc_passwd = ''.join(random.sample(string.ascii_letters, 8))
Log.debug(self, "Creating Database roundcubemail")

31
ee/core/aptget.py

@ -23,20 +23,29 @@ class EEAptGet():
return success
except AttributeError as e:
Log.error(self, 'AttributeError: ' + str(e))
except FetchFailedException as e:
Log.debug(self, 'SystemError: ' + str(e))
Log.error(self, 'Unable to Fetch update')
def dist_upgrade():
"""
Similar to `apt-get upgrade`
"""
apt_cache = apt.cache.Cache()
apt_cache.update()
apt_cache.open(None)
apt_cache.upgrade(True)
success = (apt_cache.commit(
apt.progress.text.AcquireProgress(),
apt.progress.base.InstallProgress()))
#apt_cache.close()
return success
try:
apt_cache = apt.cache.Cache()
apt_cache.update()
apt_cache.open(None)
apt_cache.upgrade(True)
success = (apt_cache.commit(
apt.progress.text.AcquireProgress(),
apt.progress.base.InstallProgress()))
#apt_cache.close()
return success
except AttributeError as e:
Log.error(self, 'AttributeError: ' + str(e))
except FetchFailedException as e:
Log.debug(self, 'SystemError: ' + str(e))
Log.error(self, 'Unable to Fetch update')
def install(self, packages):
"""
@ -59,7 +68,7 @@ class EEAptGet():
return False
else:
try:
print(pkg.name)
# print(pkg.name)
pkg.mark_install()
except Exception as e:
Log.debug(self, str(e))
@ -108,7 +117,7 @@ class EEAptGet():
return False
else:
try:
print(pkg.name)
# print(pkg.name)
pkg.mark_delete(purge)
except SystemError as e:
Log.debug(self, 'SystemError: ' + str(e))

5
ee/core/shellexec.py

@ -11,10 +11,11 @@ class EEShellExec():
def __init__():
pass
def cmd_exec(self, command, errormsg=''):
def cmd_exec(self, command, errormsg='', log=True):
"""Run shell command from Python"""
try:
Log.debug(self, "Running command: {0}".format(command))
if log:
Log.debug(self, "Running command: {0}".format(command))
retcode = subprocess.getstatusoutput(command)
if retcode[0] == 0:
return True

2
ee/core/variables.py

@ -105,7 +105,7 @@ class EEVariables():
ee_mail = ["dovecot-core", "dovecot-imapd", "dovecot-pop3d",
"dovecot-lmtpd", "dovecot-mysql", "dovecot-sieve",
"dovecot-managesieved", "postfix-mysql", "php5-cgi",
"php-gettext"]
"php-gettext", "php-pear"]
# Mailscanner repo and packages
ee_mailscanner_repo = ()

Loading…
Cancel
Save