Revision f8d94608
Added by Amos Benari over 11 years ago
- ID f8d946082e58b60213a27ded3e1e5f5373d976de
app/helpers/puppetclasses_and_environments_helper.rb | ||
---|---|---|
elsif pcs.delete "_destroy_"
|
||
"Deleted environment #{env} and " + pcs.to_sentence
|
||
else
|
||
pcs.to_sentence
|
||
pretty_print(pcs.is_a?(Hash) ? pcs.keys : pcs)
|
||
end
|
||
end
|
||
|
||
def import_proxy_select hash
|
||
proxies = Environment.find_import_proxies
|
||
toolbar_action_buttons(
|
||
proxies.map do |proxy|
|
||
SmartProxy.puppet_proxies.map do |proxy|
|
||
display_link_if_authorized("Import from #{proxy.name}", hash.merge(:proxy => proxy))
|
||
end.flatten
|
||
)
|
||
end
|
||
|
||
private
|
||
def pretty_print classes
|
||
hash = { }
|
||
classes.each do |klass|
|
||
if (mod = klass.gsub(/::.*/, ""))
|
||
hash[mod] ||= []
|
||
hash[mod] << klass
|
||
else
|
||
next
|
||
end
|
||
end
|
||
hash.keys.sort.map do |key|
|
||
link_to_function key, { :rel => "popover", "data-content" => hash[key].sort.join('<br>').html_safe, "data-original-title" => key }
|
||
end.to_sentence.html_safe
|
||
|
||
end
|
||
|
||
end
|
Also available in: Unified diff
fixes #832 - adds parameterized class support
Credits:
This patch adds the following featuresThis patch is based on the original work of Olivier Favre
<olivier@yakaz.com> many many thanks!
signature - each class can have a different set of parameters per environment.
users can add regexp or class names that the importer should ignore.
common usage case for this is classes such as ::config, ::install etc.
in order to use the new ENC format for puppet 2.6.5+ you should enable the
Parametrized_Classes_in_ENC and Enable_Smart_Variables_in_ENC within Foreman Settings
This is the initial patch just to get param classes support in, follow-up patches
would include a better UI and the relevant UI updates to host edit page etc.
Signed-off-by: Ohad Levy <ohadlevy@gmail.com>