session bug + remove telemetry from low level functions (#3509)
Session caching didn't really work in the latest preview + telemetry in the low level functions can be measured in perf. Co-authored-by: freddydk <freddydk@users.noreply.github.com>
This commit is contained in:
Родитель
de974c89e6
Коммит
83f0b87fbb
|
@ -310,6 +310,7 @@ try {
|
|||
}
|
||||
else {
|
||||
[ScriptBlock] $scriptblock = { Param($appFile, $skipVerification, $sync, $install, $upgrade, $tenant, $syncMode, $packageType, $scope, $language, $PublisherAzureActiveDirectoryTenantId, $force, $ignoreIfAppExists)
|
||||
$prevPreference = $ProgressPreference; $ProgressPreference = "SilentlyContinue"
|
||||
$publishArgs = @{ "packageType" = $packageType }
|
||||
if ($scope) {
|
||||
$publishArgs += @{ "Scope" = $scope }
|
||||
|
@ -394,6 +395,7 @@ try {
|
|||
Start-NavAppDataUpgrade -ServerInstance $ServerInstance -Publisher $appPublisher -Name $appName -Version $appVersion -Tenant $tenant @installArgs
|
||||
}
|
||||
}
|
||||
$ProgressPreference = $prevPreference
|
||||
}
|
||||
if ($isCloudBcContainer) {
|
||||
$containerPath = Join-Path 'C:\DL' ([System.IO.Path]::GetFileName($appfile))
|
||||
|
|
|
@ -30,9 +30,6 @@ function Download-File {
|
|||
[int] $timeout = 100
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$replaceUrls = @{
|
||||
"https://go.microsoft.com/fwlink/?LinkID=844461" = "https://bcartifacts.azureedge.net/prerequisites/DotNetCore.1.0.4_1.1.1-WindowsHosting.exe"
|
||||
"https://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi" = "https://bcartifacts.azureedge.net/prerequisites/rewrite_2.0_rtw_x64.msi"
|
||||
|
@ -99,12 +96,4 @@ try {
|
|||
}
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Export-ModuleMember -Function Download-File
|
||||
|
|
|
@ -30,7 +30,7 @@ function Get-BcContainerSession {
|
|||
$session = $sessions[$containerName]
|
||||
try {
|
||||
$platformVersion = Invoke-Command -Session $session -ScriptBlock { [System.Version](get-item 'C:\Program Files\Microsoft Dynamics NAV\*\Service\Microsoft.Dynamics.Nav.Server.exe').Versioninfo.FileVersion }
|
||||
if ($platformVersion -ge 24 -and ($usePwsh -xor $session.ConfigurationName -eq 'PowerShell.7')) {
|
||||
if ($platformVersion.Major -ge 24 -and ($usePwsh -xor $session.ConfigurationName -eq 'PowerShell.7')) {
|
||||
# Cannot use existing session
|
||||
Remove-PSSession -Session $session
|
||||
$sessions.Remove($containerName)
|
||||
|
|
|
@ -16,9 +16,6 @@ function Get-BcContainerArtifactUrl {
|
|||
[string] $containerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$inspect = docker inspect $containerName | ConvertFrom-Json
|
||||
$artifactUrlEnv = $inspect.config.Env | Where-Object { $_ -like "artifactUrl=*" }
|
||||
if ($artifactUrlEnv) {
|
||||
|
@ -28,13 +25,5 @@ try {
|
|||
return ""
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerArtifactUrl -Value Get-BcContainerArtifactUrl
|
||||
Export-ModuleMember -Function Get-BcContainerArtifactUrl -Alias Get-NavContainerArtifactUrl
|
||||
|
|
|
@ -17,23 +17,11 @@ function Get-BcContainerCountry {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -eq 0 -or $inspect.Config.Labels.maintainer -ne "Dynamics SMB") {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
}
|
||||
return "$($inspect.Config.Labels.country)"
|
||||
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerCountry -Value Get-BcContainerCountry
|
||||
Export-ModuleMember -Function Get-BcContainerCountry -Alias Get-NavContainerCountry
|
||||
|
|
|
@ -45,9 +45,6 @@ function Get-BcContainerDebugInfo {
|
|||
[switch] $CopyToClipboard
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$debugInfo = @{}
|
||||
$inspect = docker inspect $containerName | ConvertFrom-Json
|
||||
|
||||
|
@ -107,13 +104,5 @@ try {
|
|||
|
||||
return $debugInfoJson
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerDebugInfo -Value Get-BcContainerDebugInfo
|
||||
Export-ModuleMember -Function Get-BcContainerDebugInfo -Alias Get-NavContainerDebugInfo
|
||||
|
|
|
@ -18,21 +18,11 @@ function Get-BcContainerEula {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -eq 0 -or $inspect.Config.Labels.maintainer -ne "Dynamics SMB") {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
}
|
||||
return "$($inspect.Config.Labels.Eula)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerEula -Value Get-BcContainerEula
|
||||
Export-ModuleMember -Function Get-BcContainerEula -Alias Get-NavContainerEula
|
||||
|
|
|
@ -23,8 +23,6 @@ function Get-BcContainerEventLog {
|
|||
[switch] $doNotOpen
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
Write-Host "Getting event log for $containername"
|
||||
|
||||
$eventLogFolder = Join-Path $bcContainerHelperConfig.hostHelperFolder "EventLogs"
|
||||
|
@ -46,13 +44,5 @@ try {
|
|||
Start-Process -FilePath $eventLogName | Out-Null
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerEventLog -Value Get-BcContainerEventLog
|
||||
Export-ModuleMember -Function Get-BcContainerEventLog -Alias Get-NavContainerEventLog
|
||||
|
|
|
@ -17,22 +17,11 @@ function Get-BcContainerGenericTag {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('tag').Count -eq 0) {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
}
|
||||
return "$($inspect.Config.Labels.tag)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerGenericTag -Value Get-BcContainerGenericTag
|
||||
Export-ModuleMember -Function Get-BcContainerGenericTag -Alias Get-NavContainerGenericTag
|
||||
|
|
|
@ -15,9 +15,6 @@ function Get-BcContainerId {
|
|||
[string] $containerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$id = ""
|
||||
docker ps --format "{{.ID}}:{{.Names}}" -a --no-trunc | ForEach-Object {
|
||||
$ps = $_.split(':')
|
||||
|
@ -36,13 +33,5 @@ try {
|
|||
}
|
||||
$id
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerId -Value Get-BcContainerId
|
||||
Export-ModuleMember -Function Get-BcContainerId -Alias Get-NavContainerId
|
||||
|
|
|
@ -17,9 +17,6 @@ function Get-BcContainerImageLabels {
|
|||
[PSCredential] $registryCredential
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
|
||||
|
@ -72,15 +69,6 @@ try {
|
|||
}
|
||||
catch {
|
||||
}
|
||||
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerImageLabels -Value Get-BcContainerImageLabels
|
||||
Export-ModuleMember -Function Get-BcContainerImageLabels -Alias Get-NavContainerImageLabels
|
||||
|
|
|
@ -16,18 +16,8 @@ function Get-BcContainerImageName {
|
|||
[string] $containerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$inspect = docker inspect $containerName | ConvertFrom-Json
|
||||
return "$($inspect.Config.Image)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerImageName -Value Get-BcContainerImageName
|
||||
Export-ModuleMember -Function Get-BcContainerImageName -Alias Get-NavContainerImageName
|
||||
|
|
|
@ -19,9 +19,6 @@ function Get-BcContainerImageTags {
|
|||
[int] $pageSize = -1
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
|
||||
|
@ -77,13 +74,5 @@ try {
|
|||
catch {
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerImageTags -Value Get-BcContainerImageTags
|
||||
Export-ModuleMember -Function Get-BcContainerImageTags -Alias Get-NavContainerImageTags
|
||||
|
|
|
@ -18,9 +18,6 @@ function Get-BcContainerIpAddress {
|
|||
[string] $networkName = ""
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$ip = Invoke-ScriptInBcContainer -containerName $containerName -scriptblock {
|
||||
$ip = ""
|
||||
$ips = Get-NetIPAddress | Where-Object { $_.AddressFamily -eq "IPv4" -and $_.IPAddress -ne "127.0.0.1" }
|
||||
|
@ -47,13 +44,5 @@ try {
|
|||
}
|
||||
return $ip
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerIpAddress -Value Get-BcContainerIpAddress
|
||||
Export-ModuleMember -Function Get-BcContainerIpAddress -Alias Get-NavContainerIpAddress
|
||||
|
|
|
@ -18,22 +18,11 @@ function Get-BcContainerLegal {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -eq 0 -or $inspect.Config.Labels.maintainer -ne "Dynamics SMB") {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
}
|
||||
return "$($inspect.Config.Labels.legal)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerLegal -Value Get-BcContainerLegal
|
||||
Export-ModuleMember -Function Get-BcContainerLegal -Alias Get-NavContainerLegal
|
||||
|
|
|
@ -13,19 +13,9 @@ Function Get-BcContainerLicenseInformation {
|
|||
[String] $ContainerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock {
|
||||
Get-NavServerInstance | Export-NAVServerLicenseInformation
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerLicenseInformation -Value Get-BcContainerLicenseInformation
|
||||
Export-ModuleMember -Function Get-BcContainerLicenseInformation -Alias Get-NavContainerLicenseInformation
|
|
@ -15,18 +15,7 @@ function Get-BcContainerName {
|
|||
[string] $containerId
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
docker ps --format='{{.Names}}' -a --filter "id=$containerId"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerName -Value Get-BcContainerName
|
||||
Export-ModuleMember -Function Get-BcContainerName -Alias Get-NavContainerName
|
||||
|
|
|
@ -17,21 +17,11 @@ function Get-BcContainerNavVersion {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -eq 0 -or $inspect.Config.Labels.maintainer -ne "Dynamics SMB") {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
}
|
||||
return "$($inspect.Config.Labels.version)-$($inspect.Config.Labels.country)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerNavVersion -Value Get-BcContainerNavVersion
|
||||
Export-ModuleMember -Function Get-BcContainerNavVersion -Alias Get-NavContainerNavVersion
|
||||
|
|
|
@ -17,18 +17,8 @@ function Get-BcContainerOsVersion {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
return "$($inspect.Config.Labels.osversion)"
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerOsVersion -Value Get-BcContainerOsVersion
|
||||
Export-ModuleMember -Function Get-BcContainerOsVersion -Alias Get-NavContainerOsVersion
|
||||
|
|
|
@ -21,8 +21,6 @@ function Get-BcContainerPath {
|
|||
[switch] $throw
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$containerPath = ""
|
||||
if ($path.StartsWith(":")) {
|
||||
$path =$path.Substring(1)
|
||||
|
@ -50,13 +48,5 @@ try {
|
|||
}
|
||||
return $containerPath
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerPath -Value Get-BcContainerPath
|
||||
Export-ModuleMember -Function Get-BcContainerPath -Alias Get-NavContainerPath
|
||||
|
|
|
@ -18,8 +18,6 @@ function Get-BcContainerPlatformVersion {
|
|||
[string] $containerOrImageName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$inspect = docker inspect $containerOrImageName | ConvertFrom-Json
|
||||
if ($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -eq 0 -or $inspect.Config.Labels.maintainer -ne "Dynamics SMB") {
|
||||
throw "Container $containerOrImageName is not a NAV/BC container"
|
||||
|
@ -30,13 +28,5 @@ try {
|
|||
return ""
|
||||
}
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerPlatformVersion -Value Get-BcContainerPlatformVersion
|
||||
Export-ModuleMember -Function Get-BcContainerPlatformVersion -Alias Get-NavContainerPlatformVersion
|
||||
|
|
|
@ -13,37 +13,19 @@ Function Get-BcContainerServerConfiguration {
|
|||
[String] $ContainerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
$ResultObjectArray = @()
|
||||
$config = Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock{
|
||||
Get-NavServerInstance | Get-NAVServerConfiguration -AsXml
|
||||
}
|
||||
|
||||
$Object = New-Object -TypeName PSObject -Property @{
|
||||
ContainerName = $ContainerName
|
||||
}
|
||||
|
||||
if ($config) {
|
||||
$Config.configuration.appSettings.add | ForEach-Object{
|
||||
$Object | Add-Member -MemberType NoteProperty -Name $_.Key -Value $_.Value
|
||||
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock{ Param($ContainerName)
|
||||
$config = Get-NAVServerConfiguration -serverinstance BC -AsXml
|
||||
$Object = [ordered]@{ "ContainerName" = $ContainerName }
|
||||
if ($config) {
|
||||
$Config.configuration.appSettings.add | ForEach-Object{
|
||||
$Object += @{ "$($_.Key)" = $_.Value }
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Object | Add-Member -MemberType NoteProperty -Name "ServerInstance" -Value ""
|
||||
}
|
||||
|
||||
$ResultObjectArray += $Object
|
||||
|
||||
Write-Output $ResultObjectArray
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
else {
|
||||
$Object += @{ "ServerInstance" = "" }
|
||||
}
|
||||
$object | ConvertTo-Json -Depth 99 -compress
|
||||
} -argumentList $containerName | ConvertFrom-Json
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerServerConfiguration -Value Get-BcContainerServerConfiguration
|
||||
Export-ModuleMember -Function Get-BcContainerServerConfiguration -Alias Get-NavContainerServerConfiguration
|
||||
|
|
|
@ -19,9 +19,6 @@ function Get-BcContainerSharedFolders {
|
|||
[string] $containerName = $bcContainerHelperConfig.defaultContainerName
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
$inspect = docker inspect $containerName | ConvertFrom-Json
|
||||
$sharedFolders = @{}
|
||||
if ($inspect.HostConfig.Binds) {
|
||||
|
@ -50,13 +47,5 @@ try {
|
|||
}
|
||||
return $sharedFolders
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainerSharedFolders -Value Get-BcContainerSharedFolders
|
||||
Export-ModuleMember -Function Get-BcContainerSharedFolders -Alias Get-NavContainerSharedFolders
|
||||
|
|
|
@ -11,8 +11,6 @@ function Get-BcContainers {
|
|||
[switch] $includeLabels
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
if ($includeLabels) {
|
||||
$containers = @()
|
||||
docker ps --filter "label=nav" -a --no-trunc --format 'name={{.Names}},id={{.ID}},image={{.Image}},createdat={{.CreatedAt}},runningfor={{.RunningFor}},size={{.Size}},status={{.Status}},{{.Labels}}' | % {
|
||||
|
@ -30,13 +28,5 @@ try {
|
|||
}
|
||||
$containers
|
||||
}
|
||||
catch {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Get-NavContainers -Value Get-BcContainers
|
||||
Export-ModuleMember -Function Get-BcContainers -Alias Get-NavContainers
|
||||
|
|
|
@ -535,7 +535,16 @@ function CopyAppFilesToFolder {
|
|||
elseif (Test-Path $appFile -PathType Leaf) {
|
||||
Get-ChildItem $appFile | ForEach-Object {
|
||||
$appFile = $_.FullName
|
||||
if ([string]::new([char[]](Get-Content $appFile @byteEncodingParam -TotalCount 2)) -eq "PK") {
|
||||
if ($appFile -like "*.app") {
|
||||
$destFileName = [System.IO.Path]::GetFileName($appFile)
|
||||
$destFile = Join-Path $folder $destFileName
|
||||
if (Test-Path $destFile) {
|
||||
Write-Host -ForegroundColor Yellow "::WARNING::$destFileName already exists, it looks like you have multiple app files with the same name. App filenames must be unique."
|
||||
}
|
||||
Copy-Item -Path $appFile -Destination $destFile -Force
|
||||
$destFile
|
||||
}
|
||||
elseif ([string]::new([char[]](Get-Content $appFile @byteEncodingParam -TotalCount 2)) -eq "PK") {
|
||||
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
|
||||
$copied = $false
|
||||
try {
|
||||
|
@ -553,15 +562,6 @@ function CopyAppFilesToFolder {
|
|||
if ($copied) { Remove-Item -Path $appFile -Force }
|
||||
}
|
||||
}
|
||||
elseif ($appFile -like "*.app") {
|
||||
$destFileName = [System.IO.Path]::GetFileName($appFile)
|
||||
$destFile = Join-Path $folder $destFileName
|
||||
if (Test-Path $destFile) {
|
||||
Write-Host -ForegroundColor Yellow "::WARNING::$destFileName already exists, it looks like you have multiple app files with the same name. App filenames must be unique."
|
||||
}
|
||||
Copy-Item -Path $appFile -Destination $destFile -Force
|
||||
$destFile
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче