Skip to content

Commit

Permalink
Comments, fallback to getprop
Browse files Browse the repository at this point in the history
  • Loading branch information
adreed-msft committed Jan 16, 2025
1 parent bd37326 commit a0c692f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 97 deletions.
2 changes: 1 addition & 1 deletion cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ func init() {
syncCmd.PersistentFlags().StringVar(&raw.trailingDot, "trailing-dot", "", "'Enable' by default to treat file share related operations in a safe manner. Available options: "+strings.Join(common.ValidTrailingDotOptions(), ", ")+". "+
"Choose 'Disable' to go back to legacy (potentially unsafe) treatment of trailing dot files where the file service will trim any trailing dots in paths. This can result in potential data corruption if the transfer contains two paths that differ only by a trailing dot (ex: mypath and mypath.). If this flag is set to 'Disable' and AzCopy encounters a trailing dot file, it will warn customers in the scanning log but will not attempt to abort the operation."+
"If the destination does not support trailing dot files (Windows or Blob Storage), AzCopy will fail if the trailing dot file is the root of the transfer and skip any trailing dot paths encountered during enumeration.")
syncCmd.PersistentFlags().BoolVar(&raw.includeRoot, "include-root", false, "Disabled by default. Enable to include the root directory's properties when ")
syncCmd.PersistentFlags().BoolVar(&raw.includeRoot, "include-root", false, "Disabled by default. Enable to include the root directory's properties when persisting properties such as SMB or HNS ACLs")

syncCmd.PersistentFlags().StringVar(&raw.compareHash, "compare-hash", "None", "Inform sync to rely on hashes as an alternative to LMT. Missing hashes at a remote source will throw an error. (None, MD5) Default: None")
syncCmd.PersistentFlags().StringVar(&common.LocalHashDir, "hash-meta-dir", "", "When using `--local-hash-storage-mode=HiddenFiles` you can specify an alternate directory to store hash metadata files in (as opposed to next to the related files in the source)")
Expand Down
6 changes: 6 additions & 0 deletions cmd/zc_traverser_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func (t *blobTraverser) IsDirectory(isSource bool) (isDirectory bool, err error)
containerClient := t.serviceClient.NewContainerClient(blobURLParts.ContainerName)
p := containerClient.NewListBlobsFlatPager(nil)
_, err = p.NextPage(t.ctx)

if bloberror.HasCode(err, bloberror.AuthorizationPermissionMismatch) {
// Maybe we don't have the ability to list? Can we get container properties as a fallback?
_, propErr := containerClient.GetProperties(t.ctx, nil)
err = common.Iff(propErr == nil, nil, err)
}
}

return true, err
Expand Down
96 changes: 0 additions & 96 deletions e2etest/zt_newe2e_fns_dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,99 +271,3 @@ func (*FNSSuite) Scenario_SyncOverlap(a *ScenarioVariationManager) {
Objects: ObjectResourceMappingFlat(JoinMap(dstMap, srcMap)),
}, false)
}

/*
This tests that sync is capable of creating the destination resource if it does not exist, including the root container.
*/
//func (*FNSSuite) Scenario_OverlapWithTrailingSlash(a *ScenarioVariationManager) {
// srcLoc := ResolveVariation(a, []common.Location{common.ELocation.File(), common.ELocation.Blob(), common.ELocation.BlobFS(), common.ELocation.Local()})
// dstLoc := ResolveVariation(a, []common.Location{common.ELocation.File(), common.ELocation.Blob(), common.ELocation.BlobFS(), common.ELocation.Local()})
//
// if srcLoc == common.ELocation.Local() && dstLoc == common.ELocation.Local() {
// a.InvalidateScenario()
// }
//
// srcResType := ResolveVariation(a, []common.EntityType{common.EEntityType.File(), common.EEntityType.Folder()})
//
// const (
// DEST_TYPE_NONE int8 = iota - 1
// DEST_TYPE_STANDARD_STUB
// DEST_TYPE_OVERLAP_STUB
// )
//
// blobDestType := DEST_TYPE_NONE // Just blob can overwrite a stub, or overlap.
// if dstLoc == common.ELocation.Blob() && srcResType == common.EEntityType.File() {
// blobDestType = NamedResolveVariation(a, map[string]int8{
// "DestOverlapDirStub": DEST_TYPE_OVERLAP_STUB,
// "DestStandardDirStub": DEST_TYPE_STANDARD_STUB,
// "DestNone": DEST_TYPE_NONE,
// })
// }
//
// destMaps := map[int8]ObjectResourceMapping{
// DEST_TYPE_NONE: ObjectResourceMappingFlat{},
// DEST_TYPE_STANDARD_STUB: ObjectResourceMappingFlat{
// "foo": ResourceDefinitionObject{
// ObjectProperties: ObjectProperties{
// EntityType: common.EEntityType.Folder(),
// },
// },
// },
// DEST_TYPE_OVERLAP_STUB: ObjectResourceMappingFlat{
// "foo/": ResourceDefinitionObject{
// ObjectProperties: ObjectProperties{
// EntityType: common.EEntityType.Folder(),
// },
// },
// },
// }
//
// var dst ContainerResourceManager
// if blobDestType != DEST_TYPE_NONE {
// dst = CreateResource(a, GetRootResource(a, dstLoc), ResourceDefinitionContainer{
// Objects: destMaps[blobDestType],
// })
// } else {
// // GetRootResource will be a service if remote, and a container if local.
// if dstLoc.IsRemote() {
// dst = GetRootResource(a, dstLoc).(ServiceResourceManager).GetContainer(uuid.NewString())
// } else {
// dst = GetRootResource(a, dstLoc).(ContainerResourceManager)
// }
// }
//
// var sourceMap = ObjectResourceMappingFlat{
// "foo": ResourceDefinitionObject{
// ObjectProperties: ObjectProperties{
// EntityType: srcResType,
// },
// },
// }
//
// if srcResType == common.EEntityType.Folder() {
// sourceMap["foo/bar"] = ResourceDefinitionObject{
// ObjectProperties: ObjectProperties{
// EntityType: common.EEntityType.File(),
// },
// }
// }
//
// src := CreateResource(a, GetRootResource(a, srcLoc), ResourceDefinitionContainer{
// Objects: sourceMap,
// })
//
// RunAzCopy(a, AzCopyCommand{
// Verb: ResolveVariation(a, []AzCopyVerb{AzCopyVerbSync}),
// Targets: []ResourceManager{
// src.GetObject(a, "foo", common.EEntityType.File()),
// dst.GetObject(a, "foo", common.EEntityType.File())},
// Flags: SyncFlags{
// CopySyncCommonFlags: CopySyncCommonFlags{
// Recursive: pointerTo(true),
// IncludeDirectoryStubs: pointerTo(true),
// },
// },
// })
//

//}

0 comments on commit a0c692f

Please sign in to comment.