I figured it out.  Found the correct version of the documentation that 
showed the proper URL.  Although I think it could be written a little 
better.  But oh well

On Wednesday, April 18, 2018 at 12:19:34 PM UTC-5, Ryan Murphy wrote:
>
> Ok folks, since I got help last time, thought I'd try again.  This time 
> I'm trying to deactivate nodes instead of signing their certs.
>
> Here is the code, the first two invoke-restmethods work as expected. But 
> when I try to call the command to Deactivate the node it throws a Schema 
> error.
>
> $ErrorActionPreference = 'continue'
>
> [System.net.ServicePointManager]::ServerCertificateValidationCallback = 
> {$true}
>
> $console_server = 'puppetmater.domain'
>
> $node = "node.domain"
>
> $action = @{desired_state='revoked'}
> $json = $action | ConvertTo-Json
>
>
> $url = 
> "https://${console_server}:8140/puppet-ca/v1/certificate_status/${node}";
>
> echo $url
>
>
> $results = Invoke-RestMethod -Uri "$url" -body $json -method PUT 
> -Certificate (Get-PfxCertificate -FilePath 
> \\server\puppet-certs\Non-Production\certname)
>
> $url = 
> "https://${console_server}:8140/puppet-ca/v1/certificate_status/${node}";
>
> $response = Invoke-RestMethod -Uri "$url" -method DELETE -Certificate 
> (Get-PfxCertificate -FilePath 
> \\server\puppet-certs\Non-Production\certname)
>
>
> echo $response
>
>
> $deactivateAction = @{command="deactivate node"
>                         version='3' 
>                         payload=@{
>                             certname="$node"
>                             }
>                          }
> $json2 = $deactivateAction | ConvertTo-Json
>
> $commandURL = "https://${console_server}:8081/pdb/cmd/v1";
>
> echo $json2
>
>
> $response = Invoke-RestMethod -Uri $commandURL -Method Post  -ContentType 
> 'application/json' -Body $json2 -Certificate (Get-PfxCertificate -FilePath 
> \\server\puppet-certs\Non-Production\certname.pfx)
>
> echo $response
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7c189c5a-56b8-4672-90ed-7ecb99af2973%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to