CLI: SharePoint --data flag and wildcards (#2580)
## Description Enables feature SharePoint to use "wildcard" to select all available sites with the ability to only backup selected categories. Example ```bash ./corso backup create sharepoint --web-url "*" --data libraries ``` <!-- Insert PR description--> ## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🐛 Bugfix ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * closes #2579<issue> ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual
This commit is contained in:
parent
960cb45ca8
commit
7ba3be5242
@ -303,19 +303,13 @@ func sharePointBackupCreateSelectors(
|
|||||||
|
|
||||||
for _, site := range sites {
|
for _, site := range sites {
|
||||||
if site == utils.Wildcard {
|
if site == utils.Wildcard {
|
||||||
sel := selectors.NewSharePointBackup(selectors.Any())
|
return includeAllSitesWithCategories(cats), nil
|
||||||
sel.Include(sel.AllData())
|
|
||||||
|
|
||||||
return sel, nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, wURL := range weburls {
|
for _, wURL := range weburls {
|
||||||
if wURL == utils.Wildcard {
|
if wURL == utils.Wildcard {
|
||||||
sel := selectors.NewSharePointBackup(selectors.Any())
|
return includeAllSitesWithCategories(cats), nil
|
||||||
sel.Include(sel.AllData())
|
|
||||||
|
|
||||||
return sel, nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,10 +322,21 @@ func sharePointBackupCreateSelectors(
|
|||||||
}
|
}
|
||||||
|
|
||||||
sel := selectors.NewSharePointBackup(union)
|
sel := selectors.NewSharePointBackup(union)
|
||||||
|
|
||||||
|
return addCategories(sel, cats), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func includeAllSitesWithCategories(categories []string) *selectors.SharePointBackup {
|
||||||
|
sel := addCategories(
|
||||||
|
selectors.NewSharePointBackup(selectors.Any()),
|
||||||
|
categories)
|
||||||
|
|
||||||
|
return sel
|
||||||
|
}
|
||||||
|
|
||||||
|
func addCategories(sel *selectors.SharePointBackup, cats []string) *selectors.SharePointBackup {
|
||||||
if len(cats) == 0 {
|
if len(cats) == 0 {
|
||||||
sel.Include(sel.AllData())
|
sel.Include(sel.AllData())
|
||||||
|
|
||||||
return sel, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, d := range cats {
|
for _, d := range cats {
|
||||||
@ -343,7 +348,7 @@ func sharePointBackupCreateSelectors(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sel, nil
|
return sel
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user