File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -102,12 +102,18 @@ def collect(self):
102102 self .log .error ('Unable to import module psycopg2' )
103103 return {}
104104
105- # Check instances
106- if self .config ['instances' ] == {}:
107- self .log .error ("Instances are not configured!" )
108- return {}
109-
110- for instance in self .config ['instances' ].keys ():
105+ instances = self .config .get ('instances' )
106+
107+ # HACK: setting default with subcategory messes up merging of configs,
108+ # so we only set the default if one wasn't provided.
109+ if not instances :
110+ instances = {
111+ 'default' : {
112+ 'host' : 'localhost' ,
113+ }
114+ }
115+
116+ for instance in instances :
111117 # Get list of databases
112118 dbs = self ._get_db_names (instance )
113119 if len (dbs ) == 0 :
Original file line number Diff line number Diff line change @@ -38,10 +38,6 @@ def setUp(self, allowed_names=None):
3838 def test_import (self ):
3939 self .assertTrue (PostgresqlCollector )
4040
41- def test_config_with_empty_instance (self ):
42- result = self .default_collector .collect ()
43- self .assertEqual (result , {})
44-
4541 def test_config_override (self ):
4642 self .assertEqual (self .collector ._get_config ('postgres_a' , 'port' ), 5432 )
4743
You can’t perform that action at this time.
0 commit comments