Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
* development:
  (version) 2.3.1
  (doc) update description
  (doc) Include Chocolatey Software
  (maint) convert psd1 to utf8
  (maint) formatting
  Make the match end in .config
  [66] A fix for issue #66 - failing to download chocolatey installer
  added priority validation to test (#64)
  • Loading branch information
ferventcoder committed Apr 18, 2017
2 parents c549ba3 + 0d805ac commit b7688a0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 31 deletions.
10 changes: 9 additions & 1 deletion DSCResources/cChocoInstaller/cChocoInstaller.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,17 @@ function Get-FileDownload {
[ValidateNotNullOrEmpty()]
[string]$file
)
# Set security protocol preference to avoid the download error if the machine has disabled TLS 1.0 and SSLv3
# See: https://chocolatey.org/install (Installing With Restricted TLS section)
# Since cChoco requires at least PowerShell 4.0, we have .NET 4.5 available, so we can use [System.Net.SecurityProtocolType] enum values by name.
$securityProtocolSettingsOriginal = [System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls -bor [System.Net.SecurityProtocolType]::Ssl3

Write-Verbose "Downloading $url to $file"
$downloader = new-object -TypeName System.Net.WebClient
$downloader.DownloadFile($url, $file)

[System.Net.ServicePointManager]::SecurityProtocol = $securityProtocolSettingsOriginal
}

Function Install-Chocolatey {
Expand Down Expand Up @@ -184,4 +192,4 @@ Function Install-Chocolatey {
Write-Verbose 'Finish InstallChoco'
}

Export-ModuleMember -Function *-TargetResource
Export-ModuleMember -Function *-TargetResource
13 changes: 10 additions & 3 deletions DSCResources/cChocoSource/cChocoSource.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,23 @@ function Test-TargetResource
$chocofolder = $env:ChocolateyInstall
}
$configfolder = "$chocofolder\config"
$configfile = Get-ChildItem $configfolder | Where-Object {$_.Name -match "chocolatey.config"}
$configfile = Get-ChildItem $configfolder | Where-Object {$_.Name -match "chocolatey.config$"}

$xml = [xml](Get-Content $configfile.FullName)
$sources = $xml.chocolatey.sources.source

foreach($chocosource in $sources)
{
if($chocosource.id -eq $name -and $ensure -eq 'Present')
{
return $true
{
if ($chocosource.priority -eq $Priority)
{
return $true
}
else
{
return $false
}
}
elseif($chocosource.id -eq $name -and $ensure -eq 'Absent')
{
Expand Down
34 changes: 17 additions & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#---------------------------------#
# environment configuration #
#---------------------------------#
version: 2.3.0.{build}
#---------------------------------#
# environment configuration #
#---------------------------------#
version: 2.3.1.{build}
os: WMF 5
install:
- ps: . .\AppVeyor\AppVeyorInstall.ps1
Expand All @@ -12,20 +12,20 @@ environment:
github_access_token:
secure: Xk7jTkdE82qskQy9WPZK0zSafSjT6gK1SYxH8m4Aa8muCMQ4ACkkztJ3toh9DFlS
ModuleName: cChoco
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- ps: . .\AppVeyor\AppVeyorBuild.ps1

#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
- ps: . .\AppVeyor\AppVeyorTest.ps1

#---------------------------------#
# deployment configuration #
#---------------------------------#
deploy_script:
- ps: . .\AppVeyor\AppveyorDeploy.ps1
#---------------------------------#
# deployment configuration #
#---------------------------------#
deploy_script:
- ps: . .\AppVeyor\AppveyorDeploy.ps1
20 changes: 10 additions & 10 deletions cChoco.psd1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@{
Copyright = "(c) 2013-2016 Lawrence Gripper, All rights reserved.";
Description = "Module with DSC Resources for using Chocolatey http://chocolatey.org/";
CompanyName = "Lawrence Gripper";
GUID = "4857229F-8C2D-41BB-A068-9E3C0C8ED63D";
PowerShellVersion = "4.0";
FunctionsToExport = "*";
CLRVersion = "4.0";
CmdletsToExport = "*";
Author = "Lawrence Gripper, Javy de Koning";
ModuleVersion = "2.3.0.0"
Copyright = "(c) 2017 Chocolatey Software, (c) 2013-2017 Lawrence Gripper, All rights reserved.";
Description = "Chocolatey DSC Resources for use with internal packages and the community package repository. Learn more at http://chocolatey.org/";
CompanyName = "Chocolatey Software";
GUID = "4857229F-8C2D-41BB-A068-9E3C0C8ED63D";
PowerShellVersion = "4.0";
FunctionsToExport = "*";
CLRVersion = "4.0";
CmdletsToExport = "*";
Author = "Chocolatey Software, Lawrence Gripper, Javy de Koning";
ModuleVersion = "2.3.1.0"
}

0 comments on commit b7688a0

Please sign in to comment.