Do not log unconfigured collector as warning
The configuration will dictate whether or not something is configured. If it is not, this is a normal state and should not be logged as a warning. Change-Id: I479f0aed5837871009bc69fa028f5eb64a060c53 Closes-Bug: #1321551
This commit is contained in:
parent
42efe2b969
commit
79efeba4c3
|
@ -134,6 +134,9 @@ def collect_all(collectors, store=False, collector_kwargs_map=None):
|
||||||
except exc.SourceNotAvailable:
|
except exc.SourceNotAvailable:
|
||||||
logger.warn('Source [%s] Unavailable.' % collector)
|
logger.warn('Source [%s] Unavailable.' % collector)
|
||||||
continue
|
continue
|
||||||
|
except exc.SourceNotConfigured:
|
||||||
|
logger.debug('Source [%s] Not configured.' % collector)
|
||||||
|
continue
|
||||||
|
|
||||||
if store:
|
if store:
|
||||||
for output_key, output_content in content:
|
for output_key, output_content in content:
|
||||||
|
|
|
@ -18,6 +18,10 @@ class SourceNotAvailable(RuntimeError):
|
||||||
"""The requested data source is unavailable."""
|
"""The requested data source is unavailable."""
|
||||||
|
|
||||||
|
|
||||||
|
class SourceNotConfigured(RuntimeError):
|
||||||
|
"""The requested data source is not configured."""
|
||||||
|
|
||||||
|
|
||||||
class Ec2MetadataNotAvailable(SourceNotAvailable):
|
class Ec2MetadataNotAvailable(SourceNotAvailable):
|
||||||
"""The EC2 metadata service is not available."""
|
"""The EC2 metadata service is not available."""
|
||||||
|
|
||||||
|
@ -30,11 +34,11 @@ class HeatMetadataNotAvailable(SourceNotAvailable):
|
||||||
"""The heat metadata service is not available."""
|
"""The heat metadata service is not available."""
|
||||||
|
|
||||||
|
|
||||||
class CfnMetadataNotConfigured(SourceNotAvailable):
|
class CfnMetadataNotConfigured(SourceNotConfigured):
|
||||||
"""The cfn metadata service is not fully configured."""
|
"""The cfn metadata service is not fully configured."""
|
||||||
|
|
||||||
|
|
||||||
class HeatMetadataNotConfigured(SourceNotAvailable):
|
class HeatMetadataNotConfigured(SourceNotConfigured):
|
||||||
"""The heat metadata service is not fully configured."""
|
"""The heat metadata service is not fully configured."""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ class TestCollect(testtools.TestCase):
|
||||||
class TestCollectAll(testtools.TestCase):
|
class TestCollectAll(testtools.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCollectAll, self).setUp()
|
super(TestCollectAll, self).setUp()
|
||||||
self.useFixture(fixtures.FakeLogger())
|
self.log = self.useFixture(fixtures.FakeLogger())
|
||||||
collect.setup_conf()
|
collect.setup_conf()
|
||||||
self.cache_dir = self.useFixture(fixtures.TempDir())
|
self.cache_dir = self.useFixture(fixtures.TempDir())
|
||||||
self.backup_cache_dir = self.useFixture(fixtures.TempDir())
|
self.backup_cache_dir = self.useFixture(fixtures.TempDir())
|
||||||
|
@ -440,6 +440,19 @@ class TestCollectAll(testtools.TestCase):
|
||||||
self.assertThat(content, matchers.IsInstance(dict))
|
self.assertThat(content, matchers.IsInstance(dict))
|
||||||
self.assertNotIn('ec2', content)
|
self.assertNotIn('ec2', content)
|
||||||
|
|
||||||
|
def test_collect_all_cfn_unconfigured(self):
|
||||||
|
collector_kwargs_map = {
|
||||||
|
'cfn': {'requests_impl': test_cfn.FakeRequests(self)}
|
||||||
|
}
|
||||||
|
cfg.CONF.cfn.metadata_url = None
|
||||||
|
(changed_keys, content) = self._call_collect_all(
|
||||||
|
store=False, collector_kwargs_map=collector_kwargs_map,
|
||||||
|
collectors=['heat_local', 'cfn'])
|
||||||
|
self.assertIn('No metadata_url configured', self.log.output)
|
||||||
|
self.assertNotIn('cfn', content)
|
||||||
|
self.assertIn('heat_local', content)
|
||||||
|
self.assertEqual(test_heat_local.META_DATA, content['heat_local'])
|
||||||
|
|
||||||
|
|
||||||
class TestConf(testtools.TestCase):
|
class TestConf(testtools.TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue