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

Closed
Iristyle opened this Issue Mar 3, 2013 · 7 comments

Projects

None yet

4 participants

@Iristyle
Iristyle commented Mar 3, 2013

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
Collaborator
haf commented Mar 3, 2013

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
Collaborator
haf commented Mar 26, 2013

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

@haf haf closed this Mar 26, 2013
@ghoneycutt

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
Collaborator
haf commented Mar 26, 2013

@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).

@haf haf reopened this Mar 26, 2013
@ghoneycutt

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
Collaborator

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 haf closed this Mar 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment