Browse Source

ee stack service messaged modified

bugfixes
harshadyeola 10 years ago
parent
commit
aa2eeb0b10
  1. 26
      ee/cli/controllers/base.py
  2. 77
      ee/cli/plugins/site.py
  3. 13
      ee/cli/plugins/sitedb.py
  4. 2
      ee/core/fileutils.py
  5. 2
      ee/core/services.py
  6. 10
      setup.py

26
ee/cli/controllers/base.py

@ -6,28 +6,10 @@ from cement.core.controller import CementBaseController, expose
class EEBaseController(CementBaseController):
class Meta:
label = 'base'
description = 'easyengine is the commandline tool to manage your \
websites based on wordpress and nginx with easy to \
use commands.'
arguments = [
(['-f', '--foo'],
dict(help='the notorious foo option', dest='foo', action='store',
metavar='TEXT')),
]
description = ("easyengine is the commandline tool to manage your"
" websites based on wordpress and nginx with easy to"
" use commands.")
@expose(hide=True)
def default(self):
data = dict(foo='EEBaseController.default().')
self.app.render((data), 'default.mustache')
# print("Inside EEBaseController.default().")
# If using an output handler such as 'mustache', you could also
# render a data dictionary using a template. For example:
#
# data = dict(foo='bar')
# self.app.render(data, 'default.mustache')
#
#
# The 'default.mustache' file would be loaded from
# ``ee.cli.templates``, or ``/var/lib/ee/templates/``.
self.app.args.print_help()

77
ee/cli/plugins/site.py

@ -458,30 +458,30 @@ class EESiteUpdateController(CementBaseController):
help of the following subcommands'
arguments = [
(['site_name'],
dict(help='website name')),
dict(help='domain name for the site to be updated')),
(['--html'],
dict(help="html site", action='store_true')),
dict(help="update to html site", action='store_true')),
(['--php'],
dict(help="php site", action='store_true')),
dict(help="update to php site", action='store_true')),
(['--mysql'],
dict(help="mysql site", action='store_true')),
dict(help="update to mysql site", action='store_true')),
(['--wp'],
dict(help="wordpress site", action='store_true')),
dict(help="update to wordpress single site",
action='store_true')),
(['--wpsubdir'],
dict(help="wpsubdir site", action='store_true')),
dict(help="update to wpsubdir site", action='store_true')),
(['--wpsubdomain'],
dict(help="wpsubdomain site", action='store_true')),
dict(help="update to wpsubdomain site", action='store_true')),
(['--w3tc'],
dict(help="w3tc", action='store_true')),
dict(help="update to w3tc cache", action='store_true')),
(['--wpfc'],
dict(help="wpfc", action='store_true')),
dict(help="update to wpfc cache", action='store_true')),
(['--wpsc'],
dict(help="wpsc", action='store_true')),
dict(help="update to wpsc cache", action='store_true')),
]
@expose(help="update example.com")
@expose(help="update site type or cache")
def default(self):
# TODO Write code for ee site update here
(ee_domain,
ee_www_domain, ) = ValidateDomain(self.app.pargs.site_name)
ee_site_webroot = EEVariables.ee_webroot + ee_domain
@ -810,10 +810,8 @@ class EESiteUpdateController(CementBaseController):
data['ee_db_host']))
eedbconfig.close()
except IOError as e:
Log.error(self, " Unable to create ee-config.php for "
"{0}"
.format(ee_domain))
Log.debug(self, "{0} {1}".format(e.errno, e.strerror))
Log.debug(self, "{0}".format(e))
Log.error(self, " Unable to create ee-config.php.")
if oldsitetype == 'mysql':
config_file = (ee_site_webroot + '/backup/{0}/ee-config.php'
@ -892,12 +890,17 @@ class EESiteDeleteController(CementBaseController):
dict(help="delete webroot only", action='store_true')),
]
@expose(help="delete example.com")
@expose(help="delete site")
def default(self):
# TODO Write code for ee site update here
(ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)
ee_db_name = ''
ee_prompt = ''
if ((not self.app.pargs.db) and (not self.app.pargs.files) and
(not self.app.pargs.all)):
self.app.pargs.all = True
if os.path.isfile('/etc/nginx/sites-available/{0}'
.format(ee_domain)):
ee_site_webroot = EEVariables.ee_webroot + ee_domain
@ -907,44 +910,49 @@ class EESiteDeleteController(CementBaseController):
if self.app.pargs.db:
if not ee_prompt:
ee_db_prompt = input('Do you want to delete database:'
'[Y/N] ')
ee_db_prompt = input('Do you want to delete database'
'[Y/N]: ')
else:
ee_db_prompt = 'Y'
if ee_db_prompt == 'Y':
ee_nginx_prompt = 'Y'
if ee_db_prompt == 'Y' or ee_db_prompt == 'y':
self.deleteDB(ee_site_webroot)
if self.app.pargs.files:
if not ee_prompt:
ee_web_prompt = input('Do you want to delete webroot:'
'[Y/N] ')
ee_web_prompt = input('Do you want to delete webroot'
'[Y/N]: ')
else:
ee_web_prompt = 'Y'
if ee_web_prompt == 'Y':
ee_nginx_prompt = 'Y'
if ee_web_prompt == 'Y' or ee_web_prompt == 'y':
self.deleteWebRoot(ee_site_webroot)
if self.app.pargs.all:
if not ee_prompt:
ee_db_prompt = input('Do you want to delete database:'
'[Y/N] '
ee_db_prompt = input('Do you want to delete database'
'[Y/N]: '
)
ee_web_prompt = input('Do you want to delete webroot:'
'[Y/N] ')
ee_web_prompt = input('Do you want to delete webroot'
'[Y/N]: ')
ee_nginx_prompt = input('Do you want to delete NGINX'
' configuration:[Y/N] ')
' configuration [Y/N]: ')
else:
ee_db_prompt = 'Y'
ee_web_prompt = 'Y'
ee_nginx_prompt = 'Y'
if ee_db_prompt == 'Y':
if ee_db_prompt == 'Y' or ee_db_prompt == 'y':
self.deleteDB(ee_site_webroot)
if ee_web_prompt == 'Y':
if ee_web_prompt == 'Y' or ee_web_prompt == 'y':
self.deleteWebRoot(ee_site_webroot)
if ee_nginx_prompt == 'Y':
if (ee_nginx_prompt == 'Y' or ee_nginx_prompt == 'y'):
EEFileUtils.rm(self, '/etc/nginx/sites-available/{0}'
.format(ee_domain))
deleteSiteInfo(self, ee_domain)
Log.info(self, "Deleted site {0}".format(ee_domain))
else:
Log.error(self, " site {0} does not exists".format(ee_domain))
@ -966,11 +974,13 @@ class EESiteDeleteController(CementBaseController):
'DB_HOST').split(',')[1]
.split(')')[0].strip().replace('\'', ''))
try:
Log.debug(self, "dropping database {0}".format(ee_db_name))
EEMysql.execute(self,
"drop database {0}".format(ee_db_name),
errormsg='Unable to drop database {0}'
.format(ee_db_name))
if ee_db_user != 'root':
Log.debug(self, "dropping user {0}".format(ee_db_user))
EEMysql.execute(self,
"drop user {0}@{1}"
.format(ee_db_user, ee_db_host))
@ -1001,7 +1011,7 @@ class EESiteListController(CementBaseController):
def default(self):
sites = getAllsites(self)
if not sites:
self.app.close(1)
pass
if self.app.pargs.enabled:
for site in sites:
@ -1011,6 +1021,9 @@ class EESiteListController(CementBaseController):
for site in sites:
if not site.is_enabled:
Log.info(self, "{0}".format(site.sitename))
else:
for site in sites:
Log.info(self, "{0}".format(site.sitename))
def load(app):

13
ee/cli/plugins/sitedb.py

@ -9,7 +9,7 @@ from ee.core.models import SiteDB
def addNewSite(self, site, stype, cache, path,
enabled=True, ssl=False, fs='ext4', db='mysql'):
enabled=True, ssl=False, fs='ext4', db=''):
try:
newRec = SiteDB(site, stype, cache, path, enabled, ssl, fs, db)
db_session.add(newRec)
@ -41,7 +41,7 @@ def updateSiteInfo(self, site, stype='', cache='',
if cache and q.cache_type != cache:
q.cache_type = cache
if enabled and q.is_enabled != enabled:
if q.is_enabled != enabled:
q.is_enabled = enabled
if ssl and q.is_ssl != ssl:
@ -67,3 +67,12 @@ def deleteSiteInfo(self, site):
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to delete site from application database.")
def getAllsites(self):
try:
q = SiteDB.query.all()
return q
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to query database :")

2
ee/core/fileutils.py

@ -43,7 +43,7 @@ class EEFileUtils():
try:
os.unlink(filepath)
except Exception as e:
Log.debug(self, "{0}{1}".format(e.errno, e.strerror))
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to reomove symbolic link ...\n")
def copyfile(self, src, dest):

2
ee/core/services.py

@ -95,7 +95,7 @@ class EEService():
return False
except OSError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Failed to reload service {0}"
Log.error(self, "\nFailed to reload service {0}"
.format(service_name))
def get_service_status(self, service_name):

10
setup.py

@ -7,6 +7,9 @@ import glob
conf = []
templates = []
long_description = '''EasyEngine is the commandline tool to manage your
Websites based on WordPress and NGINX with easy to use
commands'''
for name in glob.glob('config/plugins.d/*.conf'):
conf.insert(1, name)
@ -22,11 +25,8 @@ if not os.path.exists('/var/lib/ee/'):
setup(name='ee',
version='3.0',
description=('EasyEngine is the commandline tool to manage your Websites'
'based on WordPress and NGINX with easy to use commands.'),
long_description=('EasyEngine is the commandline tool to manage your '
'Websites based on WordPress and NGINX with easy'
'to use commands.'),
description=long_description,
long_description=long_description,
classifiers=[],
keywords='',
author='rtCamp Soultions Pvt. LTD',

Loading…
Cancel
Save