Create apt package management resource.#434
Conversation
Also be sure to make files executable that should be.
| type: DSC.PackageManagement/Apt | ||
| properties: | ||
| packageName: rolldice | ||
| _exist: true |
There was a problem hiding this comment.
It would be better if this value was defined as a parameter so instead of having two similar config, you could just pass in false (and default to true). See https://github.com/PowerShell/DSC/blob/main/dsc/tests/dsc_parameters.tests.ps1 for examples
There was a problem hiding this comment.
I'm happy to leave that as an exercise for the reader
| - name: apt_wget | ||
| type: DSC.PackageManagement/Apt | ||
| properties: | ||
| packageName: wget |
There was a problem hiding this comment.
packageName should probably also be a parameter
|
|
||
| It 'dsc resource list --tags "<tags>" and --description "<description> work' -TestCases @( | ||
| @{ tags = 'linux'; description = $null; expectedCount = 1; expectedType = 'Microsoft/OSInfo' } | ||
| @{ tags = 'linux'; description = $null; expectedCount = 2; expectedType = @('DSC.PackageManagement/Apt', 'Microsoft/OSInfo') } |
There was a problem hiding this comment.
Since this test now fails on Windows and macOS, you'll probably need to modify this test. Simplest might be something like:
expectedType = if ($IsLinux) { @(...) } else { @(...)}| else | ||
| echo $output | ||
| fi | ||
| elif [[ "$1" == "set" ]]; then |
There was a problem hiding this comment.
Do we need to check if the resource is invoked as root? If I recall correctly, install and remove fail as normal users.
There was a problem hiding this comment.
@michaeltlombardi perhaps we should have a general issue opened to add in the resource manifest when specific operations require elevated and DSC can fail fast
| _exist=true | ||
| fi | ||
| if [[ $_exist = true ]]; then | ||
| apt install -y "${packageName}" |
There was a problem hiding this comment.
Should this handle installing a specific version, since we have the version property? Or should version be marked as readOnly?
There was a problem hiding this comment.
I think this resource should support specifying the version, but limit it to apt syntax
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
SteveL-MSFT
left a comment
There was a problem hiding this comment.
We can iterate and improve separately
PR Summary
This creates an package manager for
aptit includes some tests
PR Context