Changeset - 0a33e7569b0a
[Not reviewed]
0 1 0
Lance Edgar - 6 years ago 2019-02-19 22:15:16
ledgar@techsupport.coop
Add some cleanup functions for use when cloning rattail DBs

i.e. disable some email config
1 file changed with 17 insertions and 1 deletions:
0 comments (0 inline, 0 general) First comment
rattail_fabric2/rattail.py
Show inline comments
 
@@ -28,7 +28,7 @@ from __future__ import unicode_literals, absolute_import
 

	
 
import os
 

	
 
from rattail_fabric2 import make_deploy, make_system_user, mkdir
 
from rattail_fabric2 import postgresql, make_deploy, make_system_user, mkdir
 

	
 

	
 
deploy = make_deploy(__file__)
 
@@ -54,3 +54,19 @@ def bootstrap_rattail(c, home='/var/lib/rattail', uid=None, shell='/bin/bash'):
 
    deploy(c, 'bouncer', '/srv/rattail/init/bouncer', use_sudo=True)
 
    deploy(c, 'datasync', '/srv/rattail/init/datasync', use_sudo=True)
 
    deploy(c, 'filemon', '/srv/rattail/init/filemon', use_sudo=True)
 

	
 

	
 
def delete_email_recipients(c, dbname):
 
    """
 
    Purge all email recipient settings for the given database.
 
    """
 
    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.to';", database=dbname)
 
    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.cc';", database=dbname)
 
    postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.bcc';", database=dbname)
 

	
 

	
 
def disable_emails(c, dbname):
 
    """
 
    Disable all emails for the given database.
 
    """
 
    postgresql.sql(c, "update setting set value = 'false' where name like 'rattail.mail.%.enabled';", database=dbname)
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now