Skip to content

Added PartitionStyle Parameter to Disk - Fixes #137 #170

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 15 commits into from
Sep 20, 2018

Conversation

PlagueHO
Copy link
Member

@PlagueHO PlagueHO commented Sep 9, 2018

Pull Request (PR) description

  • Disk:
    • Added PartitionStyle parameter - Fixes Issue #137.
  • Opt-in to Common Tests:
    • Common Tests - Validate Example Files To Be Published
    • Common Tests - Validate Markdown Links
    • Common Tests - Relative Path Length
  • Added .VSCode settings for applying DSC PSSA rules - fixes Issue #168.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry under the Unreleased section of the change log in the CHANGELOG.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in README.md in the resource folder.
  • Resource parameter descriptions added/updated in schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

@johlju - would you mind reviewing when you have time?


This change is Reviewable

@PlagueHO PlagueHO added the needs review The pull request needs a code review. label Sep 9, 2018
@codecov-io
Copy link

Codecov Report

Merging #170 into dev will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           dev   #170    +/-   ##
===================================
+ Coverage   94%    94%   +<1%     
===================================
  Files        6      6            
  Lines      795    797     +2     
===================================
+ Hits       754    756     +2     
  Misses      41     41

@PlagueHO
Copy link
Member Author

PlagueHO commented Sep 9, 2018

@johlju - maybe hold off on review of this one until we decide if changing the prefix is acceptable?

@johlju
Copy link
Member

johlju commented Sep 10, 2018

Yes sounds good, maybe you want to rename the property back to PartitionStyle again too then?

@johlju johlju added on hold The issue or pull request has been put on hold by a maintainer. and removed needs review The pull request needs a code review. labels Sep 10, 2018
@PlagueHO
Copy link
Member Author

Yep! Will do. I'll probably create another branch off this one with the renamed parameter and the new MOF name.

@johlju
Copy link
Member

johlju commented Sep 13, 2018

@PlagueHO I haven't heard anything from @kwirkykat or @mgreenegit so let's assume the rename is not a problem. We have until next release to change it if there are any obstacles with it. So let's do the rename of prefix.

@johlju johlju added needs review The pull request needs a code review. and removed on hold The issue or pull request has been put on hold by a maintainer. labels Sep 13, 2018
@PlagueHO PlagueHO changed the title Added PartitionFormat Parameter to Disk - Fixes #137 Added PartitionStyle Parameter to Disk - Fixes #137 Sep 13, 2018
@PlagueHO
Copy link
Member Author

@johlju - this should be good to go now!

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 12 files at r1, 8 of 8 files at r2.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @PlagueHO)


CHANGELOG.md, line 8 at r2 (raw file):

  - Added `PartitionStyle` parameter - Fixes [Issue #137](https://github.com/PowerShell/StorageDsc/issues/37).
  - Changed MOF name from `MSFT_Disk` to `MSFTDSC_Disk` to remove conflict
    with Windows built-in CIM class.

Maybe reference issue here?


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/MSFTDSC_Disk.psm1, line 42 at r2 (raw file):

This value of this parameter is ignored

This can be interpreted as it is used, but the value will be ignored. Maybe write 'This parameter is not used in Get-TargetResource'? Throughout.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/MSFTDSC_Disk.schema.mof, line 3 at r2 (raw file):

Prefix

maybe 'prefix' (lower-case 'p')?


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/README.md, line 25 at r2 (raw file):

for disks with `GPT` partition table format.

What if the disk is RAW? Should the PartitionStyle be set to 'GPT' for the Guid identifier is allowed to be used?


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 21 at r2 (raw file):

'{3}' required.

maybe: '{3}' is required.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 22 at r2 (raw file):

'{3}' required.

maybe: '{3}' is required.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 22 at r2 (raw file):

'True'

Not sure, but maybe we should change this to $true, otherwise it could mean that the string 'True' should be used for a boolean value (for users less familiar with PowerShell)? Throughout, if so.


Tests/Integration/MSFTDSC_Disk.config.ps1, line 12 at r2 (raw file):

                DiskId          = $Node.DiskId
                DiskIdType      = $Node.DiskIdType
                PartitionStyle = $Node.PartitionStyle

Alignment wrong (after search/replace). 🙂


Tests/Integration/MSFTDSC_Disk.Integration.Tests.ps1, line 368 at r2 (raw file):

            }

            Context "Resize partition on Disk Number $($disk.Number) to use 50MB with AllowDestructive" {

Is this description correct? Doesn't it clear all partitions on the disk and converts it to GPT then creates a 50MB partition? Or do I misunderstood this test?

Copy link
Member Author

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Should be good now @johlju

Reviewable status: 6 of 12 files reviewed, 9 unresolved discussions (waiting on @johlju and @PlagueHO)


CHANGELOG.md, line 8 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Maybe reference issue here?

Done.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/MSFTDSC_Disk.psm1, line 42 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
This value of this parameter is ignored

This can be interpreted as it is used, but the value will be ignored. Maybe write 'This parameter is not used in Get-TargetResource'? Throughout.

Done.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/MSFTDSC_Disk.schema.mof, line 3 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Prefix

maybe 'prefix' (lower-case 'p')?

Done. And changed the c in Class to lower case as it should be.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/README.md, line 25 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
for disks with `GPT` partition table format.

What if the disk is RAW? Should the PartitionStyle be set to 'GPT' for the Guid identifier is allowed to be used?

The paragraph above specifies that a disk that is RAW can not be used with a GUID identifier or do you mean should we throw an exception if the MBR style is used and a Guid identifier type is specified?


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 21 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
'{3}' required.

maybe: '{3}' is required.

Done.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 22 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
'{3}' required.

maybe: '{3}' is required.

Done.


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/en-us/MSFTDSC_Disk.strings.psd1, line 22 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
'True'

Not sure, but maybe we should change this to $true, otherwise it could mean that the string 'True' should be used for a boolean value (for users less familiar with PowerShell)? Throughout, if so.

Done.


Tests/Integration/MSFTDSC_Disk.config.ps1, line 12 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Alignment wrong (after search/replace). 🙂

Good catch! Done


Tests/Integration/MSFTDSC_Disk.Integration.Tests.ps1, line 368 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Is this description correct? Doesn't it clear all partitions on the disk and converts it to GPT then creates a 50MB partition? Or do I misunderstood this test?

You are correct. I also clarified another test that allowed destructive clearing of the disk.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johlju)


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/README.md, line 25 at r2 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

The paragraph above specifies that a disk that is RAW can not be used with a GUID identifier or do you mean should we throw an exception if the MBR style is used and a Guid identifier type is specified?

I was just thinking if the disk is RAW and has no partition style yet (neither MBR or GPT), can I still specify 'Guid' as identifier type? I assume the disk can be neither GPT or MBR when it is newly created.
I just looking for if it should say: '...for disk with no partition format (RAW) or GPT partition table format'. 🙂


Tests/Integration/MSFTDSC_Disk.Integration.Tests.ps1, line 368 at r3 (raw file):

            }

            Context "Clear Disk Number $($disk.Number) and change the partition style to GPT and add a 50MB partition" {

Minor: Context should start with 'When...'. Throughout.

Leaving as non-blocking.

@johlju johlju added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed needs review The pull request needs a code review. labels Sep 17, 2018
Copy link
Member Author

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Should be good to go now @johlju! Thank you!

Reviewable status: 9 of 12 files reviewed, 1 unresolved discussion (waiting on @johlju and @PlagueHO)


Modules/StorageDsc/DSCResources/MSFTDSC_Disk/README.md, line 25 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

I was just thinking if the disk is RAW and has no partition style yet (neither MBR or GPT), can I still specify 'Guid' as identifier type? I assume the disk can be neither GPT or MBR when it is newly created.
I just looking for if it should say: '...for disk with no partition format (RAW) or GPT partition table format'. 🙂

You are correct: If the disk is RAW then selecting GUID isn't possible. It will report back to the user that the disk can't be found.

I've reworked the text to hopefully make this a bit more clear.


Tests/Integration/MSFTDSC_Disk.Integration.Tests.ps1, line 368 at r3 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Minor: Context should start with 'When...'. Throughout.

Leaving as non-blocking.

Done! 😁 Lots!

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

:lgtm:

Awesome work on this (as usual)! 😃

Reviewed 3 of 3 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@johlju johlju added ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Sep 19, 2018
@PlagueHO
Copy link
Member Author

Thank you @johlju !!!

@PlagueHO PlagueHO merged commit a54986d into dsccommunity:dev Sep 20, 2018
@PlagueHO PlagueHO deleted the Issue-137 branch September 20, 2018 07:04
@johlju johlju removed the ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. label Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants