def test_pattern(self):
     lower_configs = {
         1: {}
     }
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(
         None, None, lower_refs, 'pattern', pattern='hello')
     self.assertEqual(assigned, {1: 'hello'})
예제 #2
0
 def test_pattern(self):
     lower_configs = {1: {}}
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(None,
                                                            None,
                                                            lower_refs,
                                                            'pattern',
                                                            pattern='hello')
     self.assertEqual(assigned, {1: 'hello'})
 def test_pattern_lower_keys(self):
     lower_configs = {
         1: {}
     }
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(
         None, None, lower_refs, 'pattern',
         lower_keys=['hostname'], pattern='%(hostname)s',
         hostname={1: 'myhost'})
     self.assertEqual(assigned, {1: 'myhost'})
예제 #4
0
 def test_pattern_lower_keys(self):
     lower_configs = {1: {}}
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(
         None,
         None,
         lower_refs,
         'pattern',
         lower_keys=['hostname'],
         pattern='%(hostname)s',
         hostname={1: 'myhost'})
     self.assertEqual(assigned, {1: 'myhost'})
 def test_pattern_extra_kwargs(self):
     lower_configs = {
         1: {}
     }
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(
         None, None, lower_refs, 'pattern',
         upper_keys=['clustername'],
         lower_keys=['hostname'],
         pattern='%(hostname)s.%(clustername)s',
         hostname={1: 'myhost'}, clustername='mycluster',
         hostid={1: 'myhost'}, clusterid=1)
     self.assertEqual(assigned, {1: 'myhost.mycluster'})
예제 #6
0
 def test_pattern_extra_kwargs(self):
     lower_configs = {1: {}}
     lower_refs = {}
     for hostid, config in lower_configs.items():
         lower_refs[hostid] = config_reference.ConfigReference(config)
     assigned = config_merger_callbacks.assign_from_pattern(
         None,
         None,
         lower_refs,
         'pattern',
         upper_keys=['clustername'],
         lower_keys=['hostname'],
         pattern='%(hostname)s.%(clustername)s',
         hostname={1: 'myhost'},
         clustername='mycluster',
         hostid={1: 'myhost'},
         clusterid=1)
     self.assertEqual(assigned, {1: 'myhost.mycluster'})