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

nxFile - Fails to complete compliance check for 'Ensure = Absent' mode #34

Open
eehret opened this issue Sep 13, 2023 · 4 comments
Open
Labels
bug The issue is caused by product not functioning as intended by product group

Comments

@eehret
Copy link

eehret commented Sep 13, 2023

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

I have an nxFile resource in which I'm trying to ensure a specific file does not exist.
It's crashing on my test system and the node fails to report compliance for any of the items in the same configuration.

Verbose logs showing the problem

         Message : [vm-azam-rhel7-b]: LCM:  [ Start  Test     ]  [[nxFile]cron_deny_absent]
[2023-09-13 03:31:55.721] [PID 24182] [TID 24184] [PSPROVIDER] [INFO] [00000000-0000-0000-0000-000000000000] getPSModulePath(). psModulePath:/var/lib/GuestConfig/Configuration/RHEL7-CISv311-section5-0_0_3@pidb27e7axrepx4a/Modules/:/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/..//GC/Modules
[2023-09-13 03:31:56.322] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Loading default keywords
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:31:56.821] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Getting module list
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:32:03.022] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Creating resource list
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:32:03.825] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Loading default keywords
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:32:05.621] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Getting module list
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:32:09.424] [PID 24182] [TID 24184] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 867356e5-6878-42f4-8899-6b32733970bc : Activity Creating resource list
CurrentOperation [vm-azam-rhel7-b] Get-DscResource
StatusDescription Processing
 PercentComplete 0
 SecondsRemaining 0
[2023-09-13 03:32:15.425] [PID 24182] [TID 24184] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job 867356e5-6878-42f4-8899-6b32733970bc : MIResult: 1
Error Message: Cannot validate argument on parameter 'AccessRight'. The "$_ -as [nxFileSystemAccessRight] -or $_ -as [nxFileSystemSpecialMode]" validation script for the argument with value "None" did not return a result of True. Determine why the validation script failed, and then try the command again.
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-13 03:32:15.522] [PID 24182] [TID 24184] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job 867356e5-6878-42f4-8899-6b32733970bc : MIResult: 1
Error Message: Cannot validate argument on parameter 'AccessRight'. The "$_ -as [nxFileSystemAccessRight] -or $_ -as [nxFileSystemSpecialMode]" validation script for the argument with value "None" did not return a result of True. Determine why the validation script failed, and then try the command again.
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:

Suggested solution to the issue

Unsure, I don't have the luxury of time to trace through the source code to find the problem. It seems to be running code related to determining its access mode / file attributes, so maybe there's a problem there.
Note that I am not setting the Mode attribute on the nxFile resource because it's irrelevant. The file should not exist, regardless of any mode it might have had.

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

    nxFile cron_deny_absent
    {
      Ensure = "Absent"
      Destinationpath = "/etc/cron.deny"
      Type = "File"
    }

The operating system the target node is running

[root@vm-azam-rhel7-b azops.eric.ehret]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
[root@vm-azam-rhel7-b azops.eric.ehret]# uname -r
3.10.0-1160.88.1.el7.x86_64

Version and build of PowerShell the target node is running

7.3.6

Version of the DSC module that was used

1.2.0

@eehret eehret changed the title nxFile - Fails to complete compliance check for 'Ensure = Absent' mode when file already does not exist; crashes nxFile - Fails to complete compliance check for 'Ensure = Absent' mode Sep 13, 2023
@eehret
Copy link
Author

eehret commented Sep 13, 2023

I had to revise the description above because I realized I wasn't correctly framing the issue; the file in question actually does exist at the time of compliance check

@gaelcolas
Copy link
Collaborator

Hi @eehret, could you share with us the properties of that file as well please?

@eehret
Copy link
Author

eehret commented Sep 14, 2023

@gaelcolas Here you go... happy to provide this a different way if needed:

[[email protected]@vm-azam-rhel7-b ~]$ ls -la /etc/cron.deny
-rw-------. 1 root root 0 Nov 30  2021 /etc/cron.deny

Thanks for your help!

@jodi-boone jodi-boone added the bug The issue is caused by product not functioning as intended by product group label Oct 9, 2023
@jodi-boone
Copy link
Collaborator

Hi @eehret, we are looking into the root cause of this issue. Will get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is caused by product not functioning as intended by product group
Projects
None yet
Development

No branches or pull requests

3 participants