From 0ec933e37ddbc4b25ff5a6934273c56e655fa93a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 2 Jan 2015 18:40:27 +0530 Subject: [PATCH] Added optional site name is argument and completed all ee debug arguments --- ee/cli/plugins/debug.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 2a9d988e..5e824ea6 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -39,12 +39,14 @@ class EEDebugController(CementBaseController): (['--import-slow-log-interval'], dict(help='Import MySQL slow log to Anemometer', action='store', dest='interval')), + (['site_name'], + dict(help='Website Name', nargs='?', default=None)) ] @expose(hide=True) def debug_nginx(self): self.trigger_nginx = False - if self.start: + if self.start and not self.app.pargs.site_name: try: debug_address = (self.app.config.get('stack', 'ip-address') .split()) @@ -65,7 +67,7 @@ class EEDebugController(CementBaseController): self.msg = self.msg + " /var/log/nginx/*.error.log" - else: + elif not self.start and not self.app.pargs.site_name: if "debug_connection " in open('/etc/nginx/nginx.conf').read(): print("Disabling Nginx debug connections") EEShellExec.cmd_exec(self, "sed -i \"/debug_connection.*/d\"" @@ -74,6 +76,12 @@ class EEDebugController(CementBaseController): else: print("Nginx debug connection already disbaled") + elif self.start and self.app.pargs.site_name: + print("Enabling debug for "+self.app.pargs.site_name) + + elif not self.start and self.app.pargs.site_name: + print("Disabling debug for "+self.app.pargs.site_name) + @expose(hide=True) def debug_php(self): if self.start: @@ -174,23 +182,30 @@ class EEDebugController(CementBaseController): @expose(hide=True) def debug_wp(self): - if self.start: - print("Start WP debug") + if self.start and self.app.pargs.site_name: + print("Start WP debug for site") + elif not self.start and not self.app.pargs.site_name: + print("Stop WP debug for site") else: - print("Stop WP debug") + print("Missing argument site_name") @expose(hide=True) def debug_rewrite(self): - if self.start: - print("Start WP-Rewrite debug") - else: - print("Stop WP-Rewrite debug") + if self.start and not self.app.pargs.site_name: + print("Start WP-Rewrite debug globally") + elif self.start and not self.app.pargs.site_name: + print("Stop WP-Rewrite debug globally") + elif self.start and self.app.pargs.site_name: + print("Start WP-Rewrite for site") + elif not self.start and not self.app.pargs.site_name: + print("Stop WP-Rewrite for site") @expose(hide=True) def default(self): self.start = True self.interactive = False self.msg = "" + print(self.app.pargs.site_name) if self.app.pargs.stop: self.start = False