Skip to content

Commit

Permalink
Merge branch 'master' into 1139-remove-moderated-from-config-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Aug 5, 2013
2 parents 2d9df92 + d8fcedf commit da5b2a1
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 5 deletions.
11 changes: 7 additions & 4 deletions ckan/logic/__init__.py
Expand Up @@ -202,7 +202,7 @@ def check_access(action, context, data_dict=None):
audit = context.get('__auth_audit', [])[-1]
except IndexError:
audit = ''
if audit == action:
if audit and audit[0] == action:
context['__auth_audit'].pop()

user = context.get('user')
Expand Down Expand Up @@ -346,14 +346,17 @@ def wrapped(context=None, data_dict=None, **kw):

# Auth Auditing
# store this action name in the auth audit so we can see if
# check access was called on the function
# check access was called on the function we store the id of
# the action incase the action is wrapped inside an action
# of the same name. this happens in the datastore
context.setdefault('__auth_audit', [])
context['__auth_audit'].append(action_name)
context['__auth_audit'].append((action_name, id(_action)))

# check_access(action_name, context, data_dict=None)
result = _action(context, data_dict, **kw)
try:
if context['__auth_audit'][-1] == action_name:
audit = context['__auth_audit'][-1]
if audit[0] == action_name and audit[1] == id(_action):
if action_name not in new_authz.auth_functions_list():
log.debug('No auth function for %s' % action_name)
elif not getattr(_action, 'auth_audit_exempt', False):
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Expand Up @@ -48,6 +48,7 @@
.. |storage_parent_dir| replace:: /var/lib/ckan
.. |storage_dir| replace:: |storage_parent_dir|/default
.. |reload_apache| replace:: sudo service apache2 reload
.. |restart_apache| replace:: sudo service apache2 restart
.. |solr| replace:: Solr
.. |restructuredtext| replace:: reStructuredText
.. |nginx| replace:: Nginx
Expand Down
102 changes: 101 additions & 1 deletion doc/upgrade-package-to-minor-release.rst
Expand Up @@ -8,5 +8,105 @@ Upgrading a CKAN 2 package install to a new minor release
themes or extensions you're using, check the changelog, and backup your
database. See :ref:`upgrading`.

.. todo:: Instructions for upgrading a package install to a new minor release
Each :ref:`minor release <releases>` is distributed in its own package,
so for example CKAN ``2.0.X`` and ``2.1.X`` will be installed using the
``python-ckan_2.0_amd64.deb`` and ``python-ckan_2.1_amd64.deb`` packages
respectively.

#. Download the CKAN package for the new minor release you want to upgrade
to (replace the version number with the relevant one)::

wget http://packaging.ckan.org/python-ckan_2.1_amd64.deb

#. Install the package with the following command::

sudo dpkg -i python-ckan_2.1_amd64.deb

.. note::

If you have changed the |apache| or |nginx| configuration files, you will
get a prompt like the following, asking whether to keep your local changes
or replace the files. You generally would like to keep your local changes
(option ``N``, which is the default), but you can look at the differences
between versions by selecting option ``D``::

Configuration file `/etc/apache2/sites-available/ckan_default'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** ckan_default (Y/I/N/O/D/Z) [default=N] ?

Your local CKAN configuration file in |config_dir| will not be replaced.

.. note::

The install process will uninstall any existing CKAN extensions or other
libraries located in the ``src`` directory of the CKAN virtualenv. To
enable them again, the installation process will iterate over all folders in
the ``src`` directory, reinstall the requirements listed in
``pip-requirements.txt`` and ``requirements.txt`` files and run
``python setup.py develop`` for each. If you are using a custom extension
which does not use this requirements file name or is located elsewhere,
you will need to manually reinstall it.

#. If there have been changes in the database schema (check the
:doc:`changelog` to find out) you need to update your CKAN database's
schema using the ``db upgrade`` command.

.. warning ::
To avoid problems during the database upgrade, comment out any plugins
that you have enabled in your ini file. You can uncomment them again when
the upgrade finishes.
For example:

.. parsed-literal::
paster db upgrade --config=\ |development.ini|
See :ref:`paster db` for details of the ``db upgrade``
command.

#. If there have been changes in the Solr schema (check the :doc:`changelog`
to find out) you need to update your Solr schema symlink.

When :ref:`setting up solr` you created a symlink
``/etc/solr/conf/schema.xml`` linking to a CKAN Solr schema file such as
|virtualenv|/src/ckan/ckan/config/solr/schema-2.0.xml. This symlink
should be updated to point to the latest schema file in
|virtualenv|/src/ckan/ckan/config/solr/, if it doesn't already.

For example, to update the symlink:

.. parsed-literal::
sudo rm /etc/solr/conf/schema.xml
sudo ln -s |virtualenv|/src/ckan/ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml
You will need to restart Jetty for the changes to take effect:

.. parsed-literal::
sudo service jetty restart
#. Rebuild your search index by running the ``ckan search-index rebuild``
command:

.. parsed-literal::
sudo ckan search-index rebuild -r
See :ref:`rebuild search index` for details of the
``ckan search-index rebuild`` command.

#. Finally, restart Apache:

.. parsed-literal::
|restart_apache|
6 changes: 6 additions & 0 deletions doc/upgrade-source.rst
Expand Up @@ -47,6 +47,12 @@ CKAN release you're upgrading to:
sudo rm /etc/solr/conf/schema.xml
sudo ln -s |virtualenv|/src/ckan/ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml
You will need to restart Jetty for the changes to take effect:

.. parsed-literal::
sudo service jetty restart
#. If you are upgrading to a new :ref:`major release <releases>` update your
CKAN database's schema using the ``db upgrade`` command.

Expand Down

0 comments on commit da5b2a1

Please sign in to comment.