-
Notifications
You must be signed in to change notification settings - Fork 56
Create apt package management resource. #434
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this resource should support specifying the version, but limit it to apt syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add this later
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can iterate and improve separately
PR Summary
This creates an package manager for
aptit includes some tests
PR Context