Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMDSv1 and IMDSv2 abstraction for the retrieval of HANA DB Credentials from AWS Secrets Manager #112

Merged
merged 13 commits into from
Apr 13, 2023

Conversation

schniber
Copy link

Hello,

This is a proposed quickfix for #111 that allows the use of the python library ec2-metadata to read the region name as opposed to querying the instance metadata services directly with the requests library.

This will allow users running on EC2 instances that are configure to use IMDSv2 (as well as IMDSv1) to use the prometheus hana db exporter while safely storing the HANA DB Credentials in AWS Secrets Manager.

Thanks for your peer review.

Bests.

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @schniber
I'm afraid we cannot include this change so easily. The package ec2_metadata is not directly part of the repository where this package is published.
That's why we opted for the regular requests package. Would be some way to continue using requests?

PD:
In any case:

  • I think that the tests would break
  • The requirements.txt and spec file should be updated

@schniber
Copy link
Author

Hey @arbulu89,

Thanks a lot for your feedback that I took into account in the latest commit.

below is the executing of the tests with the makefile:

> make test
tox -e py
.pkg: _optional_hooks> python /usr/local/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /usr/local/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /usr/local/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /usr/local/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py: install_package> python -I -m pip install --force-reinstall --no-deps /../personal/hanadb_exporter/.tox/.tmp/package/20/hanadb_exporter-0.7.4.tar.gz
py: commands[0]> py.test tests -vv
=============================================================================================================== test session starts ===============================================================================================================
platform darwin -- Python 3.11.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 --
cachedir: .tox/py/.pytest_cache
rootdir: , configfile: pytest.ini, testpaths: tests
collected 53 items                                                                                                                                                                                                                                

tests/db_manager_test.py::TestDatabaseManager::test_get_tenants_port PASSED                                                                                                                                                                 [  1%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants PASSED                                                                                                                                                                  [  3%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants_userkey PASSED                                                                                                                                                          [  5%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants_error_connecting PASSED                                                                                                                                                 [  7%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_invalid_data PASSED                                                                                                                                                 [  9%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_not_supported PASSED                                                                                                                                                [ 11%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_userkey PASSED                                                                                                                                                      [ 13%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_userkey_warn PASSED                                                                                                                                                 [ 15%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_pass PASSED                                                                                                                                                         [ 16%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_ssl PASSED                                                                                                                                                               [ 18%]
tests/db_manager_test.py::TestDatabaseManager::test_start_timeout PASSED                                                                                                                                                                    [ 20%]
tests/db_manager_test.py::TestDatabaseManager::test_start_invalid_key PASSED                                                                                                                                                                [ 22%]
tests/db_manager_test.py::TestDatabaseManager::test_start_correct PASSED                                                                                                                                                                    [ 24%]
tests/db_manager_test.py::TestDatabaseManager::test_start_correct_multitenant PASSED                                                                                                                                                        [ 26%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connectors PASSED                                                                                                                                                                   [ 28%]
tests/main_test.py::TestMain::test_parse_config PASSED                                                                                                                                                                                      [ 30%]
tests/main_test.py::TestMain::test_parse_arguments PASSED                                                                                                                                                                                   [ 32%]
tests/main_test.py::TestMain::test_version PASSED                                                                                                                                                                                           [ 33%]
tests/main_test.py::TestMain::test_setup_logging PASSED                                                                                                                                                                                     [ 35%]
tests/main_test.py::TestMain::test_lookup_etc_folder PASSED                                                                                                                                                                                 [ 37%]
tests/main_test.py::TestMain::test_lookup_etc_folder_error PASSED                                                                                                                                                                           [ 39%]
tests/main_test.py::TestMain::test_run PASSED                                                                                                                                                                                               [ 41%]
tests/main_test.py::TestMain::test_run_defaults PASSED                                                                                                                                                                                      [ 43%]
tests/main_test.py::TestMain::test_run_invalid_args PASSED                                                                                                                                                                                  [ 45%]
tests/main_test.py::TestMain::test_run_malformed PASSED                                                                                                                                                                                     [ 47%]
tests/main_test.py::TestMain::test_run_secret_manager PASSED                                                                                                                                                                                [ 49%]
tests/prometheus_exporter_test.py::TestSapHanaCollectors::test_init PASSED                                                                                                                                                                  [ 50%]
tests/prometheus_exporter_test.py::TestSapHanaCollectors::test_collect PASSED                                                                                                                                                               [ 52%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_metadata_labels PASSED                                                                                                                                                        [ 54%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_retrieve_metadata PASSED                                                                                                                                                      [ 56%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge PASSED                                                                                                                                                           [ 58%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge_incorrect_label PASSED                                                                                                                                           [ 60%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge_incorrect_value PASSED                                                                                                                                           [ 62%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_reconnect_connected PASSED                                                                                                                                                    [ 64%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_reconnect_not_connected PASSED                                                                                                                                                [ 66%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_value_error PASSED                                                                                                                                                    [ 67%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect PASSED                                                                                                                                                                [ 69%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_incorrect_type PASSED                                                                                                                                                 [ 71%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_incorrect_query PASSED                                                                                                                                                [ 73%]
tests/prometheus_metrics_test.py::TestMetric::test_metric_new PASSED                                                                                                                                                                        [ 75%]
tests/prometheus_metrics_test.py::TestMetric::test_metric_new_error PASSED                                                                                                                                                                  [ 77%]
tests/prometheus_metrics_test.py::TestQuery::test_parse PASSED                                                                                                                                                                              [ 79%]
tests/prometheus_metrics_test.py::TestQuery::test_get_model PASSED                                                                                                                                                                          [ 81%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_init PASSED                                                                                                                                                                   [ 83%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_load_metrics PASSED                                                                                                                                                           [ 84%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_load_metrics_error PASSED                                                                                                                                                     [ 86%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials PASSED                                                                                                                                                           [ 88%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials_ec2_request_error PASSED                                                                                                                                         [ 90%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials_secret_request_error PASSED                                                                                                                                      [ 92%]
tests/utils_test.py::TestUtils::test_format_query_result PASSED                                                                                                                                                                             [ 94%]
tests/utils_test.py::TestUtils::test_check_hana_range PASSED                                                                                                                                                                                [ 96%]
tests/utils_test.py::TestUtils::test_systemd_ready_error PASSED                                                                                                                                                                             [ 98%]
tests/utils_test.py::TestUtils::test_systemd_ready PASSED                                                                                                                                                                                   [100%]

================================================================================================================ warnings summary =================================================================================================================
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
  /../hanadb_exporter/hanadb_exporter/utils.py:58: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return version.LooseVersion(hana_version) >= version.LooseVersion(

tests/utils_test.py: 20 warnings
  /../personal/hanadb_exporter/hanadb_exporter/utils.py:62: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return version.LooseVersion(hana_version) >= version.LooseVersion(

tests/utils_test.py: 12 warnings
  /../personal/hanadb_exporter/hanadb_exporter/utils.py:64: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    ) and version.LooseVersion(hana_version) <= version.LooseVersion(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================================================= 53 passed, 40 warnings in 0.57s =========================================================================================================
.pkg: _exit> python /usr/local/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py: OK (3.22=setup[2.26]+cmd[0.96] seconds)
  congratulations :) (3.45 seconds)

PR is ready for your review.

Thanks a lot.

Bests.

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schniber we should have tests on this new code.
That the old ones are passing is just a coincidence, as most probably the first requests return code is 200 in the tests.
We should mock with the unauthorized return code and see that the proper call are done

Besides that, I would've put some comment on that new if condition.
I guess that if it returns unauthorized, it means that we are using IMDSv2 version. It would be nice to comment that down

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @schniber ,
I think we could improve the test a bit, but in any case it looks good enough.

tests/secrets_manager_test.py Outdated Show resolved Hide resolved
@arbulu89
Copy link
Collaborator

arbulu89 commented Apr 3, 2023

damn, now it looks like setup-python on the CI is broken.
It looks some error with the ubuntu-latest distro.
Could you set a specific ubuntu version in the github ci file? Like here: https://github.com/patcon/go.talent.c4nada.ca/pull/11/files
ubuntu-20.04 would be fine.
At least we fix this temporarily (or I hope so). Feel free to look it by yourself anyway

@wombelix
Copy link
Contributor

wombelix commented Apr 6, 2023

damn, now it looks like setup-python on the CI is broken.
It looks some error with the ubuntu-latest distro.
Could you set a specific ubuntu version in the github ci file? Like here:

Hey @arbulu89, just to be sure, you ask @schniber do replace all ubuntu-latest with ubuntu-20.04 in exporter-ci.yml and dashboards-ci.yml as part of this PR to proceed?

@diegoakechi
Copy link
Member

Hi @wombelix and @schniber, only changing the https://github.com/SUSE/hanadb_exporter/blob/master/.github/workflows/exporter-ci.yml file to ubuntu-20.04 should be enough, as apparently python 3.6 got removed on the latest version.

This is a temporary workaround. I have opened #113 for fixing this in the future.

@wombelix
Copy link
Contributor

wombelix commented Apr 6, 2023

Thanks a lot @diegoakechi for the clarification, @schniber can you please replace ubuntu-latest with ubuntu-20.04 in https://github.com/SUSE/hanadb_exporter/blob/master/.github/workflows/exporter-ci.yml and push it?

@schniber
Copy link
Author

schniber commented Apr 6, 2023

Hello all,

I have just pushed changes related to our last discussion.

Please feel free to run a peer review and provide feedback.

Thanks a lot !

Bests.

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @schniber
I cannot accept the changes as the new code looks super strange.
And the tests are not fixed yet
PD: @schniber if you need some help with the tests I could clone your forks/branch and commit myself the tests if you give me the permissions to do so

hanadb_exporter/secrets_manager.py Show resolved Hide resolved
hanadb_exporter/secrets_manager.py Outdated Show resolved Hide resolved
@wombelix
Copy link
Contributor

PD: @schniber if you need some help with the tests I could clone your forks/branch and commit myself the tests if you give me the permissions to do so

Thanks a lot @arbulu89, He's on vacation until next week, but we talked about the topic last week and he mentioned that some help in regards to the testing would be highly appreciated. So if you have some capacity to take his test cases and improve them, that would be really great. I'm also willing to contribute, feel free to let me know how I can help.

@wombelix
Copy link
Contributor

@schniber added me as contributor to his fork, I will give it a shot to improve the tests a little

Signed-off-by: Dominik Wombacher <domwom@amazon.de>
Based on feedback during PR review and pseudo code provided by arbulu89.
Mocks for both get requests via side_effects and addition of mock for put.
One assert added to verify if imdsv2 get included the test token.

Signed-off-by: Dominik Wombacher <domwom@amazon.de>
Signed-off-by: Dominik Wombacher <domwom@amazon.de>
@wombelix
Copy link
Contributor

wombelix commented Apr 12, 2023

@arbulu89 I tried to brush up the tests, indentation and things like whitespaces and line width a little. Please let me know if I understood your recommendations correctly and if you think further improvements is required or if the PR can be merged.

Result of local test run:

wombelix@geeko:~/dev/forks/github.com/schniber/hanadb_exporter> make test
tox -e py
.pkg: _optional_hooks> python /home/wombelix/.local/pipx/venvs/tox/lib64/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /home/wombelix/.local/pipx/venvs/tox/lib64/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /home/wombelix/.local/pipx/venvs/tox/lib64/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /home/wombelix/.local/pipx/venvs/tox/lib64/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py: install_package> python -I -m pip install --force-reinstall --no-deps /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter/.tox/.tmp/package/10/hanadb_exporter-0.7.4.tar.gz
py: commands[0]> py.test tests -vv
====================================================================================================== test session starts ======================================================================================================
platform linux -- Python 3.8.16, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter/.tox/py/bin/python
cachedir: .tox/py/.pytest_cache
rootdir: /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter, configfile: pytest.ini, testpaths: tests
collected 54 items                                                                                                                                                                                                              

tests/db_manager_test.py::TestDatabaseManager::test_get_tenants_port PASSED                                                                                                                                               [  1%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants PASSED                                                                                                                                                [  3%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants_userkey PASSED                                                                                                                                        [  5%]
tests/db_manager_test.py::TestDatabaseManager::test_connect_tenants_error_connecting PASSED                                                                                                                               [  7%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_invalid_data PASSED                                                                                                                               [  9%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_not_supported PASSED                                                                                                                              [ 11%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_userkey PASSED                                                                                                                                    [ 12%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_userkey_warn PASSED                                                                                                                               [ 14%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_data_pass PASSED                                                                                                                                       [ 16%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connection_ssl PASSED                                                                                                                                             [ 18%]
tests/db_manager_test.py::TestDatabaseManager::test_start_timeout PASSED                                                                                                                                                  [ 20%]
tests/db_manager_test.py::TestDatabaseManager::test_start_invalid_key PASSED                                                                                                                                              [ 22%]
tests/db_manager_test.py::TestDatabaseManager::test_start_correct PASSED                                                                                                                                                  [ 24%]
tests/db_manager_test.py::TestDatabaseManager::test_start_correct_multitenant PASSED                                                                                                                                      [ 25%]
tests/db_manager_test.py::TestDatabaseManager::test_get_connectors PASSED                                                                                                                                                 [ 27%]
tests/main_test.py::TestMain::test_parse_config PASSED                                                                                                                                                                    [ 29%]
tests/main_test.py::TestMain::test_parse_arguments PASSED                                                                                                                                                                 [ 31%]
tests/main_test.py::TestMain::test_version PASSED                                                                                                                                                                         [ 33%]
tests/main_test.py::TestMain::test_setup_logging PASSED                                                                                                                                                                   [ 35%]
tests/main_test.py::TestMain::test_lookup_etc_folder PASSED                                                                                                                                                               [ 37%]
tests/main_test.py::TestMain::test_lookup_etc_folder_error PASSED                                                                                                                                                         [ 38%]
tests/main_test.py::TestMain::test_run PASSED                                                                                                                                                                             [ 40%]
tests/main_test.py::TestMain::test_run_defaults PASSED                                                                                                                                                                    [ 42%]
tests/main_test.py::TestMain::test_run_invalid_args PASSED                                                                                                                                                                [ 44%]
tests/main_test.py::TestMain::test_run_malformed PASSED                                                                                                                                                                   [ 46%]
tests/main_test.py::TestMain::test_run_secret_manager PASSED                                                                                                                                                              [ 48%]
tests/prometheus_exporter_test.py::TestSapHanaCollectors::test_init PASSED                                                                                                                                                [ 50%]
tests/prometheus_exporter_test.py::TestSapHanaCollectors::test_collect PASSED                                                                                                                                             [ 51%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_metadata_labels PASSED                                                                                                                                      [ 53%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_retrieve_metadata PASSED                                                                                                                                    [ 55%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge PASSED                                                                                                                                         [ 57%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge_incorrect_label PASSED                                                                                                                         [ 59%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_manage_gauge_incorrect_value PASSED                                                                                                                         [ 61%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_reconnect_connected PASSED                                                                                                                                  [ 62%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_reconnect_not_connected PASSED                                                                                                                              [ 64%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_value_error PASSED                                                                                                                                  [ 66%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect PASSED                                                                                                                                              [ 68%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_incorrect_type PASSED                                                                                                                               [ 70%]
tests/prometheus_exporter_test.py::TestSapHanaCollector::test_collect_incorrect_query PASSED                                                                                                                              [ 72%]
tests/prometheus_metrics_test.py::TestMetric::test_metric_new PASSED                                                                                                                                                      [ 74%]
tests/prometheus_metrics_test.py::TestMetric::test_metric_new_error PASSED                                                                                                                                                [ 75%]
tests/prometheus_metrics_test.py::TestQuery::test_parse PASSED                                                                                                                                                            [ 77%]
tests/prometheus_metrics_test.py::TestQuery::test_get_model PASSED                                                                                                                                                        [ 79%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_init PASSED                                                                                                                                                 [ 81%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_load_metrics PASSED                                                                                                                                         [ 83%]
tests/prometheus_metrics_test.py::TestPrometheusMetrics::test_load_metrics_error PASSED                                                                                                                                   [ 85%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials PASSED                                                                                                                                         [ 87%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials_imdsv2 PASSED                                                                                                                                  [ 88%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials_ec2_request_error PASSED                                                                                                                       [ 90%]
tests/secrets_manager_test.py::TestSecretsManager::test_get_db_credentials_secret_request_error PASSED                                                                                                                    [ 92%]
tests/utils_test.py::TestUtils::test_format_query_result PASSED                                                                                                                                                           [ 94%]
tests/utils_test.py::TestUtils::test_check_hana_range PASSED                                                                                                                                                              [ 96%]
tests/utils_test.py::TestUtils::test_systemd_ready_error PASSED                                                                                                                                                           [ 98%]
tests/utils_test.py::TestUtils::test_systemd_ready PASSED                                                                                                                                                                 [100%]

======================================================================================================= warnings summary ========================================================================================================
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
tests/utils_test.py::TestUtils::test_check_hana_range
  /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter/hanadb_exporter/utils.py:56: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return version.LooseVersion(hana_version) >= version.LooseVersion(availability_range[0])

tests/utils_test.py: 20 warnings
  /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter/hanadb_exporter/utils.py:58: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return version.LooseVersion(hana_version) >= version.LooseVersion(availability_range[0]) \

tests/utils_test.py: 12 warnings
  /home/wombelix/dev/forks/github.com/schniber/hanadb_exporter/hanadb_exporter/utils.py:59: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    and version.LooseVersion(hana_version) <= version.LooseVersion(availability_range[1])

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================================================ 54 passed, 40 warnings in 0.37s ================================================================================================
.pkg: _exit> python /home/wombelix/.local/pipx/venvs/tox/lib64/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py: OK (1.63=setup[1.06]+cmd[0.57] seconds)
  congratulations :) (1.67 seconds)

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @wombelix
We are almost there!
2 things to polish the tests and we are ready to merge

tests/secrets_manager_test.py Outdated Show resolved Hide resolved
tests/secrets_manager_test.py Outdated Show resolved Hide resolved
IMDSv2 assert get assert extended to cover call to meta service with and without token header.
Put assert added to verify submission of metadata token ttl header.

Signed-off-by: Dominik Wombacher <domwom@amazon.de>
'side_effects' changed to 'side_effect', redundant return_value assignments removed.

Signed-off-by: Dominik Wombacher <domwom@amazon.de>
Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wombelix
I appreciate your patience on this.
Let's merge!

@arbulu89 arbulu89 merged commit bf6cd7c into SUSE:master Apr 13, 2023
@wombelix
Copy link
Contributor

Thank you @wombelix I appreciate your patience on this. Let's merge!

Thanks a lot @arbulu89 , I appreciate your guidance and support getting this PR merged, looking forward to the next one 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants