Skip to content

Commit

Permalink
[fix][s]: Move config check due to master changes and change config f…
Browse files Browse the repository at this point in the history
…ile name
  • Loading branch information
mpolidori committed Jan 22, 2020
1 parent db9cdb0 commit 5e99eb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ckan/cli/cli.py
Expand Up @@ -5,6 +5,7 @@

import six
import click
import sys

import ckan.plugins as p
from ckan.config.middleware import make_app
Expand Down Expand Up @@ -44,6 +45,12 @@ def __init__(self, conf=None):


def _init_ckan_config(ctx, param, value):

# This is necessary to allow the user to create
# a config file when one isn't already present
if len(sys.argv) > 1 and sys.argv[1] == 'generate' and not value:
return

ctx.obj = CkanCommand(value)
if six.PY2:
ctx.meta["flask_app"] = ctx.obj.app.apps["flask_app"]._wsgi_app
Expand Down
11 changes: 6 additions & 5 deletions ckan/cli/generate.py
Expand Up @@ -87,16 +87,17 @@ def extension(output_dir):
u'template.')
def make_config(output_dir):
if output_dir is None:
print('\nERROR: Try again with \'-o path/to/file.ini\'')
print('\nERROR: Try again with \'-o path/to/ckan.ini\'')
sys.exit(1)

names = ['development.ini', 'production.ini']
name = 'ckan.ini'

if not any(name in output_dir for name in names):
print('\nERROR: File name must be development.ini or production.ini')
if name not in output_dir:
print('\nERROR: Config file must be named "ckan.ini"')
sys.exit(1)

if output_dir in names:
# Output to current directory if no path is specified
if output_dir == name:
output_dir = os.getcwd() + '/' + output_dir

cur_loc = os.path.dirname(os.path.abspath(__file__))
Expand Down

0 comments on commit 5e99eb1

Please sign in to comment.