karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

No error or failing return code when not supplying settings #1

Closed mmulich closed 8 years ago

mmulich commented 8 years ago

We need to return an error when the user fails to supply settings for the database connection.

For example:

~/cnx/src/cnx-archive$ dbmigrator init
~/cnx/src/cnx-archive$ echo $?
0

So it worked, right? :wink:

karenc commented 8 years ago

I think this is because there's a development.ini in the current working directory, which is the default location for the config file, and the development.ini has a db-connection-string setting so dbmigrator init is happy and actually did something. (I guess it should've printed something :stuck_out_tongue:)

If you do this in a directory that doesn't have a development.ini:

karen@trusty:~$ dbmigrator init
Traceback (most recent call last):
  File "/usr/local/bin/dbmigrator", line 9, in <module>
    load_entry_point('db-migrator==0.0.1', 'console_scripts', 'dbmigrator')()
  File "/usr/local/lib/python2.7/dist-packages/db_migrator-0.0.1-py2.7.egg/dbmigrator/cli.py", line 57, in main
    return args['cmmd'](**args)
  File "/usr/local/lib/python2.7/dist-packages/db_migrator-0.0.1-py2.7.egg/dbmigrator/utils.py", line 60, in wrapper
    raise Exception('db-connection-string missing')
Exception: db-connection-string missing
karenc commented 8 years ago

^ Will now print a message: Schema migrations initialized. after running dbmigrator init :)

Do you want the default behavior to change?

mmulich commented 8 years ago

Yes, I think the default behavior should change. I was not excepting this general purpose tool to have an awareness of our configuration file structure. Let's try not to closely mimic the CWD behavioral assumption that rake and django use.

karenc commented 8 years ago

Removed default config path (development.ini)