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

skips lists with certain templates from being backed-up #4931

Merged
merged 9 commits into from
Dec 28, 2023

Conversation

HiteshRepo
Copy link
Contributor

@HiteshRepo HiteshRepo commented Dec 23, 2023

skips documentLibrary templated lists from:

  • restoration
  • details

but the lists with 'documentLibrary' are backed-up.
this is in addition to 'webTemplateExtensionsList' templated lists which were previously skipped from restore.

the skipping of lists with template 'documentLibrary' is temporary and to be enabled with correct handling.

update:27/12/2023
skips documentLibrary, sharingLinks, webTemplateExtensionsList templated lists from being backed-up altogether

site contents of https://10rqc2.sharepoint.com/sites/CorsoCI:
Screenshot from 2023-12-23 20-20-45

backup details

./corso backup details sharepoint --backup 5e0a13b0-bff0-471b-8860-2aec869717b2
Logging to file: /home/hitesh/.cache/corso/logs/2023-12-23T14-52-37Z.log
Connecting to M365                               done 
Connecting to repository                     30s done 
  ID            List                                                     Items  Created               Modified            
  c7ffe2f0a275  Test List                                                0      2023-05-12T12:28:51Z  2023-05-12T12:28:51Z
  5345df87b565  Meh                                                      0      2023-05-12T12:59:50Z  2023-05-12T12:59:50Z
  cd2854591ab4  corso-restore-list_135b9067-0e19-4a5c-9475-ced51730c211  0      2023-12-11T10:25:27Z  2023-12-23T13:19:24Z
  0f56b7f450fa  corsorestorelist_newlist                                 0      2023-12-11T10:31:54Z  2023-12-11T10:31:54Z
  3a7be2fb9d50  new list                                                 0      2023-11-29T18:29:07Z  2023-11-29T18:29:07Z
  edab0c775e5e  New List Name                                            0      2023-05-12T12:39:06Z  2023-12-23T13:25:39Z
  4d7ad9b1df98  MockListing                                              0      2023-05-12T12:15:14Z  2023-12-14T06:22:36Z
  d2bdca596f75  integration-test-list                                    6      2023-11-30T06:57:01Z  2023-12-14T06:09:45Z
  c9eccc9771a3  Sharing Links                                            74     2023-06-26T07:21:31Z  2023-12-14T06:06:31Z
  5e79dcd93c92  New List Name 2                                          0      2023-05-12T12:40:15Z  2023-05-12T12:40:15Z
  6a6acbaa0d10  corsorestorelist_7f99d792-cae0-4a87-9e68-fd930f5b123e    0      2023-12-11T10:28:25Z  2023-12-23T13:19:57Z

restore details

./corso restore sharepoint --backup 5e0a13b0-bff0-471b-8860-2aec869717b2
Logging to file: /home/hitesh/.cache/corso/logs/2023-12-23T14-53-37Z.log
Connecting to M365                               done 
Connecting to repository                     26s done 
Restoring to folder Corso_Restore_23-Dec-2023_14-54-05
  
Restoring ∙ https://10rqc2.sharepoint.com/sites/CorsoCI              
Discovered 11 items in backup 5e0a13b0-bff0-471b-8860-2aec869717b2 to restore   
Enumerating items in repository             1m2s done 
Restoring data                               50s done 
Restore Complete
Restored 11 items
  ID            List                                                                                        Items  Created               Modified            
  edab0c775e5e  Corso_Restore_23-Dec-2023_14-54-05_New List Name                                            0      2023-12-23T14:54:23Z  2023-12-23T14:54:23Z
  cd2854591ab4  Corso_Restore_23-Dec-2023_14-54-05_corso-restore-list_135b9067-0e19-4a5c-9475-ced51730c211  0      2023-12-23T14:54:25Z  2023-12-23T14:54:25Z
  5345df87b565  Corso_Restore_23-Dec-2023_14-54-05_Meh                                                      0      2023-12-23T14:54:26Z  2023-12-23T14:54:26Z
  4d7ad9b1df98  Corso_Restore_23-Dec-2023_14-54-05_MockListing                                              0      2023-12-23T14:54:28Z  2023-12-23T14:54:28Z
  d2bdca596f75  Corso_Restore_23-Dec-2023_14-54-05_integration-test-list                                    6      2023-12-23T14:54:29Z  2023-12-23T14:54:31Z
  c7ffe2f0a275  Corso_Restore_23-Dec-2023_14-54-05_Test List                                                0      2023-12-23T14:54:34Z  2023-12-23T14:54:34Z
  c9eccc9771a3  Corso_Restore_23-Dec-2023_14-54-05_Sharing Links                                            74     2023-12-23T14:54:36Z  2023-12-23T14:54:36Z
  5e79dcd93c92  Corso_Restore_23-Dec-2023_14-54-05_New List Name 2                                          0      2023-12-23T14:55:09Z  2023-12-23T14:55:09Z
  6a6acbaa0d10  Corso_Restore_23-Dec-2023_14-54-05_corsorestorelist_7f99d792-cae0-4a87-9e68-fd930f5b123e    0      2023-12-23T14:55:10Z  2023-12-23T14:55:10Z
  0f56b7f450fa  Corso_Restore_23-Dec-2023_14-54-05_corsorestorelist_newlist                                 0      2023-12-23T14:55:11Z  2023-12-23T14:55:11Z

Does this PR need a docs update or release note?

  • ⛔ No

Type of change

  • 🐛 Bugfix

Issue(s)

#4754

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@HiteshRepo HiteshRepo added restore sharepoint lists category of sharepoint service labels Dec 23, 2023
@HiteshRepo HiteshRepo self-assigned this Dec 23, 2023
Copy link
Contributor

aviator-app bot commented Dec 23, 2023

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.

Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@@ -358,7 +358,7 @@ func (sc *Collection) handleListItems(
rc := io.NopCloser(bytes.NewReader(entryBytes))
itemInfo := details.ItemInfo{
SharePoint: info,
NotRecoverable: template == api.WebTemplateExtensionsListTemplateName,
NotRecoverable: api.NonRestorableListTemplates.HasKey(template),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could have been two ifs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a list entry needs to be NonRecoverable if the template is either 'webTemplateExtensionsList' or 'documentLibrary'(temporarily). And NonRestorableListTemplates map contains both of them, so if the current listTemplate is either of the two types, NotRecoverable becomes true for that entry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, I was mentioning that this could be template == api.WebTemplateExtensionsListTemplateName || template == api.documentLibrary. I personally feel this to be more clear.

ptr.Val(newList.GetList().GetTemplate()) == WebTemplateExtensionsListTemplateName {
return nil, clues.StackWC(ctx, ErrCannotCreateWebTemplateExtension)
NonRestorableListTemplates.HasKey(ptr.Val(newList.GetList().GetTemplate())) {
return nil, clues.StackWC(ctx, ErrCannotCreateNonRestorableListTemplate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the error could be something smaller like SystemListTempalte and we could have more information in the comments next to the const definition.

Copy link
Contributor Author

@HiteshRepo HiteshRepo Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentLibrary will not fall under system generated. Lists with that template needs to handled differently. Putting documentLibrary under non-restorable is temporary change. Should we shorten it to 'ErrNonRestorableListTemplate'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good, lets do ErrNonRestorableListTemplate.

Copy link

sonarcloud bot commented Dec 28, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lists category of sharepoint service mergequeue restore sharepoint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants