Changeset 0a33e75 in rattail-fabric2


Ignore:
Timestamp:
02/19/19 22:15:16 (2 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
bac7876
Parents:
bc4a8a6
Message:

Add some cleanup functions for use when cloning rattail DBs

i.e. disable some email config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail_fabric2/rattail.py

    rbc4a8a6 r0a33e75  
    2929import os
    3030
    31 from rattail_fabric2 import make_deploy, make_system_user, mkdir
     31from rattail_fabric2 import postgresql, make_deploy, make_system_user, mkdir
    3232
    3333
     
    5555    deploy(c, 'datasync', '/srv/rattail/init/datasync', use_sudo=True)
    5656    deploy(c, 'filemon', '/srv/rattail/init/filemon', use_sudo=True)
     57
     58
     59def delete_email_recipients(c, dbname):
     60    """
     61    Purge all email recipient settings for the given database.
     62    """
     63    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.to';", database=dbname)
     64    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.cc';", database=dbname)
     65    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.bcc';", database=dbname)
     66
     67
     68def disable_emails(c, dbname):
     69    """
     70    Disable all emails for the given database.
     71    """
     72    postgresql.sql(c, "update setting set value = 'false' where name like 'rattail.mail.%.enabled';", database=dbname)
Note: See TracChangeset for help on using the changeset viewer.