From 3bdfb2a17d27e704ed5f72bf2b8f87dd18dbc07a Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 3 Dec 2014 18:15:10 +0530 Subject: [PATCH] ee subcommand controllers --- ee/cli/bootstrap.py | 6 +++ ee/cli/controllers/clean.py | 13 +++++-- ee/cli/controllers/debug.py | 17 +++++++-- ee/cli/controllers/info.py | 21 ++++++++++ ee/cli/controllers/isl.py | 21 ++++++++++ ee/cli/controllers/secure.py | 22 +++++++++++ ee/cli/controllers/site.py | 74 +++++++++++++++++++++++------------- ee/cli/controllers/stack.py | 11 ++++-- 8 files changed, 146 insertions(+), 39 deletions(-) create mode 100644 ee/cli/controllers/info.py create mode 100644 ee/cli/controllers/isl.py create mode 100644 ee/cli/controllers/secure.py diff --git a/ee/cli/bootstrap.py b/ee/cli/bootstrap.py index ba825f6b..c65a5d3f 100644 --- a/ee/cli/bootstrap.py +++ b/ee/cli/bootstrap.py @@ -11,6 +11,9 @@ from ee.cli.controllers.site import EESiteUpdateController from ee.cli.controllers.stack import EEStackController from ee.cli.controllers.debug import EEDebugController from ee.cli.controllers.clean import EECleanController +from ee.cli.controllers.secure import EESecureController +from ee.cli.controllers.isl import EEImportslowlogController +from ee.cli.controllers.info import EEInfoController def load(app): handler.register(EEBaseController) @@ -20,3 +23,6 @@ def load(app): handler.register(EEStackController) handler.register(EEDebugController) handler.register(EECleanController) + handler.register(EEInfoController) + handler.register(EEImportslowlogController) + handler.register(EESecureController) diff --git a/ee/cli/controllers/clean.py b/ee/cli/controllers/clean.py index 5a4db7c9..02fa508c 100644 --- a/ee/cli/controllers/clean.py +++ b/ee/cli/controllers/clean.py @@ -9,14 +9,19 @@ class EECleanController(CementBaseController): stacked_type = 'nested' description = 'clean command cleans different cache with following options' arguments = [ - (['-f', '--foo'], - dict(help='the notorious foo option', dest='foo', action='store', - metavar='TEXT') ), + (['--all'], + dict(help='clean all cache', action='store_true') ), + (['--fastcgi'], + dict(help='clean fastcgi cache', action='store_true')), + (['--memcache'], + dict(help='clean memcache', action='store_true')), + (['--opcache'], + dict(help='clean opcode cache cache', action='store_true')) ] @expose(hide=True) def default(self): - # Default action for ee clean command + # TODO Default action for ee clean command here print ("Inside EECleanController.default().") # clean command Options and subcommand calls and definations to diff --git a/ee/cli/controllers/debug.py b/ee/cli/controllers/debug.py index 45be835c..16022eba 100644 --- a/ee/cli/controllers/debug.py +++ b/ee/cli/controllers/debug.py @@ -9,14 +9,23 @@ class EEDebugController(CementBaseController): stacked_type = 'nested' description = 'debug command used for debugging issued with stack or site specific configuration' arguments = [ - (['-f', '--foo'], - dict(help='the notorious foo option', dest='foo', action='store', - metavar='TEXT') ), + (['--fpm'], + dict(help='debug fpm', action='store_true') ), + (['--mysql'], + dict(help='debug mysql', action='store_true') ), + (['--nginx'], + dict(help='debug nginx', action='store_true') ), + (['--php'], + dict(help='debug php', action='store_true') ), + (['--rewrite'], + dict(help='debug rewrite', action='store_true') ), + (['--stop'], + dict(help='stop debugging', action='store_true') ), ] @expose(hide=True) def default(self): - # Default action for ee debug command + # TODO Default action for ee debug command print ("Inside EEDebugController.default().") # debug command Options and subcommand calls and definations to diff --git a/ee/cli/controllers/info.py b/ee/cli/controllers/info.py new file mode 100644 index 00000000..a79562b1 --- /dev/null +++ b/ee/cli/controllers/info.py @@ -0,0 +1,21 @@ +from cement.core.controller import CementBaseController, expose + +class EEInfoController(CementBaseController): + class Meta: + label = 'info' + stacked_on = 'base' + stacked_type = 'nested' + description = 'info command used for debugging issued with stack or site specific configuration' + arguments = [ + (['--mysql'], + dict(help='get mysql configuration information', action='store_true') ), + (['--php'], + dict(help='get php configuration information', action='store_true') ), + (['--nginx'], + dict(help='get nginx configuration information', action='store_true') ), + ] + + @expose(hide=True) + def default(self): + # Default action for ee debug command + print ("Inside EEInfoController.default().") diff --git a/ee/cli/controllers/isl.py b/ee/cli/controllers/isl.py new file mode 100644 index 00000000..c1222c39 --- /dev/null +++ b/ee/cli/controllers/isl.py @@ -0,0 +1,21 @@ +from cement.core.controller import CementBaseController, expose + +class EEImportslowlogController(CementBaseController): + class Meta: + label = 'import_slow_log' + stacked_on = 'base' + stacked_type = 'nested' + description = 'info command used for debugging issued with stack or site specific configuration' + arguments = [ + (['--mysql'], + dict(help='get mysql configuration information', action='store_true') ), + (['--php'], + dict(help='get php configuration information', action='store_true') ), + (['--nginx'], + dict(help='get nginx configuration information', action='store_true') ), + ] + + @expose(hide=True) + def default(self): + # TODO Default action for ee debug command + print ("Inside EEImprtslowlogController.default().") diff --git a/ee/cli/controllers/secure.py b/ee/cli/controllers/secure.py new file mode 100644 index 00000000..578a5bc8 --- /dev/null +++ b/ee/cli/controllers/secure.py @@ -0,0 +1,22 @@ +from cement.core.controller import CementBaseController, expose + +class EESecureController(CementBaseController): + class Meta: + label = 'secure' + stacked_on = 'base' + stacked_type = 'nested' + description = 'secure command used for debugging issued with stack or site specific configuration' + arguments = [ + (['--ip'], + dict(help='whitelist ip addresses to access admin tools without authentication', + action='store_true') ), + (['--auth'], + dict(help='change http auth credentials', action='store_true') ), + (['--port'], + dict(help='change port for admin tools default is 22222', action='store_true') ), + ] + + @expose(hide=True) + def default(self): + # Default action for ee debug command + print ("Inside EESecureController.default().") diff --git a/ee/cli/controllers/site.py b/ee/cli/controllers/site.py index 1ef80860..3d63d125 100644 --- a/ee/cli/controllers/site.py +++ b/ee/cli/controllers/site.py @@ -10,7 +10,8 @@ class EESiteController(CementBaseController): stacked_type = 'nested' description = 'site command manages website configuration with the help of the following subcommands' arguments = [ - (['site_name'], dict(help='the notorious foo option') ), + (['site_name'], + dict(help='website name') ), ] @expose(hide=True) @@ -64,19 +65,7 @@ class EESiteController(CementBaseController): print("Inside EESiteController.cd().") - # site command Options and subcommand calls and definations to - # mention here - # 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/``. - # class EESiteCreateController(CementBaseController): class Meta: @@ -85,13 +74,20 @@ class EESiteCreateController(CementBaseController): stacked_type = 'nested' description = 'create command manages website configuration with the help of the following subcommands' arguments = [ - (['site_name'], dict(help='the notorious foo option') ), - (['--html'], dict(help="html site", action='store_true')), - (['--php'], dict(help="php site", action='store_true')), - (['--mysql'], dict(help="mysql site", action='store_true')), - (['--wp'], dict(help="wordpress site", action='store_true')), - (['--wpsubdir'], dict(help="wpsubdir site", action='store_true')), - (['--wpsubdomain'], dict(help="wpsubdomain site", action='store_true')), + (['site_name'], + dict(help='the notorious foo option') ), + (['--html'], + dict(help="html site", action='store_true')), + (['--php'], + dict(help="php site", action='store_true')), + (['--mysql'], + dict(help="mysql site", action='store_true')), + (['--wp'], + dict(help="wordpress site", action='store_true')), + (['--wpsubdir'], + dict(help="wpsubdir site", action='store_true')), + (['--wpsubdomain'], + dict(help="wpsubdomain site", action='store_true')), ] @expose(hide=True) @@ -106,15 +102,39 @@ class EESiteUpdateController(CementBaseController): stacked_type = 'nested' description = 'update command manages website configuration with the help of the following subcommands' arguments = [ - (['site_name'], dict(help='website name', nargs="1") ), - (['--html'], dict(help="html site", action='store_true')), - (['--php'], dict(help="php site", action='store_true')), - (['--mysql'], dict(help="mysql site", action='store_true')), - (['--wp'], dict(help="wordpress site", action='store_true')), - (['--wpsubdir'], dict(help="wpsubdir site", action='store_true')), - (['--wpsubdomain'], dict(help="wpsubdomain site", action='store_true')), + (['site_name'], + dict(help='website name', nargs="1") ), + (['--html'], + dict(help="html site", action='store_true')), + (['--php'], + dict(help="php site", action='store_true')), + (['--mysql'], + dict(help="mysql site", action='store_true')), + (['--wp'], + dict(help="wordpress site", action='store_true')), + (['--wpsubdir'], + dict(help="wpsubdir site", action='store_true')), + (['--wpsubdomain'], + dict(help="wpsubdomain site", action='store_true')), ] @expose(help="update example.com") def default(self): # TODO Write code for ee site update here print("Inside EESiteUpdateController.default().") + + + + + # site command Options and subcommand calls and definations to + # mention here + + # 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/``. + # diff --git a/ee/cli/controllers/stack.py b/ee/cli/controllers/stack.py index e83deb27..495a3df3 100644 --- a/ee/cli/controllers/stack.py +++ b/ee/cli/controllers/stack.py @@ -9,14 +9,17 @@ class EEStackController(CementBaseController): stacked_type = 'nested' description = 'stack command manages stack operations' arguments = [ - (['-f', '--foo'], - dict(help='the notorious foo option', dest='foo', action='store', - metavar='TEXT') ), + (['--web'], + dict(help='Install web stack', action='store_true') ), + (['--admin'], + dict(help='Install admin tools stack', action='store_true') ), + (['--mail'], + dict(help='Install mail server stack', action='store_true') ), ] @expose(hide=True) def default(self): - # Default action for ee stack command + # TODO Default action for ee stack command print ("Inside EEStackController.default().") # stack command Options and subcommand calls and definations to