Created
March 9, 2017 09:09
-
-
Save aelij/8db0a766b315494065390978b68dd97a to your computer and use it in GitHub Desktop.
Cmdlet to create a skeleton Service Fabric application package from the image store. Can be used for partial configuration/data packages upgrades.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Create-ServiceFabricApplicationPackageSkeleton | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] | |
[string] $ApplicationTypeName, | |
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] | |
[string] $ApplicationTypeVersion, | |
[Parameter(Mandatory=$true)] | |
[string] $OutputPath | |
) | |
$OutputPath = [IO.Path]::Combine((Get-Location), $OutputPath) | |
New-Item -Path $OutputPath -ItemType Directory -ErrorAction Ignore | Out-Null | |
$manifest = Get-ServiceFabricApplicationManifest -ApplicationTypeName $ApplicationTypeName -ApplicationTypeVersion $ApplicationTypeVersion | |
$manifest | Out-File -FilePath ([IO.Path]::Combine($OutputPath, 'ApplicationManifest.xml')) | |
$manifestXml = [xml] $manifest; | |
$serviceManifestRefList = $manifestXml.GetElementsByTagName('ServiceManifestRef') | |
foreach ($serviceManifestRef in $serviceManifestRefList) | |
{ | |
$serviceManifestName = $serviceManifestRef.ServiceManifestName | |
New-Item -Path ([IO.Path]::Combine($OutputPath, $serviceManifestName)) -ItemType Directory -ErrorAction Ignore | Out-Null | |
$serviceManifest = Get-ServiceFabricServiceManifest -ApplicationTypeName $ApplicationTypeName -ApplicationTypeVersion $ApplicationTypeVersion ` | |
-ServiceManifestName $serviceManifestName | |
$serviceManifest | Out-File -FilePath ([IO.Path]::Combine($OutputPath, $serviceManifestName, 'ServiceManifest.xml')) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment