Project

General

Profile

Feature #418

Dont show all classes

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

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Puppet integration
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
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

Is duplicate of Foreman - Feature #933: Hide some puppet classes in ForemanDuplicate2011-05-24

History

#1 Updated by Ohad Levy over 8 years ago

  • Target version set to 0.2

#2 Updated by Ohad Levy over 8 years ago

  • Target version deleted (0.2)

#3 Updated by Paul Kelly over 8 years ago

  • Status changed from New to Ready For Testing

#4 Updated by Paul Kelly about 8 years ago

rebased and tested

#5 Updated by Paul Kelly about 8 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.

#6 Updated by Ohad Levy about 8 years ago

  • Status changed from Ready For Testing to Duplicate

#7 Updated by Ohad Levy about 8 years ago

  • Status changed from Duplicate to New

#8 Updated by Romain Vrignaud almost 7 years ago

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

#9 Updated by Jean-Sébastien Pédron almost 7 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.

#10 Updated by Ohad Levy almost 7 years ago

  • Target version set to 1.1

#11 Updated by Ohad Levy over 6 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.

#12 Updated by Sher Chowdhury over 3 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.

Also available in: Atom PDF