vmware / power-validated-solutions-for-cloud-foundation

PowerShell Module for VMware Validated Solutions
https://vmware.github.io/power-validated-solutions-for-cloud-foundation/
BSD 2-Clause "Simplified" License
45 stars 23 forks source link

`Get-LocalAccountLockout` cmdlet should return "Not Configured" as parameter value instead of null value #702

Closed sowjuec closed 3 months ago

sowjuec commented 3 months ago

Code of Conduct

Description

At present in below section of the code, we return null object if values are not found. Instead if we could state some meaninful info like "Parameter Not Configured", it helps user understand better than think that some thing not working and hence output is empty in ppm report page. I have a PPM ticket for your reference [ https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-password-management/issues/198 ]

       $accountLockoutObject = New-Object -TypeName psobject
        $accountLockoutObject | Add-Member -notepropertyname "System" -notepropertyvalue $vmName
        if ($failures) { $accountLockoutObject | Add-Member -notepropertyname "Max Failures" -notepropertyvalue $(if ($drift) { if ($failures -ne $requiredConfig.maxFailures) { "$($failures) [ $($requiredConfig.maxFailures) ]" } else { "$($failures)" } } else { "$($failures)" }) }
        if ($unlockInterval) { $accountLockoutObject | Add-Member -notepropertyname "Unlock Interval (sec)" -notepropertyvalue $(if ($drift) { if ($unlockInterval -ne $requiredConfig.unlockInterval) { "$($unlockInterval) [ $($requiredConfig.unlockInterval) ]" } else { "$($unlockInterval)" } } else { "$($unlockInterval)" }) }
        if ($rootUnlockInterval) { $accountLockoutObject | Add-Member -notepropertyname "Root Unlock Interval (sec)" -notepropertyvalue $(if ($drift) { if ($rootUnlockInterval -ne $requiredConfig.rootUnlockInterval) { "$($rootUnlockInterval) [ $($requiredConfig.rootUnlockInterval) ]" } else { "$($rootUnlockInterval)" } } else { "$($rootUnlockInterval)" }) }
        Return $accountLockoutObject

Use Case(s)

[ https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-password-management/issues/198 ]

As mentioned in the reference ticket raised in PPM, it is like if the SDDC appliance is not configured yet, all values for the account lockout settings of password management policy will be empty, to it is better to show "Not Configured" Instead of empty report, which could be misleading to customers.

Potential Configuration

set variables to a string value "Not Configured" instead of returning it as null.

References

No response

sowjuec commented 3 months ago

Hi Team, This is how I have implemented. @GaryJBlake, kindly provide your feedback.

PS C:\Users\Ashwini\Documents\GitHubPublic\VMware.CloudFoundation.PasswordManagement\tests> Request-SddcManagerAccountLockout -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re123! -rootPass VMw@re123!

System    Unlock Interval (sec) Root Unlock Interval (sec)
------    --------------------- --------------------------
sfo-vcf01 601                   601

PS C:\Users\Ashwini\Documents\GitHubPublic\VMware.CloudFoundation.PasswordManagement\tests> Request-SddcManagerAccountLockout -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re123! -rootPass VMw@re123!

System    Max Failures   Unlock Interval (sec) Root Unlock Interval (sec)
------    ------------   --------------------- --------------------------
sfo-vcf01 Not Configured 601                   601
tenthirtyam commented 3 months ago

kindly provide your feedback.

Looks good to me.

sowjuec commented 3 months ago

Thans Ryan!!!

On Wed, Aug 7, 2024 at 12:13 AM Ryan Johnson @.***> wrote:

kindly provide your feedback.

Looks good to me.

— Reply to this email directly, view it on GitHub https://github.com/vmware/power-validated-solutions-for-cloud-foundation/issues/702#issuecomment-2271921416, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2IMYCBS743AWS5FKZLLI5DZQEKMPAVCNFSM6AAAAABLX2GCNWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZRHEZDCNBRGY . You are receiving this because you were assigned.Message ID: <vmware/power-validated-solutions-for-cloud-foundation/issues/702/2271921416 @github.com>

-- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

github-actions[bot] commented 2 months ago

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.