Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Src/Private/Expand-LabResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ function Expand-LabResource {
$resourceSourcePath = Join-Path $resourcePath -ChildPath $resource.Id;

if ($resource.Filename) {

$resourceSourcePath = Join-Path $resourcePath -ChildPath $resource.Filename;

if ($resource.DownloadToFolder -and $resource.Expand) {
$resourceSourcePath = Join-Path $resourcePath -ChildPath (Join-Path -Path $resource.Id -ChildPath $resource.Filename)
} elseif ($resource.DownloadToFolder) {
$resourceSourcePath = Join-Path $resourcePath -ChildPath $resource.Id
} else {
$resourceSourcePath = Join-Path $resourcePath -ChildPath $resource.Filename;
}
if ($resource.IsLocal) {

$resourceSourcePath = Resolve-Path -Path $resource.Filename;
Expand Down Expand Up @@ -113,8 +119,9 @@ function Expand-LabResource {
switch ([System.IO.Path]::GetExtension($resourceSourcePath)) {

'.iso' {

Write-Verbose "Expand [$($resourceItem.FullName)] to [$resourceDestinationPath]"
Expand-LabIso -Path $resourceItem.FullName -DestinationPath $resourceDestinationPath;
break;
}

'.zip' {
Expand All @@ -126,6 +133,13 @@ function Expand-LabResource {
Verbose = $false;
}
[ref] $null = Expand-ZipArchive @expandZipArchiveParams;
break;
}

{ $resource.DownloadToFolder } {
Write-Verbose "Copy [$resourceSourcePath] from [$($resourceItem.FullName)] to [$resourceDestinationPath]"
Copy-Item -Path $resourceItem.FullName $resourceDestinationPath -Recurse
break;
}

Default {
Expand Down
1 change: 0 additions & 1 deletion Src/Private/Get-LabHostDscConfigurationPath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ function Get-LabHostDscConfigurationPath {

} #end process
} #end function Get-LabHostDscConfigurationPath

7 changes: 4 additions & 3 deletions Src/Private/Get-LabMofModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ function Get-LabMofModule {
foreach ($line in [System.IO.File]::ReadLines($Path)) {

$currentLineNumber++;
if ($line -match '^instance of (?!MSFT_Credential|MSFT_xWebBindingInformation)') {
if ($line -match '^instance of (?!MSFT_Credential|MSFT_xWebBindingInformation|ServerPermission)') {
## Ignore MSFT_Credential and MSFT_xWebBindingInformation types. There may be
## other types that need suppressing, but they'll be resource specific
## other types that need suppressing, but they'll be resource specific, like
## ServerPermission is part of SqlServerDsc

if ($null -eq $currentModule) {

Expand All @@ -59,7 +60,7 @@ function Get-LabMofModule {
}
else {

Write-Warning -Message ($localized.CannotResolveMofModuleWarning -f $instanceLineNumber);
Write-Warning -Message ($localized.CannotResolveMofModuleWarning -f $path, $instanceLineNumber, $line);
}

$instanceLineNumber = $currentLineNumber;
Expand Down
2 changes: 1 addition & 1 deletion Src/Private/Invoke-LabMediaImageDownload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Invoke-LabMediaImageDownload {
$hostDefaults = Get-ConfigurationData -Configuration Host;

$invokeResourceDownloadParams = @{
DestinationPath = Join-Path -Path $hostDefaults.IsoPath -ChildPath $media.Filename;
DestinationPath = if ($media.DownloadToFolder) { Join-Path -Path $hostDefaults.IsoPath -ChildPath (Join-Path -Path $media.Id -ChildPath $media.Filename); } else { Join-Path -Path $hostDefaults.IsoPath -ChildPath $media.Filename; }
Uri = $media.Uri;
Checksum = $media.Checksum;
}
Expand Down
8 changes: 8 additions & 0 deletions Src/Private/New-LabMedia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function New-LabMedia {
[ValidateSet('x86','x64')]
[System.String] $Architecture = $(throw ($localized.MissingParameterError -f 'Architecture')),

[Parameter(ValueFromPipelineByPropertyName)]
[System.Boolean] $DownloadToFolder,

[Parameter(ValueFromPipelineByPropertyName)]
[System.Boolean] $CopyToFolder,

[Parameter(ValueFromPipelineByPropertyName)]
[System.String] $ImageName = '',

Expand Down Expand Up @@ -80,6 +86,8 @@ function New-LabMedia {
Filename = $Filename;
Description = $Description;
Architecture = $Architecture;
DownloadToFolder = $DownloadToFolder;
CopyToFolder = $CopyToFolder;
ImageName = $ImageName;
MediaType = $MediaType;
OperatingSystem = $OperatingSystem;
Expand Down
8 changes: 7 additions & 1 deletion Src/Public/Invoke-LabResourceDownload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ function Invoke-LabResourceDownload {
if (($null -eq $resource.IsLocal) -or ($resource.IsLocal -eq $false)) {

$fileName = $resource.Id;
if ($resource.Filename) { $fileName = $resource.Filename; }
if ($resource.Filename) {
if ($resource.DownloadToFolder) {
$fileName = $fileName + "\" + $resource.Filename
} else {
$fileName = $resource.Filename
}
}
$resourceDestinationPath = Join-Path -Path $DestinationPath -ChildPath $fileName;
$invokeResourceDownloadParams = @{
DestinationPath = $resourceDestinationPath;
Expand Down
2 changes: 1 addition & 1 deletion en-US/Lability.Resources.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ConvertFrom-StringData -StringData @'
ExplicitOutputPathWarning = Parameter 'OutputPath' was explicitly passed and is also defined in the 'ConfigurationParameters' hashtable. Using OutputPath '{0}'.
ExplicitConfigurationDataWarning = Parameter 'ConfigurationData' was explicitly passed and is also defined in the 'ConfigurationParameters' hashtable. Using ConfigurationData '{0}'.
SkippingMetaConfigurationWarning = Skipping meta configuration file '{0}'.
CannotResolveMofModuleWarning = Cannot resolve MOF module name and/or version of the instance defined at line {0}.
CannotResolveMofModuleWarning = Cannot resolve MOF module name and/or version of the instance defined in file '{0}' at line {1} as '{2}'.
ModuleUsingMinimumVersionWarning = Module '{0}' definition is configured with the 'MinimumVersion' property. It is recommended to use the 'RequiredVersion' property instead.
ModuleMissingRequiredVerWarning = Module '{0}' definition is missing 'RequiredVersion' property. It recommended to use the 'RequiredVersion' property.
MofModuleVersionMismatchWarning = Module '{0}' version mismatch. The version '{1}' defined in the .mof file does not match the version '{2}' defined in the Lability configuration file.
Expand Down