voxpupuli / voxpupuli/puppet-php

Can't define any php packages outside of this module without causing conflict

Open
#581 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Puppet
Stars
86
Forks
264
Avg merge
29m
Merged PRs (30d)
1

Description

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: v4.8.2 client, 6.14 server
  • Ruby: 2.3.2
  • Distribution: Debian Stretch
  • Module version: 7.1.0

How to reproduce (e.g Puppet code you use)

When a php7.0-cli package is defined elsewhere, a duplicate definition is created. In our case, we have php7.0-cli and some others installed by ensure_packages() from stdlib, and used for some ordering, like so:

$packages = flatten([
    $pkg_step1,
    $pkg_step2,
])
ensure_packages($packages)
# Make sure the cgi package is installed before php so that the latter
# doesn't pull in libapache2-mod-php.
    Package[$pkg_step1] -> Package[$pkg_step2]

What are you seeing

Duplicate resource definition

What behaviour did you expect instead

Packages to be installed with ensure_packages() to avoid conflicts where defined elsewhere.

Output log

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[php7.0-cli] is already declared at (file: /etc/puppetlabs/code/environments/<redacted>/modules/<redacted path to own class>/php.pp, line: 73); cannot redeclare (file: /etc/puppetlabs/code/environments/<redacted>/modules_dist/php/manifests/packages.pp, line: 30) (file: /etc/puppetlabs/code/environments/<redacted>/modules_dist/php/manifests/packages.pp, line: 30, column: 5) on node <redacted>
Warning: Not using cache on failed catalog

Any additional information you'd like to impart

Should be an easy enough fix, so I'll get a PR in shortly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the duplicate declaration at php/manifests/packages.pp line 30 and compare it with the Package declaration in php.pp line 73. Reproduce the ensure_packages() scenario from the issue, then verify that existing package declarations no longer cause a duplicate resource while the requested package ordering still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.