More fixes

This commit is contained in:
Vaibhav Kamra 2023-10-06 15:05:59 -07:00
parent 2cf44ee649
commit 3442c1f0ee
3 changed files with 40 additions and 11 deletions

View File

@ -217,7 +217,8 @@ func genericCreateCommand(
if bo.Options.DryRun {
// Print backup stats results here
print.All(ctx, bo.Results.Stats)
Info(ctx, "Discovered data:\n")
print.Item(ctx, bo.Results.Stats)
continue
}
@ -231,6 +232,10 @@ func genericCreateCommand(
}
}
if flags.RunModeFV == flags.RunModeDryRun {
return nil
}
bups, berrs := r.Backups(ctx, bIDs)
if berrs.Failure() != nil {
return Only(ctx, clues.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage"))

View File

@ -5,7 +5,6 @@ import (
"github.com/alcionai/clues"
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
"github.com/alcionai/corso/src/internal/data"
"github.com/alcionai/corso/src/internal/diagnostics"
"github.com/alcionai/corso/src/internal/kopia"
@ -57,10 +56,10 @@ func (ctrl *Controller) ProduceBackupCollections(
}
var (
colls []data.BackupCollection
ssmb *prefixmatcher.StringSetMatcher
canUsePreviousBackup bool
results inject.BackupProducerResults
// colls []data.BackupCollection
// ssmb *prefixmatcher.StringSetMatcher
// canUsePreviousBackup bool
results inject.BackupProducerResults
)
switch service {
@ -89,7 +88,7 @@ func (ctrl *Controller) ProduceBackupCollections(
}
case path.SharePointService:
colls, ssmb, canUsePreviousBackup, err = sharepoint.ProduceBackupCollections(
colls, ssmb, canUsePreviousBackup, err := sharepoint.ProduceBackupCollections(
ctx,
bpc,
ctrl.AC,
@ -102,7 +101,7 @@ func (ctrl *Controller) ProduceBackupCollections(
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup}
case path.GroupsService:
colls, ssmb, err = groups.ProduceBackupCollections(
colls, ssmb, err := groups.ProduceBackupCollections(
ctx,
bpc,
ctrl.AC,
@ -115,13 +114,12 @@ func (ctrl *Controller) ProduceBackupCollections(
// canUsePreviousBacukp can be always returned true for groups as we
// return a tombstone collection in case the metadata read fails
canUsePreviousBackup = true
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup}
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: true}
default:
return inject.BackupProducerResults{}, clues.Wrap(clues.New(service.String()), "service not supported").WithClues(ctx)
}
for _, c := range colls {
for _, c := range results.Collections {
// kopia doesn't stream Items() from deleted collections,
// and so they never end up calling the UpdateStatus closer.
// This is a brittle workaround, since changes in consumer

View File

@ -90,6 +90,19 @@ func (s Stats) MinimumPrintable() any {
// for printing out to a terminal in a columnar display.
func (s Stats) Headers() []string {
switch {
case s.Exchange != nil:
return []string{
"EmailsAdded",
"EmailsDeleted",
"EmailFolders",
"ContactsAdded",
"ContactsDeleted",
"ContactFolders",
"EventsAdded",
"EventsDeleted",
"EventFolders",
}
case s.OneDrive != nil:
return []string{
"Folders",
@ -105,6 +118,19 @@ func (s Stats) Headers() []string {
// out to a terminal in a columnar display.
func (s Stats) Values() []string {
switch {
case s.Exchange != nil:
return []string{
strconv.Itoa(s.Exchange.EmailsAdded),
strconv.Itoa(s.Exchange.EmailsDeleted),
strconv.Itoa(s.Exchange.EmailFolders),
strconv.Itoa(s.Exchange.ContactsAdded),
strconv.Itoa(s.Exchange.ContactsDeleted),
strconv.Itoa(s.Exchange.ContactFolders),
strconv.Itoa(s.Exchange.EventsAdded),
strconv.Itoa(s.Exchange.EventsDeleted),
strconv.Itoa(s.Exchange.EventFolders),
}
case s.OneDrive != nil:
return []string{
strconv.Itoa(s.OneDrive.Folders),