This commit is contained in:
@@ -46,15 +46,6 @@ class NftManager:
|
|||||||
logger.warning("nft cmd rc=%s stderr=%s cmd=%s", rc, err, text_cmd)
|
logger.warning("nft cmd rc=%s stderr=%s cmd=%s", rc, err, text_cmd)
|
||||||
return {"rc": rc, "stdout": out, "stderr": err}
|
return {"rc": rc, "stdout": out, "stderr": err}
|
||||||
|
|
||||||
def list_rules(self) -> str:
|
|
||||||
"""
|
|
||||||
Return the textual ruleset as produced by 'nft list ruleset'.
|
|
||||||
Uses the textual command path.
|
|
||||||
"""
|
|
||||||
res = self.cmd("list ruleset")
|
|
||||||
if res["rc"] != 0:
|
|
||||||
raise NftError(f"nft list ruleset failed: {res['stderr']}")
|
|
||||||
return res["stdout"]
|
|
||||||
|
|
||||||
def list_rules_json(self) -> Dict[str, Any]:
|
def list_rules_json(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
@@ -707,7 +698,7 @@ def list_rules():
|
|||||||
nft_json = mgr.list_rules_json()
|
nft_json = mgr.list_rules_json()
|
||||||
except NftError as e:
|
except NftError as e:
|
||||||
logger.debug("could not obtain nft JSON ruleset: %s", e)
|
logger.debug("could not obtain nft JSON ruleset: %s", e)
|
||||||
text = mgr.list_rules()
|
text = mgr.list_rules_json()
|
||||||
return RulesetOut(ruleset=text.strip() if text is not None else None)
|
return RulesetOut(ruleset=text.strip() if text is not None else None)
|
||||||
|
|
||||||
custom = build_predictable_ruleset(nft_json)
|
custom = build_predictable_ruleset(nft_json)
|
||||||
|
|||||||
Reference in New Issue
Block a user