voxpupuli / voxpupuli/puppet-php

Private class test should use `assert_private()`

Open
#280 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Affected Puppet, Ruby, OS and module versions/distributions
  • Puppet: 3.8
  • Ruby: 1.9.3
  • Distribution: Ubuntu
  • Module version: 5576e072b32c989f1cd6a2e7551a8d66285d6cd2
What are you seeing

The test that insures some class/type are private is not the same everywhere

Some class/type use this test:

  if ! defined(Class['php::fpm']) {
    warning('php::fpm::service is private')
  }

See https://github.com/voxpupuli/puppet-php/search?q=%22defined%28Class%22

  • manifests/fpm/service.pp
  • manifests/fpm.pp
  • manifests/fpm/pool.pp
  • manifests/extension.pp

From what I understand only manifests/fpm/pool.pp should use it (based on the warning message warning('You must include the php base class before using any php defined resources'))
With the current version of the code, user can call some private classes directly.

The correct test for privacy should be:

  if $caller_module_name != $module_name {
    warning('php::fpm::config is private')
  }

(this code is already used in some other places inside this module)

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

Read manifests/fpm/service.pp, manifests/fpm.pp, manifests/fpm/pool.pp, and manifests/extension.pp, then compare their privacy checks with existing caller_module_name uses. Verify that each intended private class or type rejects direct use while the base-class behavior remains as described.

Written by the indexing model from the issue text.

Assessment

Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.