Project

General

Profile

Actions

Feature #418

closed

Dont show all classes

Added by Ohad Levy over 13 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Puppet integration
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

It should be possible to define some classes as disabled (or not browsable), so you wont see them when selecting classes.

this mostly useful for classes which are internally used (within puppet) but you still want to be able to browse their puppetdoc.


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Feature #933: Hide some puppet classes in ForemanDuplicateJean-Sébastien Pédron05/24/2011Actions
Actions #1

Updated by Ohad Levy over 13 years ago

  • Target version set to 0.2
Actions #2

Updated by Ohad Levy about 13 years ago

  • Target version deleted (0.2)
Actions #3

Updated by Paul Kelly about 13 years ago

  • Status changed from New to Ready For Testing
Actions #4

Updated by Paul Kelly almost 13 years ago

rebased and tested

Actions #5

Updated by Paul Kelly almost 13 years ago

  • Contract all the long searches into a scope i.e. obj.hostgroup and obj.hostgroup.puppetclasses and (klasses = obj.hostgroup.puppetclasses.visible_is(true)).is_a?(Array) and obj.is_a?(Host)
  • Set the default scope to only show visible classes
  • Update the search facility to allow visible to be used as a search target
  • When importing classes, all classes should be imported but a facility should be provided so that some can be marked as invisible
  • Update puppetdoc construction so that invisible classes are not processed
  • Provide a "toggle all" facility on the puppetclasses page. Use this:
    function checkAll (id, checked) {
    $(id).find(":checkbox:not([disabled='disabled'])").attr('checked',checked)
    }
  • Provide a multiple interface so that this operation can be performed on large numbers of classes at once.
Actions #6

Updated by Ohad Levy almost 13 years ago

  • Status changed from Ready For Testing to Duplicate
Actions #7

Updated by Ohad Levy almost 13 years ago

  • Status changed from Duplicate to New
Actions #8

Updated by Romain Vrignaud over 11 years ago

  • Assignee changed from Paul Kelly to Jean-Sébastien Pédron
Actions #9

Updated by Jean-Sébastien Pédron over 11 years ago

I pushed the first version of the patch I'm working on to implement this feature.

There're two parts:
  1. The smart-proxy is modified to read modelines in Puppet classes' documentation. At this stage, the modeline content isn't parsed at all: only the "foreman:" prefix is read by the smart-proxy. The text following the prefix is then transfered as-is to Foreman.
  2. Foreman is modified to parse the modelines sent by the smart-proxy and store it in the database. A modeline is a one-line JSON hash. Later, when editing a host or a hostgroup for instance, the modeline is used to determine if a Puppet class should be displayed. A new button allows one to toggle the display of internal classes.

Here's an example of a modeline in a Puppet class:

# Class: mymodule::myclass
#
# foreman: { internal-class }
class mymodule::myclass {
    ...
}

The branches are on Github at the moment:

Caveat:
Both branches are based on Olivier Favre's branches regarding Parameterized classes, because I needed the modifications to the protocol between the smart-proxy and Foreman.

Actions #10

Updated by Ohad Levy over 11 years ago

  • Target version set to 1.1
Actions #11

Updated by Ohad Levy over 11 years ago

  • Status changed from New to Resolved
  • Assignee changed from Jean-Sébastien Pédron to Amos Benari

this is actually already resolved as part of the parameterized classes support.

foreman includes a file config/ignored_environments.yml.sample which contains examples of class names to ignore
or regular expressions of class names to be ignored.

Actions #12

Updated by Sher Chowdhury over 8 years ago

I wanted my foreman to only display my roles and profiles classes only. I achieved this by creating this file:

$ cat /usr/share/foreman/config/ignored_environments.yml
#:ignored:
#  - test

:filters:
  - !ruby/regexp '/^(?!role|profile).*$/'

This didn't work at first but then I realized that it does work as long as you create this file before doing any foreman class/environment imports.

Hope this helps for anyone else having issues using the ignored_environments.yml file.

Actions

Also available in: Atom PDF