Skip to content
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

New-DbaAvailabilityGroup - add a test before attempting to add database #7962

Merged
merged 4 commits into from Nov 19, 2021

Conversation

potatoqualitee
Copy link
Member

Sometimes this awesome command would be too darn fast and the ag wasn't ready to accept a database. This waits until the state is connected before attempting to add.

@andreasjordan
Copy link
Contributor

Good idea. But we should not only wait if we want to add databases within the command, but also wait in any case for the state "connected" before running the final Get-DbaAvailabilityGroup. Because then all other commands in a script that runs New-DbaAvailabilityGroup can rely on a ready-to-go AG. So maybe move the new block up to line 642?

@potatoqualitee
Copy link
Member Author

good idea! moved it

@andreasjordan
Copy link
Contributor

Maybe add a warning message, if $ready is still $false? I would not fail, but let the user know that the AG is maybe not yet ready. Then, if adding the databases failes, the user has a hint why adding databases failed.

@andreasjordan
Copy link
Contributor

"One last thing": -not $ready is sufficent, -or $wait -gt 40 not needed.

@potatoqualitee
Copy link
Member Author

I know, im just covering alll the bases 😅

@potatoqualitee potatoqualitee merged commit 531e5d4 into development Nov 19, 2021
@potatoqualitee
Copy link
Member Author

sweet, thanks 👍🏼

@potatoqualitee potatoqualitee deleted the fixag branch November 19, 2021 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants