Get rid of pkg_resources
... because it was removed in Python 3.12 [1]. [1] https://docs.python.org/3/whatsnew/3.12.html#ensurepip Change-Id: I2d27da0db92c1eaae9f45a0905e3eb905a939571
This commit is contained in:
parent
6d743ad4ba
commit
2bf694ee44
ironic_python_agent
@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
import importlib.metadata
|
||||
import ipaddress
|
||||
import random
|
||||
import socket
|
||||
@ -26,7 +27,6 @@ from ironic_lib import mdns
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import pkg_resources
|
||||
|
||||
from ironic_python_agent.api import app
|
||||
from ironic_python_agent import config
|
||||
@ -233,8 +233,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
|
||||
self.listen_address = listen_address
|
||||
self.advertise_address = advertise_address
|
||||
self.advertise_protocol = advertise_protocol
|
||||
self.version = pkg_resources.get_distribution('ironic-python-agent')\
|
||||
.version
|
||||
self.version = importlib.metadata.version('ironic-python-agent')
|
||||
self.api = app.Application(self, cfg.CONF)
|
||||
self.heartbeat_timeout = None
|
||||
self.started_at = None
|
||||
|
@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import importlib.metadata
|
||||
import json
|
||||
import socket
|
||||
import time
|
||||
@ -20,7 +21,6 @@ from unittest import mock
|
||||
from ironic_lib import exception as lib_exc
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
import pkg_resources
|
||||
from stevedore import extension
|
||||
|
||||
from ironic_python_agent import agent
|
||||
@ -230,8 +230,8 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
status = self.agent.get_status()
|
||||
self.assertIsInstance(status, agent.IronicPythonAgentStatus)
|
||||
self.assertEqual(started_at, status.started_at)
|
||||
self.assertEqual(pkg_resources.get_distribution('ironic-python-agent')
|
||||
.version, status.version)
|
||||
self.assertEqual(importlib.metadata.version('ironic-python-agent'),
|
||||
status.version)
|
||||
|
||||
@mock.patch(
|
||||
'ironic_python_agent.hardware_managers.cna._detect_cna_card',
|
||||
|
Loading…
x
Reference in New Issue
Block a user