camptocamp / puppet-mapserver

Apache License 2.0
5 stars 6 forks source link

duplicate declaration for Package['gdal-bin'] #8

Closed flamingbear closed 11 years ago

flamingbear commented 11 years ago

I'm installing the mapserver module on a machine with an install of scipy, which also needs gdal-bin and I was getting an error:

"Duplicate declaration: Package[gdal-bin] is already declared in file /tmp/vagrant-puppet/modules-0/python/manifests/init.pp at line 4; cannot redeclare at /tmp/vagrant-puppet/modules-0/mapserver/manifests/init.pp:30 on node precise64.ad.int.nsidc.org"

So I wrapped my python module to use ensure_packages() from the standard library. This didn't work, because it seemed to install the package before arriving at the mapserver.

I'm pretty new to puppet, and don't really know what the solution is, but I forked and "fixed" for me by using the puppet stdlib's ensure_packages() in this module as well. I'll follow up with a pull request and you guys can decide what to do with it. I'm happy to hear/see a better way.

Thanks Matt

mbornoz commented 11 years ago

In fact I don't understand why you declared gdal-bin in your python module?

IHMO a module named "python" should be used for generic python stuff. If you really want to declare resources in several modules, I recommend you to use virtual resources.

Here is an example: https://github.com/camptocamp/puppet-python/blob/master/README.md

Cheers, Mathieu

flamingbear commented 11 years ago

Well, it's a scientific python module actually, and it includes python-gdal. So I'll have the same problem with the python-gdal module, which does seem reasonable in a python module to me. But I am new to puppet. I saw the virtual resource page, but didn't read it closely, I'll go back and look at it.

But this is my python class that we are using, it seems reasonable?

class python {
  package { ["python2.7", "libpython2.7", "python-pip", "python-gdal", "python-numpy", "python-matplotlib", "python-scipy"]:
    ensure => present,
  }
}
raphink commented 11 years ago

I merged your PR. Thank you.