Skip to content

[Storage] Support preserverPerserve File Attributes #10006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 16, 2019

Conversation

blueww
Copy link
Member

@blueww blueww commented Sep 11, 2019

Description

This is to support preserver File SMB attributes when upload/download Azure File.
The design has pass review as part of https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/370

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few inline comments

@@ -201,7 +202,8 @@ public override void ExecuteCmdlet()
targetFile,
new DownloadOptions
{
DisableContentMD5Validation = !this.CheckMd5
DisableContentMD5Validation = !this.CheckMd5,
PreserveSMBAttributes = context.PreserveSMBAttribute.IsPresent ? true : false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreserveSMBAttributes = context.PreserveSMBAttribute.IsPresent is just fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -221,5 +223,15 @@ public override void ExecuteCmdlet()
DoEndProcessing();
}
}
public object GetDynamicParameters()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use

Suggested change
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))

if the parameters are only targeting on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, only on windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is required - you don't want to try to allow this on Mac OS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -221,5 +223,15 @@ public override void ExecuteCmdlet()
DoEndProcessing();
}
}
public object GetDynamicParameters()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is required - you don't want to try to allow this on Mac OS


public object GetDynamicParameters()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above, we need to be specific about Windows

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

null,
new UploadOptions
{
PreserveSMBAttributes = context.PreserveSMBAttribute.IsPresent ? true : false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can context be null here?

Copy link
Member Author

@blueww blueww Sep 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Fixed. And tested it works both on windows & Linux.

@@ -201,7 +202,8 @@ public override void ExecuteCmdlet()
targetFile,
new DownloadOptions
{
DisableContentMD5Validation = !this.CheckMd5
DisableContentMD5Validation = !this.CheckMd5,
PreserveSMBAttributes = context.PreserveSMBAttribute.IsPresent ? true : false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can context be null here?

Copy link
Member Author

@blueww blueww Sep 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Fixed. And tested it works both on windows & Linux.

@markcowl markcowl merged commit 8b1887a into Azure:master Sep 16, 2019
@blueww
Copy link
Member Author

blueww commented Sep 16, 2019

@markcowl
Thanks for helping review and merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants