Skip to content

Commit

Permalink
Merge pull request #200 from martinhoyer/fb
Browse files Browse the repository at this point in the history
Add rtslib_fb import compability
  • Loading branch information
maurizio-lombardi authored Oct 7, 2024
2 parents 05f6941 + 1eafba8 commit 9853b83
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ debian/rtslib-doc.debianebhelper.log
debian/rtslib-doc.substvars
debian/rtslib-doc/
debian/tmp/
dist/*
dist/
doc/*
*.pyc
debian/rtslib-doc.debhelper.log
venv/
.venv/
.idea
*egg-info/
.mypy_cache/
.ruff_cache/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.4
rev: v0.6.4
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion rtslib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def modprobe(module):
import kmod.error
import kmod.Kmod
except ImportError:
out = subprocess.run(f"modprobe {module}", shell=True, capture_output=True, check=False) # noqa: S602, S607
out = subprocess.run(f"modprobe {module}", shell=True, capture_output=True, check=False) # noqa: S602
if out.returncode != 0:
raise RTSLibError(out.stderr.decode().rstrip())
return
Expand Down
21 changes: 21 additions & 0 deletions rtslib_fb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
rtslib_fb.py - Backwards compatibility module for rtslib
This module provides backwards compatibility for code that imports 'rtslib_fb'.
It re-exports all public names from the 'rtslib' module.
Usage:
from rtslib_fb import RTSRoot, Target, TPG # etc.
Note: This compatibility layer may be deprecated in future versions.
Please consider updating your imports to use 'rtslib' directly.
"""

import rtslib
from rtslib import * # noqa: F403

# Explicitly import and re-export submodules
from rtslib import alua, fabric, node, root, target, tcm, utils # noqa: F401

# Re-export all public names from rtslib
__all__ = rtslib.__all__

0 comments on commit 9853b83

Please sign in to comment.