Example #1
0
class YamlProfileAliasProvider(MemoryProfileAliasProvider):
    def __init__(self, subject):
        self.cache = DiskCache('alias_cache_v1.yaml', format='yaml', compression = 'gzip', validator=alias_cache_validator)
        self.store = self.cache.safe_load(dict)
        super(YamlProfileAliasProvider, self).__init__(subject, self.store)

    def set_alias(self, name, service, protocol, alias):
        if alias is None or alias == name:
            return
        if super(YamlProfileAliasProvider, self).find_alias(name, service, protocol) != alias:
            super(YamlProfileAliasProvider, self).set_alias(name, service, protocol, alias)
            self.cache.save(self.store)
Example #2
0
 def __init__(self, subject):
     self.cache = DiskCache('alias_cache_v1.yaml', format='yaml', compression = 'gzip', validator=alias_cache_validator)
     self.store = self.cache.safe_load(dict)
     super(YamlProfileAliasProvider, self).__init__(subject, self.store)