epv-api-scripts icon indicating copy to clipboard operation
epv-api-scripts copied to clipboard

AOU - unable to create safes based on template safe

Open NathTheDude opened this issue 7 months ago • 0 comments

Summary

Although selecting -templatesafe parameter when running this script, no new safes are created for accounts when the safe does not exist already.

Steps to Reproduce

  1. Run the AOU script including the parameters -create and -templatesafe

Expected Results

Script reads a line for an account to be onboarded script should check if safe exists If safe exists, carry on and check if account already exists and then onboard account if unique if safe does not exist, create a new safe carry on going through csv for each account on there.

Actual Results

When attempting to onboard an account where the safe does not already exist, the logic seems to fail. If the safe does ot does not exist the output in the debug log states 'Safe exists.

Seems like the logic for the function 'Test-Safe' is bad with $true always being returned try { If ($null -eq $(Get-Safe -safeName $safeName -ErrAction "SilentlyContinue")) { # Safe does not exist Write-LogMessage -Type Warning -MSG "Safe $safeName does not exist" return $false } else { # Safe exists Write-LogMessage -Type Info -MSG "Safe $safeName exists" return $true } } catch { Write-LogMessage -Type Error -MSG "Error testing safe '$safeName' existence. Error: $(Join-ExceptionMessage $_.Exception)" -ErrorAction "SilentlyContinue" }

Reproducible

  • [x] Always
  • [ ] Sometimes
  • [ ] Non-Reproducible

Version/Tag number

What version of the product are you running? Any version info that you can share is helpful. For example, you might give the version from Docker logs, the Docker tag, a specific download URL, the output of the /info route, etc.

Environment setup

  • Can you describe the environment in which this product is running? Is it running on a VM / in a container / in a cloud?
  • Which cloud provider? Which container orchestrator (including version)?
  • The more info you can share about your runtime environment, the better we may be able to reproduce the issue.

Additional Information

Add any other context about the problem here.

NathTheDude avatar Nov 29 '23 21:11 NathTheDude