def restore(): source = get_ssh_backup_dir() if not exists(source): log.info('No .ssh dir found... skipping.') return log.info('Restoring .ssh dir...') dest = get_ssh_user_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, get_user())
def restore(): log.info('Restoring shared file lists...') dest = config.get_shared_file_lists_dir() source = config.get_shared_file_lists_backup_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, config.get_user())
def restore_system_daemons_agents(): source = config.get_system_launch_daemons_backup_dir() dest = config.get_system_launch_daemons_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, 'root:wheel', '644')
def restore_user_launch_agents(): source = config.get_user_launch_agents_backup_dir() dest = config.get_user_launch_agents_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, config.get_user())
def restore(): print 'Restoring preferences (.plist)...' source = get_preferences_backup_dir() dest = get_preferences_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, get_user())
def test_ensure_dir_owned_by_user(chmod_mock, chown_mock, listable_mock): dest = config.get_ssh_user_dir utils.ensure_dir_owned_by_user(dest, 'clint') chmod_mock.assert_called_with(dest, '600') chown_mock.assert_called_with(dest, 'clint') listable_mock.assert_called_with(dest)