basho-labs / puppet-riak

A puppet module to deploy Riak clusters
Apache License 2.0
33 stars 37 forks source link

Extract 'httpfile' to module and remove 'curl' dependency #11

Closed Iristyle closed 9 years ago

Iristyle commented 11 years ago

I did a little looking, and apparently it's pretty common for packages to end up being accidentally redeclared.

From my Puppet console output

←[1;31mError: Duplicate declaration: Package[curl] is already declared in file /tmp/vagrant-puppet/modules-0/redis/manifests/init.pp at line 9; cannot redeclare on node ubuntu-12.04.2-server-amd64-mono-nginx-node←[0m

←[1;31mError: Duplicate declaration: Package[curl] is already declared in file /tmp/vagrant-puppet/modules-0/redis/manifests/init.pp at line 9; cannot redeclare on node ubuntu-12.04.2-server-amd64-mono-nginx-node←[0m

I'm using https://github.com/logicalparadox/puppet-redis to install Redis.

In my Puppet file, I'm installing Redis first, then Riak.

Now, if I reorder how my packages are called in my Puppet script to install Riak first and then Redis, it works just fine.

If you look at the init.pp for Redis https://github.com/logicalparadox/puppet-redis/blob/master/manifests/init.pp#L6

It has the code to prevent the re-declaration.

if defined(Package['curl']) == false {
    package { "curl":
      ensure => "installed"
    }
  }

So I think that this is all that needs to be added to this package as well...but I'm not a Puppet guy ;0

BTW - This is a demo / Vagrant box and not a real production box -- definitely wouldn't run servers with Riak and Redis on them ;0

haf commented 11 years ago

I don't like checking for definitions because that's like saying that the language is not idempotent in its declarations, even though the declarations may be identical. I'm not sure of the solution though; possibly I could try to realize the curl package resource, but that would require fixes to both redis and riak, to depend on some 'internet fetching mechanism'...

haf commented 11 years ago

Closing since I don't have a good solution that is generic: suggestions are welcome and then this issue can be re-opened.

ghoneycutt commented 11 years ago

Recommend you go with the "depend on some 'internet fetching mechanism'" approach and include a class that can handle that and mark the dependency in your Modulefile.

I actually just did this today with a different module and used maestrodev/wget.

https://github.com/maestrodev/puppet-wget

haf commented 11 years ago

@ghoneycutt That's true. I could also use my own 'httpfile' resource, I guess.

Alright, I am reopening this issue, aiming to use my own 'httpfile' to be extended with hashing md5 and sha1 (not just sha2).

ghoneycutt commented 11 years ago

Would recommend that httpfile be its own module and that the riak module would include that one. Interested in checking out your module and how it is different from @maestrodev's :)

danieldreier commented 9 years ago

It's been a while since this was reported, so I wanted to re-affirm that this is still a problem. maestrodev/wget is a good option for replacing the homebrew one in this module.

haf commented 9 years ago

Done https://github.com/haf/puppet-httpfile