Merge "Get rid of pkg_resources"
This commit is contained in:
commit
a30fea57d7
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import importlib.metadata
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import random
|
import random
|
||||||
import socket
|
import socket
|
||||||
@ -26,7 +27,6 @@ from ironic_lib import mdns
|
|||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
from ironic_python_agent.api import app
|
from ironic_python_agent.api import app
|
||||||
from ironic_python_agent import config
|
from ironic_python_agent import config
|
||||||
@ -233,8 +233,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
|
|||||||
self.listen_address = listen_address
|
self.listen_address = listen_address
|
||||||
self.advertise_address = advertise_address
|
self.advertise_address = advertise_address
|
||||||
self.advertise_protocol = advertise_protocol
|
self.advertise_protocol = advertise_protocol
|
||||||
self.version = pkg_resources.get_distribution('ironic-python-agent')\
|
self.version = importlib.metadata.version('ironic-python-agent')
|
||||||
.version
|
|
||||||
self.api = app.Application(self, cfg.CONF)
|
self.api = app.Application(self, cfg.CONF)
|
||||||
self.heartbeat_timeout = None
|
self.heartbeat_timeout = None
|
||||||
self.started_at = None
|
self.started_at = None
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import importlib.metadata
|
||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
@ -21,7 +22,6 @@ from unittest.mock import sentinel
|
|||||||
from ironic_lib import exception as lib_exc
|
from ironic_lib import exception as lib_exc
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import pkg_resources
|
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
from ironic_python_agent import agent
|
from ironic_python_agent import agent
|
||||||
@ -231,8 +231,8 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
|||||||
status = self.agent.get_status()
|
status = self.agent.get_status()
|
||||||
self.assertIsInstance(status, agent.IronicPythonAgentStatus)
|
self.assertIsInstance(status, agent.IronicPythonAgentStatus)
|
||||||
self.assertEqual(started_at, status.started_at)
|
self.assertEqual(started_at, status.started_at)
|
||||||
self.assertEqual(pkg_resources.get_distribution('ironic-python-agent')
|
self.assertEqual(importlib.metadata.version('ironic-python-agent'),
|
||||||
.version, status.version)
|
status.version)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'ironic_python_agent.hardware_managers.cna._detect_cna_card',
|
'ironic_python_agent.hardware_managers.cna._detect_cna_card',
|
||||||
|
Loading…
Reference in New Issue
Block a user