Avoid problems when nis is not available on a system.

Review Request #12865 — Created March 3, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

The NIS backend assumes that it can safely import the nis module.
However, this isn't always present on Python, and will be removed in
Python 3.13.

This change checks for this, attempting an import and logging if it
fails. The rest of the code will avoid trying to use the module if it's
not available, avoiding a crash.

This was hit in CI, where our Python 3.11 does not appear to ship with
NIS support.

Unit tests pass, with and without nis.

Summary ID
Avoid problems when nis is not available on a system.
The NIS backend assumes that it can safely import the `nis` module. However, this isn't always present on Python, and will be removed in Python 3.13. This change checks for this, attempting an import and logging if it fails. The rest of the code will avoid trying to use the module if it's not available, avoiding a crash. This was hit in CI, where our Python 3.11 does not appear to ship with NIS support.
1272cc2897ebb9f8018c236820747c3e5fa6ef1e
Description From Last Updated

Is this related to the nis change? Seems like it snuck in here by accident.

maubinmaubin
maubin
  1. 
      
  2. reviewboard/scmtools/bzr/__init__.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    Is this related to the nis change? Seems like it snuck in here by accident.

    1. Oops, that's meant for later. Thanks!

  3. 
      
chipx86
maubin
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (19826c7)