This commit is contained in:
@@ -713,8 +713,7 @@ def list_rules():
|
|||||||
logger.error("Successfully obtained nft JSON ruleset, but also got textual output: %r", nft_text)
|
logger.error("Successfully obtained nft JSON ruleset, but also got textual output: %r", nft_text)
|
||||||
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_json()
|
raise HTTPException(status_code=500, detail=f"Failed to obtain nft JSON ruleset: {e}")
|
||||||
return RulesetOut(ruleset=text.strip() if text is not None else None)
|
|
||||||
|
|
||||||
custom = build_predictable_ruleset(nft_json)
|
custom = build_predictable_ruleset(nft_json)
|
||||||
|
|
||||||
@@ -727,7 +726,7 @@ def list_rules():
|
|||||||
logger.debug("list_rules: populate_text_from_chain_text failed: %s", e)
|
logger.debug("list_rules: populate_text_from_chain_text failed: %s", e)
|
||||||
|
|
||||||
ruleset_model = RulesetModel.parse_obj(custom)
|
ruleset_model = RulesetModel.parse_obj(custom)
|
||||||
return RulesetOut(ruleset=ruleset_model)
|
return {"ruleset": ruleset_model, "raw": nft_text}
|
||||||
except NftError as e:
|
except NftError as e:
|
||||||
logger.exception("list_rules failed")
|
logger.exception("list_rules failed")
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user