chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
154 stars 99 forks source link

Pass Chocolatey Arguments as one parameter (install options?) #52

Closed ferventcoder closed 8 years ago

ferventcoder commented 8 years ago

We would like to be able to pass through arguments directly to Chocolatey, without needing to add a parameter for each new option. Would you be keen to this?

javydekoning commented 8 years ago

@ferventcoder Already made a PR for this. See #50.

This takes only switch params right now. I could adjust it to take anykind of param. Accepting ANY param would break paramvalidation.

Another option would be to just wrap all chocolatey params in a single string.

ferventcoder commented 8 years ago

@javydekoning I didn't see it allowed choco switch parameters - I see that now.

I totally meant something like $chocoSwitchParams, but no mapping on what could be passed to it.

At the end of the day, instead of trying to keep track of all of the arguments that can be passed (you missed all of the pro/business edition switches/options by the way ;) ) and permutations of how those could be passed, the param could be a simple string array that passes those switches straight through and allows choco to validate them.

ferventcoder commented 8 years ago

Very nice! I provided some comments on the PR.

ferventcoder commented 8 years ago

Duplicate of #45 ?

javydekoning commented 8 years ago

@ferventcoder This would superseed #45 and #12 indeed.

Secondly, I have to agree with you here. I think I should change #50 and implement it your way. This way there is no validation in DSC but you are able to pass anything down to choco. @ebekker @lawrencegripper what do you guys think?

lawrencegripper commented 8 years ago

Sounds good to me as it would allow more flexibility for users and reduce maintenance overhead of the DSC resources. Loss of validation is a shame bit feels like a fair trade-off

javydekoning commented 8 years ago

Ok good, I'll re-write this somewhere later this week.

javydekoning commented 8 years ago

@ferventcoder so we have 2 options here:

1 - Array:

cChocoPackageInstaller skype
{
    Name = "skype"
    chocoParams = 'allowdowngrade',
                  'allowemptychecksum',
                  'execution-timeout=200'
    Ensure = 'Present'
    Version = '7.25.0.106'
    PsDscRunAsCredential = $Credential
    DependsOn = "[cChocoInstaller]installChoco"
}

2 - String:

cChocoPackageInstaller skype
{
    Name = "skype"
    chocoParams = '--allowdowngrade --allowemptychecksum --execution-timeout=200'
    Ensure = 'Present'
    Version = '7.25.0.106'
    PsDscRunAsCredential = $Credential
    DependsOn = "[cChocoInstaller]installChoco"
} 

Either way it's going to be different from 'version' and 'Params'. I think that might be confusing to the user. I'm leaning towards the string option but it the array option looks a bit better in code.

@lawrencegripper @ebekker opinions?

lawrencegripper commented 8 years ago

I agree, the string option seems like the best route. Always a fan of keeping things simple, when appropriate, and it also keeps things consistent with the way in which the other package "params" option works too.

4c74356b41 commented 8 years ago

I'd say string. It mimics the way you actually work with choco - so makes it intuitive (in a way)

ferventcoder commented 8 years ago

@javydekoning I like string.

ferventcoder commented 8 years ago

Or both?

ferventcoder commented 8 years ago

At least string.

javydekoning commented 8 years ago

Implemented as string. See PR #53

Example: https://github.com/javydekoning/cChoco/blob/dfbae887be1e5fd14e0306ee920ee3207b8f4e74/ExampleConfig.ps1#L20-L27