Metadata

One minor bug fix, config file readability, plus implementation of metadata IP and port in configuration.
This has been resolved in the tests branch, when I wrote tests for this code. So will go away when that is merged.

From: Cory Benfield [mailto:notifications@github.com]
Sent: 20 November 2014 14:16
To: Metaswitch/calico
Cc: Peter White
Subject: Re: [calico] Metadata (#49)


In calico/felix/config.py:

> +    def validate_cfg(self):

> +        #*********************************************************************#

> +        #* Firewall that the config is not invalid.                          *#

> +        #*********************************************************************#

> +        if self.METADATA_IP.lower() == "none":

> +            # Metadata is not required.

> +            self.METADATA_IP = None

> +            self.METADATA_PORT = None

> +        else:

> +            if not IPV4_REGEX.match(self.METADATA_IP):

> +                raise Exception("Invalid MetadataIP value : %s" %

> +                                self.METADATA_IP)

> +            if not INT_REGEX.match(self.METADATA_PORT):

> +                raise Exception("Invalid MetadataPort value : %s" %

> +                                self.METADATA_PORT)

> +

As a follow-on, I hate that these are undecorated Exceptions. We should really be doing:

class ConfigError(Exception):

    """

    An error caused by invalid configuration.

    """

    pass

Adding this to a calico.felix.exceptions module is probably a good idea, we can then raise this where appropriate.

—
Reply to this email directly or view it on GitHub<https://github.com/Metaswitch/calico/pull/49/files#r20647077>.