chocolatey / cChoco

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

Set default source for chocolatey in cChocoInstaller #24

Closed DamianBis closed 8 years ago

DamianBis commented 8 years ago

We set up a default source that is an internal server when we do our DSC in a script that runs after chocolatey installs. This script removes the default chocolatey and then adds in our source.

It would be nice if this was done in the DSC module. I'm happy to write this up and do a pull request as I've already got most of the code if it's a feature you want in this module.. and it will help lessen the complexity of my configurations

lawrencegripper commented 8 years ago

Hi,

I think we have this functionality, def for adding new internal only sources, in the module. Is this the behaviour you wanted? In the module it's on a per package basis, to give more flexibility.

https://github.com/PowerShellOrg/cChoco/blob/master/DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1#L70

Happy to take you're thoughts if you think it's not quite right.

ferventcoder commented 8 years ago

@lawrencegripper I just took a look and I'm not sure it's quite right. I think when folks pass along the source attribute, they want it to apply to that command only. From the looks of it, Line 81 needs the specified source passed to it if that option was passed. Basically if someone is passing a source, they only want to use that source and nothing else.

Then what I believe @DamianBis is requesting is a resource for ensuring default sources that are used when source is not passed with the package resource.

ferventcoder commented 8 years ago

With the Puppet provider, it is specified like this:

chocolateysource { 'name';
  location     => 'odataurl | local file share | etc',
  ensure       => present|absent|disabled,
  user         => '',
  password     => '',
  priority     => 0,
}

Is basically the same thing what you are looking for @DamianBis ?

DamianBis commented 8 years ago

Yeah. The idea being that we want to set a GLOBAL source for chocolatey so that if at any time someone was to go on that server and type choco list they would only be hitting OUR chocolatey server not the default or any other chocolatey server.

The way i've done it in my fork is that it's added into the cChocoInstaller module as parameters (source name and source URL). If any other sources exist it will remove them and it will also add your specified source.

But how it's done in Puppet would also work. where you can specify the default source to be absent, and then specify your own source to be present.

ferventcoder commented 8 years ago

I certainly prefer explicit steps. It is the most flexible as far as configuring more than just two sources, one of which is the default feed. 👍

ebekker commented 8 years ago

PR #35 has been merged in to implement this.