Browse Source

updated log message

bugfixes
shital.rtcamp 10 years ago
parent
commit
39ccf39324
  1. 4
      ee/cli/plugins/clean.py
  2. 4
      ee/cli/plugins/secure.py
  3. 2
      ee/cli/plugins/site.py
  4. 8
      ee/cli/plugins/stack.py
  5. 3
      ee/core/addswap.py
  6. 6
      ee/core/download.py
  7. 2
      ee/core/extract.py
  8. 6
      ee/core/fileutils.py
  9. 33
      ee/core/services.py
  10. 10
      setup.py

4
ee/cli/plugins/clean.py

@ -18,8 +18,8 @@ class EECleanController(CementBaseController):
label = 'clean'
stacked_on = 'base'
stacked_type = 'nested'
description = 'clean command cleans different cache with following \
options'
description = ('clean command cleans different cache with following '
'options')
arguments = [
(['--all'],
dict(help='clean all cache', action='store_true')),

4
ee/cli/plugins/secure.py

@ -20,8 +20,8 @@ class EEsecureController(CementBaseController):
label = 'secure'
stacked_on = 'base'
stacked_type = 'nested'
description = 'clean command cleans different cache with following \
options'
description = ('clean command cleans different cache with following '
'options')
arguments = [
(['--auth'],
dict(help='secure auth', action='store_true')),

2
ee/cli/plugins/site.py

@ -24,7 +24,7 @@ class EESiteController(CementBaseController):
stacked_on = 'base'
stacked_type = 'nested'
description = ('site command manages website configuration'
'with the help of the following subcommands')
' with the help of the following subcommands')
arguments = [
(['site_name'],
dict(help='website name')),

8
ee/cli/plugins/stack.py

@ -924,7 +924,7 @@ class EEStackController(CementBaseController):
"roundcubemail/releases/download/"
"1.0.4/roundcubemail-1.0.4.tar.gz",
"/tmp/roundcube.tar.gz",
"roundcubemail"]]
"Roundcube"]]
if EEVariables.ee_ram > 1024:
apt_packages = apt_packages + EEVariables.ee_mailscanner
@ -961,7 +961,7 @@ class EEStackController(CementBaseController):
packages = packages + [["https://github.com/wp-cli/wp-cli/"
"releases/download/v0.17.1/"
"wp-cli.phar", "/usr/bin/wp",
"wp-cli"]]
"WP_CLI"]]
else:
Log.info(self, "WP-CLI is allready installed")
if self.app.pargs.phpmyadmin:
@ -974,7 +974,7 @@ class EEStackController(CementBaseController):
Log.debug(self, "Setting packages variable for Adminer ")
packages = packages + [["http://downloads.sourceforge.net/adminer"
"/adminer-4.1.0.php", "/var/www/22222/"
"htdocs/db/adminer/index.php", "adminer"]]
"htdocs/db/adminer/index.php", "Adminer"]]
if self.app.pargs.utils:
Log.debug(self, "Setting packages variable for utils")
@ -1001,7 +1001,7 @@ class EEStackController(CementBaseController):
"opcache/ocp.php", "ocp.php"],
["https://github.com/jokkedk/webgrind/"
"archive/master.tar.gz",
'/tmp/webgrind.tar.gz', 'webgrind.tar.gz'],
'/tmp/webgrind.tar.gz', 'Webgrind'],
["http://bazaar.launchpad.net/~percona-too"
"lkit-dev/percona-toolkit/2.1/download/he"
"ad:/ptquerydigest-20110624220137-or26tn4"

3
ee/core/addswap.py

@ -1,6 +1,7 @@
from ee.core.variables import EEVariables
from ee.core.shellexec import EEShellExec
from ee.core.fileutils import EEFileUtils
from ee.core.logging import Log
class EESwap():
@ -13,7 +14,7 @@ class EESwap():
def add(self):
if EEVariables.ee_ram < 512:
if EEVariables.ee_swap < 1000:
self.app.log.info("Adding SWAP")
Log.info(self, "Adding SWAP")
EEShellExec.cmd_exec(self, "dd if=/dev/zero of=/ee-swapfile "
"bs=1024 count=1048k")
EEShellExec.cmd_exec(self, "mkswap /ee-swapfile")

6
ee/core/download.py

@ -22,11 +22,11 @@ class EEDownload():
Log.info(self, "Downloading "+pkg_name+" ...")
urllib.request.urlretrieve(url, filename)
except urllib.error.URLError as e:
Log.info(self, "Unable to donwload file, [{err}]"
.format(err=str(e.reason)))
Log.error(self, "Unable to donwload file, [{err}] [FAIL]"
.format(err=str(e.reason)))
return False
except urllib.error.HTTPError as e:
Log.error(self, "Package download failed. [{err}]"
Log.error(self, "Package download failed. [{err}] [FAIL]"
.format(err=str(e.reason)))
return False
except urllib.error.ContentTooShortError as e:

2
ee/core/extract.py

@ -15,6 +15,6 @@ class EEExtract():
os.remove(file)
return True
except tarfile.TarError as e:
Log.error(self, 'Unable to extract file \{0} {1}'
Log.error(self, 'Unable to extract file \{0} {1} [FAIL]'
.format(e.errno, e.strerror))
return False

6
ee/core/fileutils.py

@ -53,9 +53,9 @@ class EEFileUtils():
try:
shutil.copy2(src, dest)
except shutil.Error as e:
Log.info(self, 'Error: {0}'.format(e))
Log.error(self, '{0}'.format(e))
except IOError as e:
Log.info(self, 'Error: {e}'.format(e.strerror))
Log.error(self, '{e}'.format(e.strerror))
def searchreplace(self, fnm, sstr, rstr):
try:
@ -63,7 +63,7 @@ class EEFileUtils():
Log.info(line.replace(sstr, rstr), end='')
fileinput.close()
except Exception as e:
Log.info(self, 'Error : {0}'.format(e))
Log.error(self, '{0}'.format(e))
def mvfile(self, src, dst):
try:

33
ee/core/services.py

@ -17,11 +17,12 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} start'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "Started : {0}".format(service_name))
Log.info(self, "Started : {0} [ok]"
.format(service_name))
else:
Log.error(self, retcode[1])
except OSError as e:
Log.error(self, "Failed to start service {0} {1}"
Log.error(self, "Failed to start service {0} {1} [FAIL]"
.format(e.errno, e.strerror))
return False
@ -30,12 +31,13 @@ class EEService():
retcode = subprocess.getstatusoutput('service {0} stop'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "Stopped : {0}".format(service_name))
Log.info(self, "Stopped : {0} [OK]"
.format(service_name))
return True
else:
return False
except OSError as e:
Log.error(self, "Failed to stop service : {0}{1}"
Log.error(self, "Failed to stop service : {0}{1} [FAIL]"
.format(e.errno, e.strerror))
return False
@ -43,8 +45,10 @@ class EEService():
try:
EEService.stop_service(self, service_name)
EEService.start_service(self, service_name)
Log.info(self, "restart : {0} [OK]"
.format(service_name))
except OSError as e:
Log.error(self, "Failed to restart services \{0} {1}"
Log.error(self, "Failed to restart services \{0} {1} [FAIL]"
.format(e.errno, e.strerror))
def reload_service(self, service_name):
@ -55,26 +59,27 @@ class EEService():
if retcode[0] == 0:
subprocess.getstatusoutput('service {0} reload'
.format(service_name))
self.app.log.info("reload : {0} [OK]"
.format(service_name))
Log.info("reload : {0} [OK]"
.format(service_name))
return True
else:
self.app.log.error("reload : {0} [FAIL]"
.format(service_name))
self.app.log.debug("{0}"
.format(retcode[1]))
Log.error("reload : {0} [FAIL]"
.format(service_name))
Log.debug("{0}"
.format(retcode[1]))
return False
retcode = subprocess.getstatusoutput('service {0} reload'
.format(service_name))
if retcode[0] == 0:
Log.info(self, "reload : {0}".format(service_name))
Log.info(self, "reload : {0} [OK]"
.format(service_name))
return True
else:
return False
except OSError as e:
Log.error(self, "Failed to reload {0} {1}"
Log.error(self, "Failed to reload {0} {1} [FAIL]"
.format(service_name, e))
sys.exit(1)
@ -92,6 +97,6 @@ class EEService():
else:
return False
except OSError as e:
Log.error(self, "Unable to get services status \ {0}{1}"
Log.error(self, "Unable to get services status \ {0}{1} [FAIL]"
.format(e.errno, e.strerror))
return False

10
setup.py

@ -16,11 +16,11 @@ for name in glob.glob('ee/cli/templates/*.mustache'):
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=('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.'),
classifiers=[],
keywords='',
author='rtCamp Soultions Pvt. LTD',

Loading…
Cancel
Save