Honor -ErrorAction, fix pipeline-stop noise, and correct certificate request paths #18
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes reported against
Request-InfisicalCertificateandGet-InfisicalCertificateAuthority, plus the module-wide error-handling contract.Breaking
Operation failures are now non-terminating errors, so
-ErrorAction(and$ErrorActionPreference) decides the outcome. Previously every failure was terminating and ignored-ErrorActionentirely.try/catcharound these cmdlets now requires-ErrorAction Stopor$ErrorActionPreference = 'Stop'.Start-InfisicalProcessreports an unacceptable exit code the same way.Verified under Windows PowerShell 5.1:
SilentlyContinuesuppresses but still populates$Error/-ErrorVariable;Ignorerecords nothing;Stopis caught bytry/catch;$ErrorActionPreference = 'Stop'is honored from script body, nested functions, pipelines, and script blocks.Fixed
Select-Object -First, andWhere-Objectfeeding it, stop the upstream cmdlet by design. The shared error path inInfisicalCmdletBasenow lets pipeline-control exceptions propagate untouched. Affected all 53 cmdlets.Logger.Errorcall site logs then throws, so the failure already reaches the caller as anErrorRecord. Emitting it again as eight warning lines put failures under-WarningActioninstead of-ErrorAction. Measured 8 warning lines -> 0, error stream unchanged at 1.-CommonNamedouble-prefixed.CN=WEB01produced aCN=CN=WEB01subject plus a bogus DNS SAN. A leadingCN=is now stripped.Get-InfisicalSANListreturns host names and IPs in one list, and the documented usage splats it into-DnsName. IP literals now becomeiPAddressSAN entries.Added
Request-InfisicalCertificateresolves and reports its issuance path before generating a keypair, naming the subscriber, CA, or profile on the verbose stream and in the-WhatIftarget.-CertificateAuthorityIdpath fails fast when the CA has direct issuance disabled, with guidance naming-PkiSubscriberSlugand-CertificateProfileId, instead of building a CSR and surfacing a bare400 Certificate template or subscriber is required for issuance.Get-InfisicalCertificateAuthoritytable output gains aDirectIssuecolumn (EnableDirectIssuance).No
-CertificateTemplateIdparameter was added: Infisical's REST API exposes no template-based issuance route (certificate-template-router.tsis absent across v1/v2/v3; templates are internal to EST and subscribers), so the reachable answers are a subscriber, a profile, or enabling direct issuance.Docs
README gains an
-ErrorActiontable, subscriber discovery, and direct-issuance setup steps;about_PSInfisicalAPIgains an ERROR HANDLING AND STREAMS section; cmdlet help notes updated. The README end-to-end example previously failed as written and now issues via a PKI subscriber.Tests
268 pass (up from 255). New coverage for pipeline-stop propagation, logger stream routing, SAN splitting, common-name normalization, direct-issuance guidance, and an IL-scanning test asserting no cmdlet reports operation failures as terminating. Full
build.ps1 -RunTestsgreen, including module import, manifest, and help validation across 53 cmdlets.Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Generated with Claude Code