Skip to content
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

SmbShare: Configuration drift due to sort ordering of access properties #247

Closed
dappleby300 opened this issue Aug 23, 2019 · 6 comments · Fixed by #424
Closed

SmbShare: Configuration drift due to sort ordering of access properties #247

dappleby300 opened this issue Aug 23, 2019 · 6 comments · Fixed by #424
Labels
bug The issue is a bug.

Comments

@dappleby300
Copy link

Details of the scenario you tried and the problem that is occurring

When using the SmbShare resource the access array properties are not sorted so if the order does not match the operating system (which doesn't appear to sort alphabetically), the configuration constantly drifts.

Verbose logs showing the problem

VERBOSE: [SKYPE19-DB-FD1]: LCM:  [ Start  Resource ]  [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db]
VERBOSE: [SKYPE19-DB-FD1]: LCM:  [ Start  Test     ]  [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db]
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] Determining if the SMB share 'db-stage' is in the desired state.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] Getting the current state of the SMB share 'db-stage'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] The SMB share with the name 'db-stage' exist. Evaluating the properties of the SMB share.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] Comparing values in property 'FullAccess'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] NOTMATCH: Value [0] (type 'String') for property 'FullAccess' does match. Current state is 'NT SERVICE\MSSQLSERVER' and desired state is '#DOMAIN#\SKYPE19-DB-FD1$'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] NOTMATCH: Value [1] (type 'String') for property 'FullAccess' does match. Current state is '#DOMAIN#\SKYPE19-DB-FD1$' and desired state is '#DOMAIN#\SKYPE19-DB-FD2$'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] NOTMATCH: Value [2] (type 'String') for property 'FullAccess' does match. Current state is '#DOMAIN#\SKYPE19-DB-FD2$' and desired state is 'NT SERVICE\MSSQLSERVER'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'String') for property 'Ensure' does match. Current state is 'Present' and desired state is 'Present'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'Boolean') for property 'ContinuouslyAvailable' does match. Current state is 'False' and desired state is 'False'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'String') for property 'FolderEnumerationMode' does match. Current state is 'AccessBased' and desired state is 'AccessBased'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'String') for property 'Name' does match. Current state is 'db-stage' and desired state is 'db-stage'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'String') for property 'CachingMode' does match. Current state is 'None' and desired state is 'None'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'String') for property 'Path' does match. Current state is 'C:\db-stage' and desired state is 'C:\db-stage'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] MATCH: Value (type 'Boolean') for property 'EncryptData' does match. Current state is 'False' and desired state is 'False'.
VERBOSE: [SKYPE19-DB-FD1]:                            [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] Test-DscParameter result is 'False'.
VERBOSE: [SKYPE19-DB-FD1]: LCM:  [ End    Test     ]  [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db] False in 0.9670 seconds.
VERBOSE: [SKYPE19-DB-FD1]: LCM:  [ End    Resource ]  [[SmbShare]CreateDbStageShare::[profile_skype19_db]profile_skype19_db]

Suggested solution to the issue

Sort both the arrays both from the configuration and in the Get-TargetResource function before performing the compare.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

        SmbShare CreateDbStageShare
        {
            Name = 'db-stage'
            Path = 'C:\db-stage'
            Ensure = 'Present'
            EncryptData = $false
            FolderEnumerationMode = 'AccessBased'
            CachingMode = 'None'
            ContinuouslyAvailable = $false
            FullAccess = @('#DOMAIN#\SKYPE19-DB-FD1$','#DOMAIN#\SKYPE19-DB-FD2$','NT SERVICE\MSSQLSERVER')
        }

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

ComputerManagementDsc , Version: 6.5.0.0

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Aug 23, 2019
@PlagueHO
Copy link
Member

Great catch @dappleby300 - hopefully is an easy fix. Will get onto it as soon as possible.

@PlagueHO PlagueHO added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Aug 23, 2019
@PlagueHO
Copy link
Member

I'll be able to implement the fix in this one once #252 is merged.

@PlagueHO
Copy link
Member

#252 has been merged so I can get onto this one.

@Borgquite
Copy link
Contributor

@PlagueHO Sorry to bug you again but wondering whether it'd be possible for you to fix this? Alternatively happy to have a go myself - I'm guessing the new -SortArrayValues parameter should be passed to Test-DscParameterState - anything else you're aware of?

@PlagueHO
Copy link
Member

Hi @Borgquite , I'm happy if you want to have a go at fixing! I'm a bit tied up with Global Azure event today :/

@johlju
Copy link
Member

johlju commented Apr 24, 2024

Thanks to @Borgquite for fixing this. Please test and verify that it works by using the preview that will be released shortly.

@johlju johlju removed the in progress The issue is being actively worked on by someone. label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
4 participants