Skip to content

Commit

Permalink
Add support to skip SSL checks
Browse files Browse the repository at this point in the history
  • Loading branch information
glennsarti committed Nov 17, 2017
1 parent 70b014a commit f6234b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PuppetPSDrive.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ Function Script:Get-PuppetLoginToken() {
$sv = $null

$contentType = 'application/x-www-form-urlencoded'
$skipCert = ($ENV:PuppetConsoleIgnoreSSL -ne $null) -and ($ENV:PuppetConsoleIgnoreSSL.ToUpper() -eq 'TRUE')
$result = Invoke-WebRequest -Uri "$($ENV:PuppetConsoleURI)/auth/login" -ContentType $contentType `
-Method Post -Body $body -SessionVariable sv
-Method Post -Body $body -SessionVariable sv -SkipCertificateCheck:$skipCert

$body = $null
$password = $null
Expand Down Expand Up @@ -519,7 +520,8 @@ Function Script:Invoke-PuppetRequest($URI, $Method = 'GET', $Body = $null) {
if ($Body -ne $null) { $iwrArgs.Add('Body', $Body) }
$oldPreference = $progressPreference
$progressPreference = 'SilentlyContinue'
$result = Invoke-WebRequest @iwrArgs
$skipCert = ($ENV:PuppetConsoleIgnoreSSL -ne $null) -and ($ENV:PuppetConsoleIgnoreSSL.ToUpper() -eq 'TRUE')
$result = Invoke-WebRequest @iwrArgs -SkipCertificateCheck:$skipCert
$progressPreference = $oldPreference

Return $result.Content
Expand Down

0 comments on commit f6234b6

Please sign in to comment.