• 
      

    Allow DJBLETS_HEALTHCHECK_IPS to list subnets.

    Review Request #14579 — Created Sept. 1, 2025 and submitted

    Information

    Djblets
    release-5.x

    Reviewers

    In some larger setups, the individual IP of the management node for a
    cluster may not be fixed. This makes it very annoying to set the allowed
    IP whitelist for the healthcheck endpoint.

    This change makes it so the DJBLETS_HEALTHCHECK_IPS setting is now
    formally a comma-separated list which can include either individual IP
    addresses or CIDR subnets.

    This change also adds unit tests for the healthcheck endpoint, which
    didn't have any.

    • Verified that both individual IP and subnet matching worked as
      expected.
    • Ran unit tests.
    Summary ID
    Allow DJBLETS_HEALTHCHECK_IPS to list subnets.
    In some larger setups, the individual IP of the management node for a cluster may not be fixed. This makes it very annoying to set the allowed IP whitelist for the healthcheck endpoint. This change makes it so the `DJBLETS_HEALTHCHECK_IPS` setting is now formally a comma-separated list which can include either individual IP addresses or CIDR subnets. This change also adds unit tests for the healthcheck endpoint, which didn't have any. Testing Done: - Verified that both individual IP and subnet matching worked as expected. - Ran unit tests.
    ozqlwvmxzvoturkzosryzsotxqyyovwq
    Description From Last Updated

    line too long (81 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    continuation line over-indented for hanging indent Column: 17 Error code: E126

    reviewbotreviewbot

    continuation line unaligned for hanging indent Column: 13 Error code: E131

    reviewbotreviewbot

    Given the discussion in Slack, we can probably just make this all 5.3. I don't think we need to actually …

    chipx86chipx86

    This should be in the same import group.

    chipx86chipx86

    Missing Returns and Version Added.

    chipx86chipx86

    Same note as above re: version.

    chipx86chipx86

    These might be better in a setUpClass(). Also, we need to set the types above and null these out in …

    chipx86chipx86

    No trailing period here or in the following tests.

    chipx86chipx86

    We should check the logs.

    chipx86chipx86

    Don't tests already use the local memory cache by default? I noticed some tests are using this and some aren't.

    chipx86chipx86

    This can be assertJSONEqual(). Here and below.

    chipx86chipx86

    This should check the logs.

    chipx86chipx86

    Missing a trailing period.

    chipx86chipx86

    This should check the logs.

    chipx86chipx86

    This should check the logs.

    chipx86chipx86

    This should check the logs.

    chipx86chipx86

    Can you update the description and add a Version Changed (for 5.3) stating what's accepted for the setting? My fault, …

    chipx86chipx86

    Blank line before this.

    chipx86chipx86

    The other logs in here prefix as "Health check:"

    chipx86chipx86

    This is missing the "Health check:" prefix.

    chipx86chipx86

    This is missing the "Health check:" prefix.

    chipx86chipx86

    These are missing a Version Added.

    chipx86chipx86

    This should be 5.3

    maubinmaubin

    "Django".

    chipx86chipx86
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    david
    chipx86
    1. 
        
    2. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
      Show all issues

      Given the discussion in Slack, we can probably just make this all 5.3. I don't think we need to actually land on 4.0.x if we're just providing customer backports.

      If we do keep this here, it'll need to be 4.1, since it's adding new functionality.

    3. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This should be in the same import group.

    4. djblets/util/tests/test_views.py (Diff revision 3)
       
       
      Show all issues

      Missing Returns and Version Added.

    5. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
      Show all issues

      Same note as above re: version.

    6. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
      Show all issues

      These might be better in a setUpClass().

      Also, we need to set the types above and null these out in a teardown.

    7. djblets/util/tests/test_views.py (Diff revision 3)
       
       
      Show all issues

      No trailing period here or in the following tests.

    8. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      We should check the logs.

    9. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
       
       
      Show all issues

      Don't tests already use the local memory cache by default? I noticed some tests are using this and some aren't.

      1. They should, but this is here to explicitly test the results with certain settings values.

    10. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This can be assertJSONEqual(). Here and below.

    11. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This should check the logs.

    12. djblets/util/tests/test_views.py (Diff revision 3)
       
       
      Show all issues

      Missing a trailing period.

    13. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
      Show all issues

      This should check the logs.

    14. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This should check the logs.

    15. djblets/util/tests/test_views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This should check the logs.

    16. djblets/util/views.py (Diff revision 3)
       
       

      Neat. TIL.

    17. djblets/util/views.py (Diff revision 3)
       
       
      Show all issues

      Can you update the description and add a Version Changed (for 5.3) stating what's accepted for the setting?

      My fault, but we should also mention the setting in the first place.

    18. djblets/util/views.py (Diff revision 3)
       
       
      Show all issues

      Blank line before this.

    19. djblets/util/views.py (Diff revision 3)
       
       
      Show all issues

      The other logs in here prefix as "Health check:"

    20. djblets/util/views.py (Diff revision 3)
       
       
       
       
      Show all issues

      This is missing the "Health check:" prefix.

    21. djblets/util/views.py (Diff revision 3)
       
       
      Show all issues

      This is missing the "Health check:" prefix.

    22. djblets/util/views.py (Diff revision 3)
       
       
       
       
       
      Show all issues

      These are missing a Version Added.

    23. 
        
    david
    maubin
    1. 
        
    2. djblets/util/views.py (Diff revision 4)
       
       
      Show all issues

      This should be 5.3

    3. 
        
    david
    chipx86
    1. 
        
    2. djblets/util/views.py (Diff revision 5)
       
       
      Show all issues

      "Django".

    3. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.x (08fa8c8)