Bug-fix: spo site remove#5955
Conversation
|
Thanks @MathijsVerbeeck, we'll have a look at it ASAP! |
|
Please keep in mind to create a new issue to remove the wait option in v8. |
Thanks for the reminder. |
milanholemans
left a comment
There was a problem hiding this comment.
Nice work @MathijsVerbeeck, command looks a whole lot better already. Could you have a look at the comments I made before we continue?
|
Thanks for the thorough review. Could you have another look? |
75cf2aa to
594a2a8
Compare
milanholemans
left a comment
There was a problem hiding this comment.
The command is getting a nice shape. Unfortunately, I encountered some issues which we should definitely have a look at. Could you have a look at the comments I made before I do another test run?
milanholemans
left a comment
There was a problem hiding this comment.
Did another review. Command is working almost perfectly, few more changes are needed.
1ad309a to
86c439a
Compare
86c439a to
62ff25b
Compare
milanholemans
left a comment
There was a problem hiding this comment.
Great work, made a few last changes while merging.
| if (options.skipRecycleBin) { | ||
| if (this.verbose) { | ||
| await logger.logToStderr(`Site group doesn't exist. Searching in the Microsoft 365 deleted groups.`); | ||
| await logger.logToStderr(`Checking if group '${siteDetails.GroupId}' is already permanently deleted from recycle bin.`); |
There was a problem hiding this comment.
Since we added another verbose log in the function itself, we can remove this one.
| let amountOfPolls = 0; | ||
|
|
||
| await this.deleteOrphanedSite(logger, args.options.url); | ||
| while (!isGroupInRecycleBin && amountOfPolls < 23) { |
There was a problem hiding this comment.
23 looks like an arbitrary number, no?
|
|
||
| if (options.fromRecycleBin) { | ||
| if (!siteDetails.TimeDeleted) { | ||
| throw `Site is currently not in the recycle bin. Do not specify --fromRecycleBin if you want to try to remove it from the active sites.`; |
There was a problem hiding this comment.
Let's sound a bit more confident :)
| throw `Site is currently not in the recycle bin. Do not specify --fromRecycleBin if you want to try to remove it from the active sites.`; | |
| throw `Site is currently not in the recycle bin. Remove --fromRecycleBin if you want to remove it as active site.`; |
|
|
||
| } | ||
| } | ||
| it('deletes a group site, deletes the m365 group from entra id and immediately deletes the site from the recycle bin, but skips deletion of the m365 group when it does not exist in Entra', async () => { |
There was a problem hiding this comment.
Reading the title, we should check if delete was not called instead of amountOfPolls.
|
|
||
| throw 'Invalid request'; | ||
| }); | ||
| it('aborts removing the site when prompt not confirmed', async () => { |
There was a problem hiding this comment.
Let's also check for the remove request.
| ]); | ||
| } | ||
| } | ||
| it('fails validation if siteUrl is a valid url', async () => { |
| assert.notStrictEqual(actual, true); | ||
| }); | ||
|
|
||
| it('fails validation if both fromRecycleBin and skipRecycleBin is specified is a valid url', async () => { |
There was a problem hiding this comment.
| it('fails validation if both fromRecycleBin and skipRecycleBin is specified is a valid url', async () => { | |
| it('fails validation if both fromRecycleBin and skipRecycleBin are specified', async () => { |
| * @param url The URL to process. | ||
| * @returns The URL without trailing slash. | ||
| */ | ||
| removeTrailingSlash(url: string): string { |
There was a problem hiding this comment.
Let's rename to removeTrailingSlashes since it removes multiple slashes.
|
Merged manually, thanks for fixing this issue! |
Closes #5218