Here is a sample migration script (see also the cubicweb documentation on that topic) which changes the variable 'sender-addr'. There is an additional twist in that the variable is only updated if the instance is configured with a known value for that variable.

wrong_addr = '' # known wrong address
fixed_addr = ''
configured_addr = config.get('sender-addr')
# check that the address has not been hand fixed by a sysadmin
if configured_addr == wrong_addr:
    config['sender-addr'] = fixed-addr

This is very useful in cases such as:

  • automatically changing the value of a variable which used a default value set by cubicweb-ctl create
  • changing the configuration of an instance with limited intervention from the local sysadmin (because asking him to hand edit the config file is error prone): he just has to deploy the new release and run cubicweb-ctl upgrade
  • fixing issues caused by settings in the all-in-one.conf file (e.g. changing the value of max-post-length)
blog entry of