cloudmesh / cloudmesh1

http://cloudmesh.org
Apache License 2.0
14 stars 12 forks source link

Independent cm man execution #157

Closed lee212 closed 9 years ago

lee212 commented 9 years ago

cm command is supposed to run without mongo running or celery running. To achieve this goal, we need to separate particular commands (i.e. cm man and cm [command] help) from the mongo initialization or celery connection.

cm man command provides a list of help messages for all available commands in cm. cm [command] help provides a help mssage on a given command.

Current cm looks like:

$ cm man
Failed to connect to MongoEngine DB:
    experiment
CM ... site/cloudmesh-1.0-py2.7.egg/cloudmesh/config/cm_config.pyc:92:  ERROR - Failed to connect to MongoEngine DB:
    experiment
Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/inventory
CM ... site/cloudmesh-1.0-py2.7.egg/cloudmesh/config/cm_config.pyc:80:  ERROR - Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/inventory
Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/defaults
CM ... site/cloudmesh-1.0-py2.7.egg/cloudmesh/config/cm_config.pyc:80:  ERROR - Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/defaults
Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/user
CM ... site/cloudmesh-1.0-py2.7.egg/cloudmesh/config/cm_config.pyc:80:  ERROR - Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/user
Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/cloudmesh
CM ... site/cloudmesh-1.0-py2.7.egg/cloudmesh/config/cm_config.pyc:80:  ERROR - Failed to connect to Mongoclient DB:
    mongodb:// @localhost:27017/cloudmesh

Commands

We may not see this error once we split the loading mongo db from help or man command.

lee212 commented 9 years ago

In cmd3, DynamicCmd() imports plugins in cloudmesh and some of the plugins create mongodb connection in their imports. These imports are removed or moved into the function where it uses to change the scope of the imports. This change removes db connection when we run cm.

In addition, some plugins initialize cm_mongo() class objects inside of the activate_cm_shell_xxx() function in which cmd3 registers command. This wrong use have been fixed by moving the initializations to the outside of activate_cm_shell_xxx().

cm man is now executable without creating mongodb connection.