Repository: ckan/ckan

Issue:
rebuild_fast is broken
### CKAN Version if known (or site URL)
2.8.2

### Please describe the expected behaviour
`rebuild_fast` should work.

### Please describe the actual behaviour

```
root@dfa227c64a65:/usr/lib/ckan/venv/src/ckan# ckan-paster search-index rebuild_fast --config /etc/ckan/production.ini
Traceback (most recent call last):
  File "/usr/local/bin/ckan-paster", line 11, in <module>
    sys.exit(run())
  File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/venv/src/ckan/ckan/lib/cli.py", line 574, in command
    self.rebuild_fast()
  File "/usr/lib/ckan/venv/src/ckan/ckan/lib/cli.py", line 630, in rebuild_fast
    conf = self._get_config()
AttributeError: 'SearchIndexCommand' object has no attribute '_get_config'
root@dfa227c64a65:/usr/lib/ckan/venv/src/ckan# ckan-paster search-index rebuild --config /etc/ckan/production.ini
2019-03-07 11:29:55,367 DEBUG [ckanext.spatial.plugin] Setting up the spatial model
2019-03-07 11:29:55,433 DEBUG [ckanext.spatial.model.package_extent] Spatial tables defined in memory
2019-03-07 11:29:55,448 DEBUG [ckanext.spatial.model.package_extent] Spatial tables already exist
2019-03-07 11:29:55,760 DEBUG [ckanext.spatial.plugin] Setting up the spatial model
2019-03-07 11:29:55,773 DEBUG [ckanext.spatial.model.package_extent] Spatial tables already exist
```
### What steps can be taken to reproduce the issue? 

See above.


Discussion:
Found this because it's also broke in 2.7.5

```
Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 10, in <module>
    sys.exit(run())
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 549, in command
    self.rebuild_fast()
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 605, in rebuild_fast
    conf = self._get_config()
AttributeError: 'SearchIndexCommand' object has no attribute '_get_config'
```

Resolving patch:
diff --git a/ckan/lib/cli.py b/ckan/lib/cli.py
--- a/ckan/lib/cli.py
+++ b/ckan/lib/cli.py
@@ -548,7 +548,7 @@ def clear(self):
 
     def rebuild_fast(self):
         ###  Get out config but without starting pylons environment ####
-        conf = self._get_config()
+        conf = _get_config()
 
         ### Get ids using own engine, otherwise multiprocess will balk
         db_url = conf['sqlalchemy.url']


Test patch: