echocat / puppet-redis

Puppet module to install and configure redis service from internet sources
Other
24 stars 85 forks source link

Should be using ensure_packages when installing packages #11

Closed gajus closed 9 years ago

gajus commented 9 years ago
==> default: Error: Duplicate declaration: Package[make] is already declared in file /tmp/vagrant-puppet-3/modules-0/redis/manifests/install.pp:42; cannot redeclare at /tmp/vagrant-puppet-3/modules-0/nodejs/manifests/install.pp:149 on node localhost
==> default: Error: Duplicate declaration: Package[make] is already declared in file /tmp/vagrant-puppet-3/modules-0/redis/manifests/install.pp:42; cannot redeclare at /tmp/vagrant-puppet-3/modules-0/nodejs/manifests/install.pp:149 on node localhost

Consider using https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/parser/functions/ensure_packages.rb or manually checking that packages are not already installed.

dwerder commented 9 years ago

The question is: Why is the install.pp executed twice? ;-)

You should call the main class redis::install only once. Its a class, not a defined type.

gajus commented 9 years ago

Any chance of this getting sorted before the end of the day? I am using https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet, if thats helps.

dwerder commented 9 years ago

Did you also open an Issue for the puppet nodejs maintainers? They seem to have the same issue by not using ensure_packages. I will see to it. Or you can send me a PR ;)

dwerder commented 9 years ago

So try it with this master. It should work now.

gajus commented 9 years ago

Getting:

==> default: Error: Could not find dependent Anchor['redis::prepare_build'] for Package[make]

Change:

'Debian', 'Ubuntu': {
    ensure_packages('build-essential', {'before' => Anchor['redis::prepare_build']} )
}
'Fedora', 'RedHat', 'CentOS', 'OEL', 'OracleLinux', 'Amazon': {
    ensure_packages(['make', 'gcc', 'glibc-devel'], {'before' => Anchor['redis::prepare_build']})
}
gajus commented 9 years ago

Why is this closed if it has not been released yet?

dwerder commented 9 years ago

because it it fixed in the master. But dont worry, there will be a new release soon.

jfrost commented 9 years ago

Sadly, the 'before' => Anchor part of this:

ensure_packages('build-essential', {'before' => Anchor['redis::prepare_build']} )

makes it throw a duplicate declaration error because I also use ensure_packages in a different module like this:

  ensure_packages([
    'atop',
    'bc',
    'build-essential',
    'curl',
    'git-core',
    'glances',
    'htop',
    'libpam-cracklib',
    'locate',
    'logrotate',
    'lsof',
    'mailutils',
    'ncdu',
    'nethogs',
    'nscd',
    'ntp',
    'psmisc',
    'rsync',
    'silversearcher-ag',
    'snmpd',
    'sysstat',
    'tmpreaper',
    'unzip',
    'vim',
    'wget',
    'zsh',
    ]
  )

If you remove that, then the catalog compiles fine. Just putting this here for anyone else who runs into it.