Various CKAN-external bits and pieces. Varying degrees of documentation, generality, usefulness. Not for public consumption.
usage:ck_choices.py [-h] [--del] [--resource] FIELD TERM [TERM ...]
Make modifications to the controlled vocabulary FIELD (implemented as ckanext-scheming "choices"). positional arguments: FIELD the schema field to be modified TERM the terms to be added (removed). Have the format "value,label" for adding, and "value" for removing. optional arguments: -h, --help show this help message and exit --del delete terms (default is adding terms) --resource action refers to resource field (default is dataset field) Examples:ck_choices.py variables "new_var_1,New Variable One" newvar2,"Another One"
adds two new terms to the dataset_field "variables".ck_choices.py variables --del new_var_1 newvar2
deletes them.
Usage: ck-maintain off|on TIME
Switches maintenance modus for CKAN on or off. The maintenance-page, to which
users will be redirected, contains the string TIME as the expected time
when the service will become available again.
Note:
Here is an example for the maintenance-page: maintenance.html.
That page has to be put in the nginx document-root: /usr/share/nginx/html.
Example:
ssh production.server.ch sudo /home/user/bin/ck-maintain on \"$(date --date="today 18:30")\"
Switches maintenance mode on a remote server on.
[This is not yet very well tested]
Copies one package from one CKAN host to another. Instead of
specifying the hosts and API-keys on the command line, the direction,
-d (in|out)
, can be specified. In that case, defaults set
in the source of this script are used. Adapt constants $remote,
$local, $APIKEY_REMOTE and $APIKEY_LOCAL.
Usage: ck-cp -i id [-r] (-f fromhost -t tohost -a apikey-from,apikey-to | -d direction) ck-cp -h Options: -i id: package id or name -r: also copy resources -f fromhost: host of source of package -t tohost: host of target of package -a apikey-from,apikey-to: CKAN API-keys for the hosts -d direction: in (remote -> local) | out (local -> remote) -h: print this help Examples: ck-cp -i mypack0815 -f http://rem.ck.net -t http://localhost:5000 -a key_remote64,key_local94 ck-cp -i mypackage0816 -d out -r