@@ -25,6 +25,7 @@ import (
25
25
"fmt"
26
26
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"
27
27
"github.com/Azure/azure-storage-azcopy/v10/common"
28
+ "strings"
28
29
)
29
30
30
31
// Enumerates an entire blob account, looking into each matching container as it goes
@@ -53,14 +54,20 @@ func (t *blobAccountTraverser) IsDirectory(_ bool) (bool, error) {
53
54
}
54
55
55
56
func (t * blobAccountTraverser ) listContainers () ([]string , error ) {
57
+ cachedContainers , _ , err := t .getListContainers ()
58
+ return cachedContainers , err
59
+ }
60
+
61
+ func (t * blobAccountTraverser ) getListContainers () ([]string , []string , error ) {
62
+ var skippedContainers []string
56
63
// a nil list also returns 0
57
64
if len (t .cachedContainers ) == 0 || len (t .excludeContainerName ) > 0 {
58
65
cList := make ([]string , 0 )
59
66
pager := t .serviceClient .NewListContainersPager (nil )
60
67
for pager .More () {
61
68
resp , err := pager .NextPage (t .ctx )
62
69
if err != nil {
63
- return nil , err
70
+ return nil , nil , err
64
71
}
65
72
for _ , v := range resp .ContainerItems {
66
73
// a nil list also returns 0
@@ -69,7 +76,7 @@ func (t *blobAccountTraverser) listContainers() ([]string, error) {
69
76
if t .containerPattern != "" {
70
77
if ok , err := containerNameMatchesPattern (* v .Name , t .containerPattern ); err != nil {
71
78
// Break if the pattern is invalid
72
- return nil , err
79
+ return nil , nil , err
73
80
} else if ! ok {
74
81
// Ignore the container if it doesn't match the pattern.
75
82
continue
@@ -83,6 +90,7 @@ func (t *blobAccountTraverser) listContainers() ([]string, error) {
83
90
for _ , f := range t .excludeContainerName {
84
91
if ! f .DoesPass (so ) {
85
92
// Ignore the container if the container name should be excluded
93
+ skippedContainers = append (skippedContainers , * v .Name )
86
94
continue
87
95
} else {
88
96
cList = append (cList , * v .Name )
@@ -96,12 +104,13 @@ func (t *blobAccountTraverser) listContainers() ([]string, error) {
96
104
t .cachedContainers = cList
97
105
}
98
106
99
- return t .cachedContainers , nil
107
+ return t .cachedContainers , skippedContainers , nil
100
108
}
101
109
102
110
func (t * blobAccountTraverser ) Traverse (preprocessor objectMorpher , processor objectProcessor , filters []ObjectFilter ) error {
103
111
// listContainers will return the cached container list if containers have already been listed by this traverser.
104
- cList , err := t .listContainers ()
112
+ cList , skippedContainers , err := t .getListContainers ()
113
+ glcm .Info ("Skipped container(s): " + strings .Join (skippedContainers , ", " ))
105
114
106
115
if err != nil {
107
116
return err
0 commit comments