More fixes
This commit is contained in:
parent
2cf44ee649
commit
3c99cae35c
@ -217,7 +217,8 @@ func genericCreateCommand(
|
|||||||
|
|
||||||
if bo.Options.DryRun {
|
if bo.Options.DryRun {
|
||||||
// Print backup stats results here
|
// Print backup stats results here
|
||||||
print.All(ctx, bo.Results.Stats)
|
Info(ctx, "Discovered data:")
|
||||||
|
print.Item(ctx, bo.Results.Stats)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +232,10 @@ func genericCreateCommand(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flags.RunModeFV == flags.RunModeDryRun {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
bups, berrs := r.Backups(ctx, bIDs)
|
bups, berrs := r.Backups(ctx, bIDs)
|
||||||
if berrs.Failure() != nil {
|
if berrs.Failure() != nil {
|
||||||
return Only(ctx, clues.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage"))
|
return Only(ctx, clues.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage"))
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/clues"
|
"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/data"
|
||||||
"github.com/alcionai/corso/src/internal/diagnostics"
|
"github.com/alcionai/corso/src/internal/diagnostics"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
"github.com/alcionai/corso/src/internal/kopia"
|
||||||
@ -57,10 +56,10 @@ func (ctrl *Controller) ProduceBackupCollections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
colls []data.BackupCollection
|
// colls []data.BackupCollection
|
||||||
ssmb *prefixmatcher.StringSetMatcher
|
// ssmb *prefixmatcher.StringSetMatcher
|
||||||
canUsePreviousBackup bool
|
// canUsePreviousBackup bool
|
||||||
results inject.BackupProducerResults
|
results inject.BackupProducerResults
|
||||||
)
|
)
|
||||||
|
|
||||||
switch service {
|
switch service {
|
||||||
@ -89,7 +88,7 @@ func (ctrl *Controller) ProduceBackupCollections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
case path.SharePointService:
|
case path.SharePointService:
|
||||||
colls, ssmb, canUsePreviousBackup, err = sharepoint.ProduceBackupCollections(
|
colls, ssmb, canUsePreviousBackup, err := sharepoint.ProduceBackupCollections(
|
||||||
ctx,
|
ctx,
|
||||||
bpc,
|
bpc,
|
||||||
ctrl.AC,
|
ctrl.AC,
|
||||||
@ -102,7 +101,7 @@ func (ctrl *Controller) ProduceBackupCollections(
|
|||||||
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup}
|
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup}
|
||||||
|
|
||||||
case path.GroupsService:
|
case path.GroupsService:
|
||||||
colls, ssmb, err = groups.ProduceBackupCollections(
|
colls, ssmb, err := groups.ProduceBackupCollections(
|
||||||
ctx,
|
ctx,
|
||||||
bpc,
|
bpc,
|
||||||
ctrl.AC,
|
ctrl.AC,
|
||||||
@ -115,13 +114,12 @@ func (ctrl *Controller) ProduceBackupCollections(
|
|||||||
|
|
||||||
// canUsePreviousBacukp can be always returned true for groups as we
|
// canUsePreviousBacukp can be always returned true for groups as we
|
||||||
// return a tombstone collection in case the metadata read fails
|
// return a tombstone collection in case the metadata read fails
|
||||||
canUsePreviousBackup = true
|
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: true}
|
||||||
results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup}
|
|
||||||
default:
|
default:
|
||||||
return inject.BackupProducerResults{}, clues.Wrap(clues.New(service.String()), "service not supported").WithClues(ctx)
|
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,
|
// kopia doesn't stream Items() from deleted collections,
|
||||||
// and so they never end up calling the UpdateStatus closer.
|
// and so they never end up calling the UpdateStatus closer.
|
||||||
// This is a brittle workaround, since changes in consumer
|
// This is a brittle workaround, since changes in consumer
|
||||||
|
|||||||
@ -406,8 +406,6 @@ func (c *Collections) Get(
|
|||||||
stats.Items += c.NumFiles
|
stats.Items += c.NumFiles
|
||||||
|
|
||||||
observe.Message(ctx, fmt.Sprintf("Discovered %d items to backup", c.NumItems))
|
observe.Message(ctx, fmt.Sprintf("Discovered %d items to backup", c.NumItems))
|
||||||
observe.Message(ctx, fmt.Sprintf("Discovered %d stats to backup", stats.Items))
|
|
||||||
observe.Message(ctx, fmt.Sprintf("Discovered %d folder stats to backup", stats.Folders))
|
|
||||||
|
|
||||||
collections := []data.BackupCollection{}
|
collections := []data.BackupCollection{}
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,19 @@ func (s Stats) MinimumPrintable() any {
|
|||||||
// for printing out to a terminal in a columnar display.
|
// for printing out to a terminal in a columnar display.
|
||||||
func (s Stats) Headers() []string {
|
func (s Stats) Headers() []string {
|
||||||
switch {
|
switch {
|
||||||
|
case s.Exchange != nil:
|
||||||
|
return []string{
|
||||||
|
"EmailsAdded",
|
||||||
|
"EmailsDeleted",
|
||||||
|
"EmailFolders",
|
||||||
|
"ContactsAdded",
|
||||||
|
"ContactsDeleted",
|
||||||
|
"ContactFolders",
|
||||||
|
"EventsAdded",
|
||||||
|
"EventsDeleted",
|
||||||
|
"EventFolders",
|
||||||
|
}
|
||||||
|
|
||||||
case s.OneDrive != nil:
|
case s.OneDrive != nil:
|
||||||
return []string{
|
return []string{
|
||||||
"Folders",
|
"Folders",
|
||||||
@ -105,6 +118,19 @@ func (s Stats) Headers() []string {
|
|||||||
// out to a terminal in a columnar display.
|
// out to a terminal in a columnar display.
|
||||||
func (s Stats) Values() []string {
|
func (s Stats) Values() []string {
|
||||||
switch {
|
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:
|
case s.OneDrive != nil:
|
||||||
return []string{
|
return []string{
|
||||||
strconv.Itoa(s.OneDrive.Folders),
|
strconv.Itoa(s.OneDrive.Folders),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user