def my_cfg(config): new_cfg = config.copy() bk_cfg = new_cfg.get("backup", {}) bk_cfg.update({"driver": "borg", "pswd": "123456789", "compression": "zlib,3"}) del bk_cfg["cmd"] new_cfg["backup"] = bk_cfg.copy() yield new_cfg
def my_cfg(config): new_cfg = config.copy() db_cfg = new_cfg.get("database", {}) db_cfg.update({"driver": "mysql", "database": ["testing"]}) del db_cfg["cmd"] new_cfg["database"] = db_cfg.copy() yield new_cfg
def my_cfg(config): new_cfg = config.copy() bk_cfg = new_cfg.get("backup", {}) bk_cfg.update({"driver": "tar", "name": "{hostname}.tar.xz"}) del bk_cfg["cmd"] del bk_cfg["pre_hook"] del bk_cfg["post_hook"] new_cfg["backup"] = bk_cfg.copy() yield new_cfg
def my_cfg(config): new_cfg = config.copy() new_cfg.setdefault("sync", {}).update({ "driver": "rsync", "dist": "[email protected]:~/{hostname}", "delete": True, "excludes": ["test"], "ssh_opts": "ssh -p 4242", }) yield new_cfg
def my_cfg(config): new_cfg = config.copy() new_cfg.setdefault("notifier", {}).update( { "driver": "email", "subject": "Panic", "from": "*****@*****.**", "to": "*****@*****.**", "host": "smtp.mailgun.org", "port": 587, "login": "******", "pswd": "p455w0rd", } ) yield new_cfg
def my_cfg(config, tmpdir_factory): db_file = Path(str(tmpdir_factory.mktemp("db"))).resolve() db_file = db_file / "stocks.db" conn = sqlite3.connect(str(db_file)) c = conn.cursor() c.execute("""CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)""") c.execute( "INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)") conn.commit() conn.close() new_cfg = config.copy() db_cfg = new_cfg.get("database", {}) db_cfg.update({"driver": "sqlite", "database": [str(db_file)]}) del db_cfg["cmd"] new_cfg["database"] = db_cfg.copy() yield new_cfg
def my_cfg(config): new_cfg = config.copy() new_cfg.update({"notifier": {"driver": "print"}}) yield new_cfg
def my_cfg(config): new_cfg = config.copy() new_cfg.setdefault("sync", {}).update( {"driver": "rclone", "dist": "s3:backup/{hostname}"} ) yield new_cfg