#!/usr/bin/env python
# Usage: devops disk [-h] [-r ROLE]
# Summary: Check disk details for specific roles
import sys
import os
import subprocess

pylib_dir = os.environ['_DEVOPS_ROOT'] + "/share/devops/"
sys.path.insert(0, pylib_dir)
import devop_config

CONFIG = devop_config.config()


def run_backup(role=None):
    disk_cmds=('sudo /usr/local/bin/sqlite_backup /usr/local/etc/sqlite3/coffee.db3 /backups',)
    for dc in disk_cmds:
        devop_config.ssh_cmd('{}'.format(dc), role=role)


def main():
    parser = devop_config.devop_args()
    args = parser.parse_args()

    if args.role is not None:
        role=args.role
    else:
        role=CONFIG.get('defaults','role')

    run_backup(role)

if __name__ == "__main__":
	main()
