-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add File resource #22
base: main
Are you sure you want to change the base?
Conversation
I will fix the pipeline in another PR. |
Fixed, if you rebase the pipeline should run correctly. |
|
||
DscResourcesToExport = @( | ||
'FileSystemAccessRule' | ||
'File' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceName is FileSystemObject
instead of File
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property is set automatically during build, so it should be @()
.
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- Added wiki generation and publish to GitHub repository wiki. | |||
- Added recommended VS Code extensions. | |||
- Added settings for VS Code extension _Pester Test Adapter_. | |||
- New File resource added to enable cross-platform file operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource name is FileSystemObject
instead of File
.
@nyanhp Could you please check my suggested changes? This should help for the tests. |
@@ -0,0 +1,382 @@ | |||
class FileSystemDscReason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class should be in a seperate file Classes/001.FileSystemDscReason.ps1
.
|
||
# Minimum version of the common language runtime (CLR) required by this module | ||
CLRVersion = '4.0' | ||
|
||
# Functions to export from this module | ||
FunctionsToExport = @() | ||
|
||
# Cmdlets to export from this module | ||
CmdletsToExport = @() | ||
|
||
# Variables to export from this module | ||
VariablesToExport = @() | ||
|
||
# Aliases to export from this module | ||
AliasesToExport = @() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only remove the property CmdletsToExport
(for it to show up in PowerShell), the other properties should remain.
DscResourcesToExport = @( | ||
'FileSystemAccessRule' | ||
'File' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DscResourcesToExport = @( | |
'FileSystemAccessRule' | |
'File' | |
) | |
DscResourcesToExport = @() |
Describe 'FileSystemObject\Set()' -Tag 'Set' -Skip { | ||
|
||
} | ||
|
||
Describe 'FileSystemObject\Test()' -Tag 'Test' -Skip { | ||
|
||
} | ||
|
||
Describe 'FileSystemObject\GetHash()' -Tag 'GetHash' -Skip { | ||
|
||
} | ||
|
||
Describe 'FileSystemObject\CompareHash()' -Tag 'CompareHash' -Skip { | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to test the functionality.
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
PowerShellVersion = '5.1' | ||
PowerShellVersion = '5.1' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During my testing I've found that also RootModule
must be defined in the module manifest. Otherwise the class based resources are not found.
RootModule = 'FileSystemDsc.psm1'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see it's already added with this PR. :-)
Pull Request (PR) description
This PR adds a cross-platform File resource. Localization, Unit Tests pending. Local build worked, but I didn't see integration tests running. Tested all config on my local build VM.
Samples could be expanded a bit, Unix-specifics (user, group, mode) not implemented yet.
Module Manifest updated to support class-based resources (otherwise, Get-DscResource on PS7 was not finding any resources in the module).
This Pull Request (PR) fixes the following issues
None
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
and comment-based help.
This change is