# Copyright (c) 2015 iXsystems, Inc.
# All rights reserved.
# This file is a part of TrueNAS
# and may not be copied and/or distributed
# without the express permission of iXsystems.

import os

from django.utils.translation import ugettext as _

from freenasUI.system.alert import alertPlugins, Alert, BaseAlert

SYNC_FILE = '/var/tmp/sync_failed'


class FailoverSyncAlert(BaseAlert):

    def run(self):
        if os.path.exists(SYNC_FILE):
            return [
                Alert(
                    Alert.CRIT,
                    _('Automatic sync to peer failed, please run it manually')
                )
            ]

alertPlugins.register(FailoverSyncAlert)
