Celery task.
    It will extract the backup archive into a unique folder
    in the temporary directory specified in the configuration.

    Once extracted, a Docker container will be started and will
    start a restoration procedure. The worker will wait for the
    container to exit and retrieve its return code.
    A notification is sent if the return code is != 0.
    If the return code == 0, the container will be removed.

    Lastly, it will remove the temporary workdir.

def validate_backup(configuration, backup_data):
    """Celery task.
    It will extract the backup archive into a unique folder
    in the temporary directory specified in the configuration.

    Once extracted, a Docker container will be started and will
    start a restoration procedure. The worker will wait for the
    container to exit and retrieve its return code.
    A notification is sent if the return code is != 0.
    If the return code == 0, the container will be removed.

    Lastly, it will remove the temporary workdir.
    """
    extract_archive(backup_data['archive_path'],
                    backup_data['workdir'])
    docker_client = Client(configuration['docker']['url'])
    container = run_container(docker_client, backup_data)
    return_code = docker_client.wait(container)
    print('Container return code: {}'.format(return_code))
    if return_code != 0:
        notifier = MailNotifier(configuration['mail'])
        report = {'archive': backup_data['archive_path'],
                  'image': backup_data['image'],
                  'container_id': container.get('Id')}
        notifier.send_report(report)
    else:
        docker_client.remove_container(container)
    remove_file(backup_data['workdir'])