-
Notifications
You must be signed in to change notification settings - Fork 189
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
adding support for switches: Force,AllowClobber,SkipPublisherCheck #337
adding support for switches: Force,AllowClobber,SkipPublisherCheck #337
Conversation
|
||
[Parameter()] | ||
[Switch] | ||
$AllowClobber, |
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.
First thank you very much for your PR. Here are my comments:
- any reasons you want to explicitly call out these parameters instead of using the existing $AdditionalParameters to pass them in?
- this DSC resource is a kind of generic for all OneGet providers. My concern is that not all the OneGet providers support force, AllowClobber, SkipPublisherCheck. If people choose to use other providers and this dsc resource, their scenario will be broken, right?
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 did first try specifying these switches using $AdditionalParameters like this :
AdditionalParameters = @{
Force = $true
}
However this threw errors when trying to convert the value to a switch. I believe this is because $PSBoundParameters is a key value store but switches don't take a value they are a bit special. This issue is also reported by others (#327)
- this is a good design in principle. But it also means that if other providers have switches we will not be able to use them. I've been trying to find a better way to pass switches (something like $AdditionalSwitches) in but without much success so far
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.
@brywang-msft any ideas in the PM DSC module regarding AdditionalParameters ?
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've just learnt that -AllowClobber doesn't exist for cmdlets in PackageManagement in WMF 5.0, looks like it is only present in 5.1 which means this approach I have wont work.
I'm happy if you want to close this.
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.
Correct AllowClobber does not exist in PackageManagement. It was added in PowerShellGet - a PackageManagement provider. Thanks @mrhockeymonkey.
Apologies for reopening this. I think there is a bit of confusion over where updates to the package management DSC resources should live. We decided in this PR above that the DSC Resource should be generic which led me to open a PR (PowerShell/PackageManagementProviderResource#40). However ive just seen that someone else has also done so (PowerShell/PackageManagementProviderResource#39) to which you have directed him back to this repo? It seems to me that if the PackageManagementProviderResource repo is now deprecated we should pull the PSModule DSCResource into this repo? would you agree? I'm happy to add that to this PR if so along with the original fix. |
@mrhockeymonkey Yes PackageManagementProviderResource repo is deprecated. Use this repo going forward. Sorry for keeping asking you to submit the PRs back and forth. Our thinking was to ask users to use the generic DSC MSFT_PackageManagement. That's why we did not port the MSFT_PSModule DSC resource. However it looks like folks are already using MSFT_PSModule. I think we should consider porting the MSFT_PSModule from PackageManagementProviderResource to PackageManagement here too. Yes it would be great if you can
cc @JKeithB @edyoung |
@jianyunt There was actually additional work needed there. Which is why I went back to updating the original changes that I had made on PSModule. So the it would need further review before making any changes/decisions on the PackageManagement resource. |
@jianyunt sounds good to me. would it make sense for me to start over with a fresh PR or do you want to keep this one for open for the discussion? UPDATE: Upon starting this I see that the PSModule Resource uses the PowerShellGet module. $moduleFound | PowerShellGet\Install-Module -ErrorVariable ev So this would introduce a cross module dependency. Not sure how i missed this the first time but on seeing this i think this repo is the best place for PSModule resource to live https://github.com/PowerShell/PowerShellGet Didn't realize these were separate module because of the similar naming i guess. Do you agree? This keeps the packagemanagement module generic as you had wished. |
@brwilkinson thanks for you update and digging into it further. No worries we can migrate the psmodule dsc here first. |
@mrhockeymonkey, yes PSModule DSC uses PowerShellGet. we have an few options:
|
I would probably favor option 2 as it seems the most sensible. Sorry i haven't replied, i was waiting for a response from @bmanikm before I do go ahead in case I end up confusing matters more. |
I agree PSModule DSC Resource should be part of the PowerShellGet module. Similarly, PSScript DSC Resource is required for the script items. |
Cool! Thanks @bmanikm. |
Closing due to PR being moved to https://github.com/PowerShell/PowerShellGet/pull/347 |
Getting a 404 on that pull 347 link. This doesn't appear to have been merged to the master branch yet? It's a blocking issue for rollout of DSC for our work. |
This is to resolve issue #327
Not very much interesting, simply adding support for the switches used in PackageManagement.