Exemplo n.º 1
0
    def validate_config(self):
        """Verify that all required config settings are present"""
        ServerHeraldNotifyBase.validate_config(self)

        # Nexmo requires an API key, API secret, a from and a to phone
        # number
        if not self.config_has('nexmo'):
            print(
                '`nexmo` notification type requires a nexmo API key, API '
                'secret, a recipient and a sending phone number to be '
                'specified in the config file.')
            sys.exit(1)

        required_fields = {
            'apikey':
            'nexmo requires an API key in the config file',
            'apisecret':
            'nexmo requires an API secret in the config file',
            'from': ('nexmo requires a sending name or number in the config'
                     'file'),
            'to':
            'nexmo requires a recipient phone number in the config file'
        }

        for field, message in required_fields.iteritems():
            if not self.config_has('nexmo', field):
                print message
                sys.exit(1)
Exemplo n.º 2
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # Twilio requires an Account SID, a token, a from, and a to phone
        # number
        if not self.config_has('twilio'):
            print(
                '`twilio` notification type requires a Twilio Account SID'
                ', a token, a recipient and a sending phone number to be '
                'specified in the config file.')
            sys.exit(1)

        required_fields = {
            'accountsid':
            'Twilio requires an Account SID in the config file',
            'token':
            'Twilio requires a token in the config file',
            'from': ('Twilio requires a sending phone number in the config '
                     'file'),
            'to': ('Twilio requires a recipient phone number in the config '
                   'file')
        }

        for field, message in required_fields.iteritems():
            if not self.config_has('twilio', field):
                print message
                sys.exit(1)
Exemplo n.º 3
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # Twilio requires an Account SID, a token, a from, and a to phone
        # number
        if not self.config_has('twilio'):
            print ('`twilio` notification type requires a Twilio Account SID'
                   ', a token, a recipient and a sending phone number to be '
                   'specified in the config file.')
            sys.exit(1)

        required_fields = {
            'accountsid': 'Twilio requires an Account SID in the config file',
            'token': 'Twilio requires a token in the config file',
            'from': ('Twilio requires a sending phone number in the config '
                     'file'),
            'to': ('Twilio requires a recipient phone number in the config '
                   'file')}

        for field, message in required_fields.iteritems():
            if not self.config_has('twilio', field):
                print message
                sys.exit(1)
Exemplo n.º 4
0
    def validate_config(self):
        """Email notifications require a `to` and `from` address"""
        ServerHeraldNotifyBase.validate_config(self)

        if not self.config_has('email') or not self.config_has('email', 'to'):
            print 'There are no recipient email addresses in the config file'
            sys.exit(1)

        if not self.config_has('email', 'from'):
            print 'A from address has not been specified in the config file'
            sys.exit(1)
Exemplo n.º 5
0
    def validate_config(self):
        """Email notifications require a `to` and `from` address"""
        ServerHeraldNotifyBase.validate_config(self)

        if not self.config_has('email') or not self.config_has('email', 'to'):
            print 'There are no recipient email addresses in the config file'
            sys.exit(1)

        if not self.config_has('email', 'from'):
            print 'A from address has not been specified in the config file'
            sys.exit(1)
Exemplo n.º 6
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # Webhook requires a URL
        if not self.config_has('webhook'):
            print ('`webhook` notification type requires a URL to be '
                   'specified in the config file.')
            sys.exit(1)

        if not self.config_has('webhook', 'url'):
            print 'Webhook requires a URL in the config file'
            sys.exit(1)
Exemplo n.º 7
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # PagerDuty requires an API key
        if not self.config_has('pagerduty'):
            print ('`pagerduty` notification type requires a PagerDuty API '
                   'key to be specified in the config file.')
            sys.exit(1)

        if not self.config_has('pagerduty', 'apikey'):
            print 'PagerDuty requires an API key in the config file'
            sys.exit(1)
Exemplo n.º 8
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # Prowl requires an API key
        if not self.config_has('prowl'):
            print ('`prowl` notification type requires a Prowl API key to be '
                   'specified in the config file.')
            sys.exit(1)

        if not self.config_has('prowl', 'apikey'):
            print 'Prowl requires an API key in the config file'
            sys.exit(1)
Exemplo n.º 9
0
    def validate_config(self):
        """Verify that all required config settings are present"""

        ServerHeraldNotifyBase.validate_config(self)

        # Webhook requires a URL
        if not self.config_has('webhook'):
            print(
                '`webhook` notification type requires a URL to be '
                'specified in the config file.')
            sys.exit(1)

        if not self.config_has('webhook', 'url'):
            print 'Webhook requires a URL in the config file'
            sys.exit(1)
Exemplo n.º 10
0
    def validate_config(self):
        """Verify that all required config settings are present"""
        ServerHeraldNotifyBase.validate_config(self)

        # Nexmo requires an API key, API secret, a from and a to phone
        # number
        if not self.config_has('nexmo'):
            print ('`nexmo` notification type requires a nexmo API key, API '
                   'secret, a recipient and a sending phone number to be '
                   'specified in the config file.')
            sys.exit(1)

        required_fields = {
            'apikey': 'nexmo requires an API key in the config file',
            'apisecret': 'nexmo requires an API secret in the config file',
            'from': ('nexmo requires a sending name or number in the config'
                     'file'),
            'to': 'nexmo requires a recipient phone number in the config file'}

        for field, message in required_fields.iteritems():
            if not self.config_has('nexmo', field):
                print message
                sys.exit(1)