Skip to content

Commit f84cb70

Browse files
Fix uninitialized variables (#17771)
* Fix uninitialized variables * Added changelog
1 parent 65356f0 commit f84cb70

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix uninitialized variables

openstack_controller/datadog_checks/openstack_controller/components/bare_metal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def _report_nodes(self, config, tags):
6262
if isinstance(config_nodes, bool):
6363
report_nodes = config_nodes
6464
config_nodes = {}
65+
discovered_nodes = []
6566
if report_nodes:
6667
nodes_discovery = None
6768
if config_nodes:
@@ -82,6 +83,7 @@ def _report_nodes(self, config, tags):
8283
discovered_nodes = [
8384
(None, node.get('name'), node, None) for node in self.check.api.get_baremetal_nodes()
8485
]
86+
self.check.log.debug("discovered_nodes: %s", discovered_nodes)
8587
for _pattern, _item_name, item, item_config in discovered_nodes:
8688
self.check.log.debug("item: %s", item)
8789
self.check.log.debug("item_config: %s", item_config)
@@ -199,8 +201,7 @@ def _report_volume_targets(self, config, tags):
199201
@Component.register_global_metrics(ID)
200202
@Component.http_error()
201203
def _report_drivers(self, config, tags):
202-
if 'drivers' not in config:
203-
report_drivers = config.get('drivers', True)
204+
report_drivers = config.get('drivers', True)
204205
if report_drivers:
205206
data = self.check.api.get_baremetal_drivers()
206207
for item in data:
@@ -216,8 +217,7 @@ def _report_drivers(self, config, tags):
216217
@Component.register_global_metrics(ID)
217218
@Component.http_error()
218219
def _report_allocations(self, config, tags):
219-
if 'allocations' not in config:
220-
report_allocations = config.get('allocations', True)
220+
report_allocations = config.get('allocations', True)
221221
if report_allocations:
222222
data = self.check.api.get_baremetal_allocations()
223223
for item in data:

0 commit comments

Comments
 (0)