Beispiel #1
0
def _validate_feed(config):
    """
    Validates the location of the puppet modules.
    """

    # The feed is optional
    if constants.CONFIG_FEED not in config.keys():
        return True, None

    # Ask the downloader factory to validate the feed has a supported downloader
    feed = config.get(constants.CONFIG_FEED)
    is_valid = downloader_factory.is_valid_feed(feed)
    if not is_valid:
        return False, _('The feed <%(f)s> is invalid') % {'f' : feed}

    return True, None
 def test_is_valid_feed_false(self):
     self.assertFalse(factory.is_valid_feed(None))
 def test_is_valid_feed(self):
     self.assertTrue(factory.is_valid_feed('file://localhost'))