Skip to content

Fix bare except: use except ValueError for datetime.strptime in x509 module#69799

Open
koteshyelamati wants to merge 1 commit into
saltstack:masterfrom
koteshyelamati:master
Open

Fix bare except: use except ValueError for datetime.strptime in x509 module#69799
koteshyelamati wants to merge 1 commit into
saltstack:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Replace bare except: with except ValueError: in salt/modules/x509.py.

Two bare except: clauses wrap datetime.datetime.strptime() calls for validating not_before and not_after certificate date parameters. strptime raises ValueError when the format doesn't match, so except ValueError: is the correct specific exception type here.

@twangboy twangboy added this to the Potassium v3009.0 milestone Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants