Skip to content

Commit

Permalink
Fixing the onlyif statement as well as the erb template for creating …
Browse files Browse the repository at this point in the history
…the certificate binding
  • Loading branch information
stack72 committed Apr 22, 2014
1 parent fea37ef commit da0a08c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifests/manage_binding.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

exec { "Attach-Certificate-${title}":
command => "C:\\temp\\create-${name}.ps1",
onlfif => "C:\\temp\\inspect-${name}.ps1",
onlyif => "C:\\temp\\inspect-${name}.ps1",
require => [File["inspect-${title}-certificate.ps1"], File["create-${title}-certificate.ps1"]],
provider => powershell,
logoutput => true,
Expand Down
6 changes: 3 additions & 3 deletions templates/create-certificate-binding.ps1.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ $site = Get-Website | Where-Object { $_.Name -eq "<%= site_name %>" }
$certsAttachedToSite = Get-ChildItem IIS:\SSLBindings | ? { $site | Select-Object { $_ -contains $_.Sites.Value }} | % { $_.Thumbprint }
$certificate = Get-ChildItem CERT:\LocalMachine\My | ? { $certsAttachedToSite -contains $_.Thumbprint} | Where-Object { $_.Thumbprint -eq "<%= certificate_thumbprint %>" }

if((Test-Path IIS:\SslBindings\$ip!$port) -eq $false) {
if((Test-Path IIS:\SslBindings\<%= ip_address %>!<%= port %>) -eq $false) {
push-location IIS:\SslBindings
Get-Item Cert:\LocalMachine\My\<%= certificate_thumbprint %> | New-Item <%= ip_address %>!443
Get-Item Cert:\LocalMachine\My\<%= certificate_thumbprint %> | New-Item <%= ip_address %>!<%= port %>
}
elseif (((Test-Path IIS:\SslBindings\$ip!$port) -eq $true) -and (($certificate -ne $null) -or ($certificate.Thumbprint -ne <%= certificate_thumbprint %>))) {
elseif (((Test-Path IIS:\SslBindings\<%= ip_address %>!<%= port %>) -eq $true) -and (($certificate -ne $null) -or ($certificate.Thumbprint -ne "<%= certificate_thumbprint %>"))) {
push-location IIS:\SslBindings
Get-Item Cert:\LocalMachine\My\<%= certificate_thumbprint %> | Set-Item <%= ip_address %>!<%= port %>
foreach ($cert in $certificates) {
Expand Down

0 comments on commit da0a08c

Please sign in to comment.