Closed eehret closed 7 months ago
Note that I'm getting an identical error with Ensure=Present for the apparmor-utils package.
nxPackage apparmor_utils_installed
{
Name = "apparmor-utils"
Ensure = "Present"
}
So the scope of the failure seems to extend beyond what I originally stated.
Thank you for raising this with us @eehret! We are actively investigating this.
@MutemwaRMasheke Hi. How's it going with this? nxPackage is pretty key to our overall automanage machine configuration deployment, so we're eager to see progress on this, as well as the other nxPackage issues I've raised. Thanks :)
Hello @eerhet! We just closed on fixing this so you should be good to go! Thanks for reaching out.
@MutemwaRMasheke Hi. Thanks, that sounds promising. Unfortunately we are still waiting for Microsoft to publish the updated module to PowerShell Gallery. When can we expect that? I will not be able to test and confirm how well this fix resolves our problem until that is done.
Just published a new nxtools release with fixes for this and other Github issues. https://www.powershellgallery.com/packages/nxtools/1.4.0
Thank you for your feedback!
Details of the scenario you tried and the problem that is occurring
I have an Ubuntu system on which I am trying to ensure that a number of packages are either present or not present. This operation crashes when the package in question isn't present. This happens both when I am trying to Ensure='Present' and when Ensure='Absent'.
It crashes in such a way that no compliance results for the entire configuration run are available to see. I would consider this to be a severe defect.
Verbose logs showing the problem
Here is an example involving the
ldap-utils
package (see comments below for another example when Ensure=Present, for appamor-utils package)First, during the test operation this appears:
Then a few lines later in the log at the end of the configuration run, we see this:
Suggested solution to the issue
I traced the calls to pinpoint where the issue appears to be. At a high level, focusing in on just the calls involving queries to the package manager, the calls flow like this nxPackage -> Get-nxPackage -> Get-nxDpkgPackage -> Get-nxDpkgPackageInstalled
The problem seems to be originating from the following line: https://github.com/Azure/nxtools/blob/b4db4c002bd90c9905a38e7f2b7491a5aff9f92f/source/Public/Packages/dpkg/Get-nxDpkgPackage.ps1#L49C11-L49C11
That call results in an error being thrown, which is not being handled correctly. I verified this by invoking the same command manually; I can see that internally dkpg must be making a call to dpkg-query, which is throwing the error. Here's what that looks like:
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Ubuntu 20.04 LTS
Version and build of PowerShell the target node is running
7.3.6
Version of the DSC module that was used
1.2.0