Browse Source

Merge "Remove runtime dependency on pbr"

changes/05/790205/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
4ac3d79519
4 changed files with 13 additions and 7 deletions
  1. +1
    -1
      ironic_python_agent/ironic_api_client.py
  2. +4
    -4
      ironic_python_agent/tests/unit/test_ironic_api_client.py
  3. +7
    -2
      ironic_python_agent/version.py
  4. +1
    -0
      requirements.txt

+ 1
- 1
ironic_python_agent/ironic_api_client.py View File

@ -150,7 +150,7 @@ class APIClient(object):
data['agent_token'] = self.agent_token
if api_ver >= AGENT_VERSION_IRONIC_VERSION:
data['agent_version'] = version.version_info.release_string()
data['agent_version'] = version.__version__
if api_ver >= AGENT_VERIFY_CA_IRONIC_VERSION and generated_cert:
data['agent_verify_ca'] = generated_cert


+ 4
- 4
ironic_python_agent/tests/unit/test_ironic_api_client.py View File

@ -148,7 +148,7 @@ class TestBaseIronicPythonAgent(base.IronicAgentTest):
self.assertEqual(API_URL + heartbeat_path, request_args[1])
expected_data = {
'callback_url': 'http://192.0.2.1:9999',
'agent_version': version.version_info.release_string()}
'agent_version': version.__version__}
self.assertEqual(jsonutils.dumps(expected_data), data)
def test_successful_heartbeat_ip6(self):
@ -171,7 +171,7 @@ class TestBaseIronicPythonAgent(base.IronicAgentTest):
self.assertEqual(API_URL + heartbeat_path, request_args[1])
expected_data = {
'callback_url': 'http://[fc00:1111::4]:9999',
'agent_version': version.version_info.release_string()}
'agent_version': version.__version__}
self.assertEqual(jsonutils.dumps(expected_data), data)
def test_successful_heartbeat_with_token(self):
@ -196,7 +196,7 @@ class TestBaseIronicPythonAgent(base.IronicAgentTest):
expected_data = {
'callback_url': 'http://192.0.2.1:9999',
'agent_token': 'magical',
'agent_version': version.version_info.release_string()}
'agent_version': version.__version__}
self.assertEqual(jsonutils.dumps(expected_data), data)
def test_heartbeat_agent_version_unsupported(self):
@ -244,7 +244,7 @@ class TestBaseIronicPythonAgent(base.IronicAgentTest):
expected_data = {
'callback_url': 'https://192.0.2.1:9999',
'agent_token': 'magical',
'agent_version': version.version_info.release_string(),
'agent_version': version.__version__,
'agent_verify_ca': 'I am a cert'}
self.assertEqual(jsonutils.dumps(expected_data), data)
headers = self.api_client.session.request.call_args[1]['headers']


+ 7
- 2
ironic_python_agent/version.py View File

@ -13,6 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
try:
# For Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# For everyone else
import importlib_metadata
version_info = pbr.version.VersionInfo('ironic_python_agent')
__version__ = importlib_metadata.version("ironic_python_agent")

+ 1
- 0
requirements.txt View File

@ -2,6 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
netifaces>=0.10.4 # MIT
oslo.config>=5.2.0 # Apache-2.0


Loading…
Cancel
Save