Skip to content

Fix missing IcingaProtocol configuration directory creation in New-IcingaProtocolEnvironment - #24

Merged
LordHepipud merged 1 commit into
mainfrom
fix/icingaprotocol-environment-directory
Nov 17, 2026
Merged

LordHepipud merged 1 commit into
mainfrom
fix/icingaprotocol-environment-directory

Conversation

@LordHepipud

Copy link
Copy Markdown
Collaborator

Summary

Ensures New-IcingaProtocolEnvironment creates the IcingaProtocol subdirectory inside the module configuration directory before persisting Connection.json.

Why & Details

  • Root Cause: Write-SecureFile delegates new file creation to New-SecureItem -ItemType File without -Force. On freshly initialized systems where <ConfigDirectory>\IcingaProtocol does not yet exist, New-Item failed with DirectoryNotFoundException and Connection.json was never written to disk.
  • Fix:
    • Resolves $ProtocolConfigDir and $ProtocolConfigFile once via Join-Path (Get-ModuleConfigDirectory) and reuses them across -DryRun, directory creation, and file writing.
    • Creates $ProtocolConfigDir via New-SecureItem -ItemType 'Directory' -Path $ProtocolConfigDir -Force prior to calling Write-SecureFile (matching Add-ModuleWebSocketConfig).
    • Records the bugfix entry in docs/General/Changelog.md.

…ingaProtocolEnvironment

`Write-SecureFile` creates missing files via `New-SecureItem -ItemType File`
without `-Force`. On freshly initialized hosts where `<ConfigDirectory>\IcingaProtocol`
does not exist yet, `New-Item` failed with `DirectoryNotFoundException` and
`Connection.json` was not written to disk.

Resolve `$ProtocolConfigDir` and `$ProtocolConfigFile` once via `Join-Path`,
reuse them across `-DryRun` and persistence, and create `$ProtocolConfigDir` via
`New-SecureItem -ItemType 'Directory' -Force` prior to calling `Write-SecureFile`.
@LordHepipud LordHepipud self-assigned this Nov 17, 2026
@cla-bot cla-bot Bot added the cla/signed CLA is signed by all contributors of a PR label Nov 17, 2026
@LordHepipud
LordHepipud merged commit c4c0c0a into main Nov 17, 2026
6 checks passed
@LordHepipud
LordHepipud deleted the fix/icingaprotocol-environment-directory branch November 17, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant