mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 17:41:58 -06:00
Stub fcntl in Ansible EE and expose support path
This commit is contained in:
56
Borealis.ps1
56
Borealis.ps1
@@ -601,15 +601,67 @@ function Ensure-AnsibleExecutionEnvironment {
|
||||
$metadata['requirements_hash'] = $requirementsHash
|
||||
}
|
||||
|
||||
$supportDir = Join-Path $eeRoot 'support'
|
||||
try {
|
||||
$metadata | ConvertTo-Json -Depth 5 | Set-Content -Path $metadataPath -Encoding UTF8
|
||||
New-Item -ItemType Directory -Force -Path $supportDir | Out-Null
|
||||
} catch {}
|
||||
|
||||
$fcntlStubPath = Join-Path $supportDir 'fcntl.py'
|
||||
$fcntlStub = @'
|
||||
"""Compat shim for POSIX-only fcntl module.
|
||||
|
||||
Generated by Borealis to allow Ansible tooling to run on Windows hosts
|
||||
where the standard library fcntl module is unavailable. The stub provides
|
||||
symbol constants and no-op function implementations so imports succeed.
|
||||
"""
|
||||
|
||||
LOCK_SH = 1
|
||||
LOCK_EX = 2
|
||||
LOCK_UN = 8
|
||||
LOCK_NB = 4
|
||||
|
||||
F_DUPFD = 0
|
||||
F_GETFD = 1
|
||||
F_SETFD = 2
|
||||
F_GETFL = 3
|
||||
F_SETFL = 4
|
||||
|
||||
FD_CLOEXEC = 1
|
||||
|
||||
def ioctl(*_args, **_kwargs):
|
||||
return 0
|
||||
|
||||
|
||||
def fcntl(*_args, **_kwargs):
|
||||
return 0
|
||||
|
||||
|
||||
def flock(*_args, **_kwargs):
|
||||
return 0
|
||||
|
||||
|
||||
def lockf(*_args, **_kwargs):
|
||||
return 0
|
||||
'@
|
||||
|
||||
try {
|
||||
if (-not (Test-Path (Join-Path $supportDir '__init__.py') -PathType Leaf)) {
|
||||
Set-Content -Path (Join-Path $supportDir '__init__.py') -Value '' -Encoding UTF8NoBOM
|
||||
}
|
||||
Set-Content -Path $fcntlStubPath -Value $fcntlStub -Encoding UTF8NoBOM
|
||||
} catch {
|
||||
Write-AgentLog -FileName $LogName -Message "[AnsibleEE] Failed to seed Windows fcntl compatibility shim: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
try {
|
||||
$metadata | ConvertTo-Json -Depth 5 | Set-Content -Path $metadataPath -Encoding UTF8NoBOM
|
||||
} catch {
|
||||
Write-AgentLog -FileName $LogName -Message "[AnsibleEE] Failed to persist metadata.json: $($_.Exception.Message)"
|
||||
throw "Unable to persist Ansible execution environment metadata."
|
||||
}
|
||||
|
||||
try {
|
||||
Set-Content -Path $versionTxtPath -Value $expectedVersionNorm -Encoding UTF8
|
||||
Set-Content -Path $versionTxtPath -Value $expectedVersionNorm -Encoding UTF8NoBOM
|
||||
} catch {}
|
||||
|
||||
Write-AgentLog -FileName $LogName -Message "[AnsibleEE] Execution environment ready at $eeRoot"
|
||||
|
||||
Reference in New Issue
Block a user