Je rencontre un petit souci avec le setup helpers run_powershell_from_file. J'ai écrit mon script en PowerShell et ne semble pas avoir de souci a s'exécuter.
Code : Tout sélectionner
#Script pour determiner si Nuget est installé et dans quelle version
Try{
$Version = (Get-PackageProvider -Name "Nuget" -ErrorAction SilentlyContinue).Version
$Result = "NuGet found. Version : $($Version.ToString())"
}
Catch{
$Result = "NuGet not found."
}
$Result
Code : Tout sélectionner
run_powershell_from_file("Get-INSANugetVersion.ps1",output_format='json')
Code : Tout sélectionner
Auditing c:\waptdev\insat-nuget_x64_PROD-wapt\WAPT\.. ...
2021-07-02 10:41:13,071 CRITICAL Fatal error in audit function: CalledProcessErrorOutput: Command '$ProgressPreference = "SilentlyContinue"\n(#Script pour determiner si Nuget est installé et dans quelle version\n\nTry{\n $Version = (Get-PackageProvider -Name "Nuget" -ErrorAction SilentlyContinue).Version\n $Result = "NuGet found. Version : $($Version.ToString())"\n}\nCatch{\n $Result = "NuGet not found."\n}\n\n\n$Result) | ConvertTo-Json' returned non-zero exit status 1.
Output:#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Au caractère Ligne:7 : 2_x000D__x000A_</S><S S="Error">+ }_x000D__x000A_</S><S S="Error">+ ~_x000D__x000A_</S><S S="Error">Parenthèse fermante « ) » manquante dans l'expression._x000D__x000A_</S><S S="Error">Au caractère Ligne:8 : 1_x000D__x000A_</S><S S="Error">+ Catch{_x000D__x000A_</S><S S="Error">+ ~~~~~_x000D__x000A_</S><S S="Error">Jeton inattendu « Catch » dans l'expression ou l'instruction._x000D__x000A_</S><S S="Error">Au caractère Ligne:13 : 8_x000D__x000A_</S><S S="Error">+ $Result) | ConvertTo-Json_x000D__x000A_</S><S S="Error">+ ~_x000D__x000A_</S><S S="Error">Jeton inattendu « ) » dans l'expression ou l'instruction._x000D__x000A_</S><S S="Error">Au caractère Ligne:13 : 10_x000D__x000A_</S><S S="Error">+ $Result) | ConvertTo-Json_x000D__x000A_</S><S S="Error">+ ~_x000D__x000A_</S><S S="Error">Un élément de canal vide n'est pas autorisé._x000D__x000A_</S><S S="Error"> + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : MissingEndParenthesisInExpression_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>:
À noter que si je met ceci dans l'audit, cela fonctionne comme attendu :
Code : Tout sélectionner
result = run('C:\\Windows\\System32\WindowsPowerShell\\v1.0\\powershell.exe -NoProfile -File .\\Get-INSANugetVersion.ps1')
print(result)
Code : Tout sélectionner
Ligne de Commande : audit -f "c:\waptdev\insat-nuget_x64_PROD-wapt\WAPT\.."
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Auditing c:\waptdev\insat-nuget_x64_PROD-wapt\WAPT\.. ...
NuGet found. Version : 2.8.5.208
c:\waptdev\insat-nuget_x64_PROD-wapt\WAPT\.. -> UNKNOWN
Merci de votre aide !
--------------------------------------------------------------------------------------------------------------------------
- Version de WAPT installée : 2.0
- OS du serveur : Linux Ubuntu 20.04
- OS de la machine d'administration/création des paquets : Windows 10 (20H2)