-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add services restart to Set-EsxiCertificateMode
#110
feat: add services restart to Set-EsxiCertificateMode
#110
Conversation
Set-EsxiCertificateMode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please amend with an update to the CHANGELOG.md
and a bump to the build in the .psd1
.
Example:
## v1.5.2
> Release Date: Unreleased
Enhancement:
- Added a restart for specific vCenter Server services to `Set-EsxiCertificateMode` function. [GH-110](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-certificate-management/pull/110)
# Version number of this module.
ModuleVersion = '1.5.2.1000'
a973c12
to
52bfa81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about something like this:
Helper function:
function Restart-VcenterService($serviceName) {
Invoke-RestartService -Service $serviceName
Start-Sleep -Seconds 30
$serviceStatus = Invoke-GetService -Service $serviceName
if ($serviceStatus.state -eq "STARTED") {
Write-Output "$serviceName restarted successfully."
return $null
} else {
Write-Error "$serviceName failed to restart."
return $serviceName
}
}
Then:
$services = @("certificateauthority", "certificatemanagement")
$failedServices = @()
foreach ($service in $services) {
$failedService = Restart-VcenterService $service
if ($null -ne $failedService) {
$failedServices += $failedService
}
}
if ($failedServices.Count -gt 0) {
$failedServicesList = [string]::Join(", ", $failedServices)
Write-Error "The following services failed to start: $failedServicesList. Operation Failed." -ErrorAction Stop
}
But perhaps add / modify the sleep with a counter?
And then add a check to verify that the mode is set as desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more suggestion after what Ryan requested is to add an output message. Rest all good.
CHANGELOG.md and .psd1 file updated. add a helper function. the suggested method would result in return value contains both the write-output and the return value so i modify it to return an array instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, could you modify the function -
Set-EsxiCertificateMode to use the Restart-VcenterService - the new one you created. also add documentation for Restart-VcenterService function.
I still have some open comments. |
which ones? I have commented in #110 (comment) to resolve the first 2 comments. I do not see any other comments? |
eb03752
to
35da4b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Kevin has a couple minor changes to make that we discussed yesterday and we'll delay until those are addressed- mainly around the service status of healthy. |
89b7813
to
8ade530
Compare
dded a restart for specific vCenter Server services to `Set-EsxiCertificateMode` function. Signed-off-by: Kevin Teng <kevin.teng@broadcom.com>
8ade530
to
4944d17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Summary
Added a restart for specific vCenter Server services to
Set-EsxiCertificateMode
function.Type
Please describe:
Breaking Changes?
Test and Documentation
Issue References
Closes #33
Additional Information