Browse Source

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

bugfixes
shital.rtcamp 10 years ago
parent
commit
a3feacad1d
  1. 122
      .travis.yml
  2. 11
      ee/cli/plugins/site.py
  3. 12
      ee/cli/plugins/site_functions.py
  4. 2
      ee/core/download.py
  5. 4
      ee/core/fileutils.py
  6. 10
      ee/core/services.py

122
.travis.yml

@ -24,7 +24,7 @@ script:
- sudo ee stack install
- sudo ee stack install --web
- sudo ee stack install --admin
- sudo ee site create html.com
# - sudo ee site create html.com
- sudo ee site create html.net --html
- sudo ee site create php.com --php
- sudo ee site create mysql.com --mysql
@ -43,63 +43,63 @@ script:
- sudo ee site create site4.net --wp --wpfc
- sudo ee site create site4.org --wpfc --wp
- sudo ee site create site5.com --wpsubdir
- sudo ee site create site5.net --wpsubdir --basic
- sudo ee site create site5.org --basic --wpsubdir
- sudo ee site create site5.in --wpsubdirectory
- sudo ee site create site5.co --wpsubdirectory --basic
- sudo ee site create site5.co.in --basic --wpsubdirector
- sudo ee site create site6.com --wpsubdir --wpsc
- sudo ee site create site6.net --wpsc --wpsubdir
- sudo ee site create site6.org --wpsubdirectory --wpsc
- sudo ee site create site6.in --wpsc --wpsubdirectory
- sudo ee site create site7.com --wpsubdir --w3tc
- sudo ee site create site7.net --w3tc --wpsubdir
- sudo ee site create site7.org --wpsubdirectory --w3tc
- sudo ee site create site7.in --w3tc --wpsubdirectory
- sudo ee site create site8.com --wpsubdir --wpfc
- sudo ee site create site8.net --wpfc --wpsubdir
- sudo ee site create site8.org --wpsubdirectory --wpfc
- sudo ee site create site8.in --wpfc --wpsubdirectory
- sudo ee site create site9.com --wpsubdom
- sudo ee site create site9.net --wpsubdom --basic
- sudo ee site create site9.org --basic --wpsubdom
- sudo ee site create site9.in --wpsubdomain
- sudo ee site create site9.co --wpsubdomain --basic
- sudo ee site create site9.co.in --basic --wpsubdomain
- sudo ee site create site10.com --wpsubdom --wpsc
- sudo ee site create site10.net --wpsc --wpsubdom
- sudo ee site create site10.org --wpsubdomain --wpsc
- sudo ee site create site10.in --wpsc --wpsubdomain
- sudo ee site create site11.com --wpsubdom --w3tc
- sudo ee site create site11.net --w3tc --wpsubdom
- sudo ee site create site11.org --wpsubdomain --w3tc
- sudo ee site create site11.in --w3tc --wpsubdomain
- sudo ee site create site12.com --wpsubdom --wpfc
- sudo ee site create site12.net --wpfc --wpsubdom
- sudo ee site create site12.org --wpsubdomain --wpfc
- sudo ee site create site12.in --wpfc --wpsubdomain
- sudo ee debug
- sudo ee debug --stop
- sudo ee site create 1.com --html
- sudo ee site create 2.com --php
- sudo ee site create 3.com --mysql
- sudo ee site update 1.com --wp
- sudo ee site update 2.com --wpsubdir
- sudo ee site update 3.com --wpsubdomain
- sudo ee site update site1.com --wp --wpfc
- sudo ee site update site1.com --wp --w3tc
- sudo ee site update site1.com --wp --wpsc
- sudo ee site update site5.com --wpsubdir --wpfc
- sudo ee site update site5.com --wpsubdir --w3tc
- sudo ee site update site5.com --wpsubdir --wpsc
- sudo ee site update site9.com --wpsubdom --wpfc
- sudo ee site update site9.com --wpsubdom --w3tc
- sudo ee site update site9.com --wpsubdom --wpsc
- sudo ee site delete site12.com --no-prompt
- sudo ee site delete site12.net --no-prompt
- sudo ee site delete site12.org --no-prompt
- sudo ee stack install --mail
- sudo ls /var/www/
- sudo wp --allow-root --info
# - sudo ee site create site5.net --wpsubdir
# - sudo ee site create site5.org --basic --wpsubdir
# - sudo ee site create site5.in --wpsubdirectory
# - sudo ee site create site5.co --wpsubdirectory --basic
# - sudo ee site create site5.co.in --basic --wpsubdirector
# - sudo ee site create site6.com --wpsubdir --wpsc
# - sudo ee site create site6.net --wpsc --wpsubdir
# - sudo ee site create site6.org --wpsubdirectory --wpsc
# - sudo ee site create site6.in --wpsc --wpsubdirectory
# - sudo ee site create site7.com --wpsubdir --w3tc
# - sudo ee site create site7.net --w3tc --wpsubdir
# - sudo ee site create site7.org --wpsubdirectory --w3tc
# - sudo ee site create site7.in --w3tc --wpsubdirectory
# - sudo ee site create site8.com --wpsubdir --wpfc
# - sudo ee site create site8.net --wpfc --wpsubdir
# - sudo ee site create site8.org --wpsubdirectory --wpfc
# - sudo ee site create site8.in --wpfc --wpsubdirectory
# - sudo ee site create site9.com --wpsubdom
# - sudo ee site create site9.net --wpsubdom --basic
# - sudo ee site create site9.org --basic --wpsubdom
# - sudo ee site create site9.in --wpsubdomain
# - sudo ee site create site9.co --wpsubdomain --basic
# - sudo ee site create site9.co.in --basic --wpsubdomain
# - sudo ee site create site10.com --wpsubdom --wpsc
# - sudo ee site create site10.net --wpsc --wpsubdom
# - sudo ee site create site10.org --wpsubdomain --wpsc
# - sudo ee site create site10.in --wpsc --wpsubdomain
# - sudo ee site create site11.com --wpsubdom --w3tc
# - sudo ee site create site11.net --w3tc --wpsubdom
# - sudo ee site create site11.org --wpsubdomain --w3tc
# - sudo ee site create site11.in --w3tc --wpsubdomain
# - sudo ee site create site12.com --wpsubdom --wpfc
# - sudo ee site create site12.net --wpfc --wpsubdom
# - sudo ee site create site12.org --wpsubdomain --wpfc
# - sudo ee site create site12.in --wpfc --wpsubdomain
#
# - sudo ee debug
# - sudo ee debug --stop
# - sudo ee site create 1.com --html
# - sudo ee site create 2.com --php
# - sudo ee site create 3.com --mysql
# - sudo ee site update 1.com --wp
# - sudo ee site update 2.com --wpsubdir
# - sudo ee site update 3.com --wpsubdomain
# - sudo ee site update site1.com --wp --wpfc
# - sudo ee site update site1.com --wp --w3tc
# - sudo ee site update site1.com --wp --wpsc
# - sudo ee site update site5.com --wpsubdir --wpfc
# - sudo ee site update site5.com --wpsubdir --w3tc
# - sudo ee site update site5.com --wpsubdir --wpsc
# - sudo ee site update site9.com --wpsubdom --wpfc
# - sudo ee site update site9.com --wpsubdom --w3tc
# - sudo ee site update site9.com --wpsubdom --wpsc
# - sudo ee site delete site12.com --no-prompt
# - sudo ee site delete site12.net --no-prompt
# - sudo ee site delete site12.org --no-prompt
#
# - sudo ee stack install --mail
# - sudo ls /var/www/
# - sudo wp --allow-root --info

11
ee/cli/plugins/site.py

@ -439,7 +439,7 @@ class EESiteCreateController(CementBaseController):
.format(ee_www_domain, stype, cache))
# Setup Permissions for webroot
setwebrootpermissions(self, data['webroot'])
if len(ee_auth):
if ee_auth and len(ee_auth):
for msg in ee_auth:
Log.info(self, Log.ENDC + msg)
@ -809,7 +809,7 @@ class EESiteUpdateController(CementBaseController):
Log.error(self, " Cannot update {0}, Invalid Options"
.format(ee_domain))
site_package_check(self, stype)
ee_auth = site_package_check(self, stype)
sitebackup(self, data)
# setup NGINX configuration, and webroot
@ -883,12 +883,15 @@ class EESiteUpdateController(CementBaseController):
.format(ee_www_domain, stype, cache))
# Setup Permissions for webroot
# setwebrootpermissions(self, data['webroot'])
if ee_auth and len(ee_auth):
for msg in ee_auth:
Log.info(self, Log.ENDC + msg)
if data['wp'] and oldsitetype in ['html', 'php', 'mysql']:
Log.info(self, Log.ENDC + "WordPress admin user :"
Log.info(self, "\n\n" + Log.ENDC + "WordPress admin user :"
" {0}".format(ee_wp_creds['wp_user']))
Log.info(self, Log.ENDC + "WordPress admin password : {0}"
.format(ee_wp_creds['wp_pass']))
.format(ee_wp_creds['wp_pass']) + "\n\n")
updateSiteInfo(self, ee_www_domain, stype=stype, cache=cache)
Log.info(self, "Successfully updated site"

12
ee/cli/plugins/site_functions.py

@ -32,7 +32,7 @@ def setupdomain(self, data):
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "\nUnable to create NGINX configuration")
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
# create symbolic link for
EEFileUtils.create_symlink(self, ['/etc/nginx/sites-available/{0}'
@ -59,7 +59,7 @@ def setupdomain(self, data):
.format(ee_domain_name),
'{0}/logs/error.log'
.format(ee_site_webroot)])
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
def setupdatabase(self, data):
@ -126,7 +126,7 @@ def setupdatabase(self, data):
EEMysql.execute(self,
"grant all privileges on {0}.* to {1}@{2}"
.format(ee_db_name, ee_db_username, ee_mysql_grant_host))
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
data['ee_db_name'] = ee_db_name
data['ee_db_user'] = ee_db_username
@ -152,7 +152,7 @@ def setupwordpress(self, data):
Log.info(self, "Downloading Wordpress \t\t", end='')
EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
EEShellExec.cmd_exec(self, "wp --allow-root core download")
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
if not (data['ee_db_name'] and data['ee_db_user'] and data['ee_db_pass']):
data = setupdatabase(self, data)
@ -324,7 +324,7 @@ def sitebackup(self, data):
if data['currsitetype'] in ['html', 'php', 'mysql']:
Log.info(self, "Backing up Webroot \t\t", end='')
EEFileUtils.mvfile(self, ee_site_webroot + '/htdocs', backup_path)
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
configfiles = glob.glob(ee_site_webroot + '/*-config.php')
@ -336,7 +336,7 @@ def sitebackup(self, data):
EEShellExec.cmd_exec(self, "mysqldump {0} > {1}/{0}.sql"
.format(ee_db_name, backup_path),
errormsg="\nFailed: Backup Database")
Log.info(self, "[Done]")
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
# move wp-config.php/ee-config.php to backup
if data['currsitetype'] in ['mysql']:
EEFileUtils.mvfile(self, configfiles[0], backup_path)

2
ee/core/download.py

@ -21,7 +21,7 @@ class EEDownload():
os.makedirs(directory)
Log.info(self, "Downloading {0:20}".format(pkg_name), end=' ')
urllib.request.urlretrieve(url, filename)
Log.info(self, "{0}".format("[Done]"))
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" + Log.OKBLUE + "]"))
except urllib.error.URLError as e:
Log.debug(self, "[{err}]".format(err=str(e.reason)))
Log.error(self, "Unable to donwload file, {0}"

4
ee/core/fileutils.py

@ -18,13 +18,13 @@ class EEFileUtils():
if os.path.isfile(file):
Log.info(self, "Removing {0:65}".format(file), end=' ')
os.remove(file)
Log.info(self, "{0}".format("[Done]"))
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" + Log.OKBLUE + "]"))
Log.debug(self, 'file Removed')
if os.path.isdir(file):
try:
Log.info(self, "Removing {0:65}".format(file), end=' ')
shutil.rmtree(file)
Log.info(self, "{0}".format("[Done]"))
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" + Log.OKBLUE + "]"))
except shutil.Error as e:
Log.debug(self, "{err}".format(err=str(e.reason)))
Log.error(self, 'Unable to Remove file ')

10
ee/core/services.py

@ -18,7 +18,7 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} start'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "[OK]")
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
@ -35,7 +35,7 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} stop'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "[OK]")
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
@ -52,7 +52,7 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} restart'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "[OK]")
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
@ -75,7 +75,7 @@ class EEService():
# print(retcode[0])
# subprocess.getstatusoutput('service {0} reload'
# .format(service_name))
Log.info(self, "[OK]")
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
@ -87,7 +87,7 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} reload'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "[OK]")
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))

Loading…
Cancel
Save