diff --git a/ironic_inspector/conf/default.py b/ironic_inspector/conf/default.py index 5c7c75a97..b840341be 100644 --- a/ironic_inspector/conf/default.py +++ b/ironic_inspector/conf/default.py @@ -33,13 +33,6 @@ _OPTS = [ default=3600, help=_('Timeout after which introspection is considered ' 'failed, set to 0 to disable.')), - cfg.IntOpt('node_status_keep_time', - default=0, - help=_('For how much time (in seconds) to keep status ' - 'information about nodes after introspection was ' - 'finished for them. Set to 0 (the default) ' - 'to disable the timeout.'), - deprecated_for_removal=True), cfg.IntOpt('clean_up_period', default=60, help=_('Amount of time in seconds, after which repeat clean up ' diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 4dcc78b21..3e9ca3e83 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -874,19 +874,10 @@ def find_node(**attributes): def clean_up(): """Clean up the cache. - * Finish introspection for timed out nodes. - * Drop outdated node status information. + Finish introspection for timed out nodes. :return: list of timed out node UUID's """ - if CONF.node_status_keep_time > 0: - status_keep_threshold = (timeutils.utcnow() - datetime.timedelta( - seconds=CONF.node_status_keep_time)) - with db.ensure_transaction() as session: - db.model_query(db.Node, session=session).filter( - db.Node.finished_at.isnot(None), - db.Node.finished_at < status_keep_threshold).delete() - timeout = CONF.timeout if timeout <= 0: return [] diff --git a/ironic_inspector/test/unit/test_node_cache.py b/ironic_inspector/test/unit/test_node_cache.py index 8bddf32c8..9ad9b6ff5 100644 --- a/ironic_inspector/test/unit/test_node_cache.py +++ b/ironic_inspector/test/unit/test_node_cache.py @@ -413,30 +413,6 @@ class TestNodeCacheCleanUp(test_base.NodeTest): [(istate.States.error, current_time, 'Introspection timeout')], res) - def test_old_status(self): - CONF.set_override('node_status_keep_time', 42) - session = db.get_writer_session() - with session.begin(): - db.model_query(db.Node).update( - {'finished_at': (datetime.datetime.utcnow() - - datetime.timedelta(seconds=100))}) - - self.assertEqual([], node_cache.clean_up()) - - self.assertEqual([], db.model_query(db.Node).all()) - - def test_old_status_disabled(self): - # Status clean up is disabled by default - session = db.get_writer_session() - with session.begin(): - db.model_query(db.Node).update( - {'finished_at': (datetime.datetime.utcnow() - - datetime.timedelta(days=10000))}) - - self.assertEqual([], node_cache.clean_up()) - - self.assertNotEqual([], db.model_query(db.Node).all()) - class TestNodeCacheGetNode(test_base.NodeTest): def test_ok(self): diff --git a/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml b/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml new file mode 100644 index 000000000..23ac19c77 --- /dev/null +++ b/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The deprecated configuration option ``[DEFAULT]node_status_keep_time`` + was removed.