@@ -13,7 +13,7 @@ that use the APT package manager.
1313
1414## Test if package is installed
1515
16- The following snippet shows how you can use the resource with the [ dsc resource test] [ 01 ] command
16+ The following snippet shows how you can use the resource with the [ dsc resource test] [ 00 ] command
1717to check whether the ` nginx ` package exists.
1818
1919``` bash
@@ -23,14 +23,14 @@ dsc resource test --resource DSC.PackageManagement/Apt --input '{"packageName":"
2323When the package is not installed, DSC returns the following result.
2424
2525> [ !NOTE]
26- > Note that the version and source values can differ depending on your system's package repositories and available
27- > package versions.
26+ > Note that the version and source values can differ depending on your system's package repositories
27+ > and available package versions.
2828
2929``` yaml
3030desiredState :
3131 packageName : nginx
3232actualState :
33- _exist : " true "
33+ _exist : false
3434 packageName : nginx
3535 version : 1.24.0-2ubuntu7.3
3636 source : noble-updates,noble-security,now
@@ -39,43 +39,42 @@ differingProperties:
3939 - _exist
4040` ` `
4141
42- ## Ensure a package with version is installed
42+ ## Ensure a package is installed
4343
44- To ensure the system is in the desired state with a particular version , use the [dsc resource set][02 ]
44+ To ensure the system is in the desired state, use the [dsc resource set][01 ]
4545command.
4646
4747` ` ` bash
48- dsc resource set --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx", "version":"1.24.0-2ubuntu7" }'
48+ dsc resource set --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx"}'
4949```
5050
51- When the resource install the package, DSC returns the following result:
51+ When the resource installs the package, DSC returns the following result:
5252
5353``` yaml
5454beforeState :
5555 packageName : " nginx"
56- version : " 1.24.0-2ubuntu7"
5756 _exist : false
5857afterState :
59- keyPath : HKCU\DscExamples\ManagedKey
60- version : " 1.24.0-2ubuntu7"
58+ packageName : nginx
59+ version : " 1.24.0-2ubuntu7.3"
60+ source : noble-updates,noble-security,now
6161changedProperties :
6262- _exist
6363` ` `
6464
6565You can test the instance again to confirm that the package exists:
6666
6767` ` ` bash
68- dsc resource test --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx", "version":"1.24.0-2ubuntu7" }'
68+ dsc resource test --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx"}'
6969```
7070
7171``` yaml
7272desiredState :
7373 packageName : nginx
74- version : 1.24.0-2ubuntu7
7574actualState :
7675 _exist : true
7776 packageName : nginx
78- version : 1.24.0-2ubuntu7
77+ version : 1.24.0-2ubuntu7.3
7978 source : noble-updates,noble-security,now
8079inDesiredState : true
8180differingProperties : []
@@ -89,9 +88,6 @@ To uninstall a package, set the `_exist` property to `false`:
8988dsc resource set --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx", "_exist": false}'
9089` ` `
9190
92- The `DSC.PackageManagement/Apt` resource implements the [setHandleExist][03], indicating the resource
93- will be deleted.
94-
9591To verify the package no longer exists, use the `dsc resource get` command
9692
9793` ` ` powershell
@@ -105,6 +101,5 @@ actualState:
105101` ` `
106102
107103<!-- Link reference definitions -->
108- [01] : ../../../../../cli/resource/test.md
109- [02] : ../../../../../cli/resource/set.md
110- [03] : ../../../../../../concepts/resources/capabilities.md#sethandlesexist
104+ [00] : ../../../../../cli/resource/test.md
105+ [01] : ../../../../../cli/resource/set.md
0 commit comments