Class: ForemanPuppet::Environment
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ForemanPuppet::Environment
- Extended by:
- FriendlyId
- Includes:
- Authorizable, Parameterizable::ByName, Taxonomix
- Defined in:
- app/models/foreman_puppet/environment.rb
Class Method Summary collapse
-
.puppetEnvs(proxy = nil) ⇒ Object
TODO: this needs to be removed, as PuppetDOC generation no longer works if the manifests are not on the foreman host returns an hash of all puppet environments and their relative paths.
Class Method Details
.puppetEnvs(proxy = nil) ⇒ Object
TODO: this needs to be removed, as PuppetDOC generation no longer works if the manifests are not on the foreman host returns an hash of all puppet environments and their relative paths
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/foreman_puppet/environment.rb', line 42 def puppetEnvs(proxy = nil) url = (proxy || SmartProxy.with_features('Puppet').first).try(:url) raise ::Foreman::Exception, N_("Can't find a valid Foreman Proxy with a Puppet feature") if url.blank? proxy = ProxyAPI::Puppet.new url: url HashWithIndifferentAccess[proxy.environments.map do |e| [e, HashWithIndifferentAccess[proxy.classes(e).map do |k| klass = k.keys.first [klass, k[klass]['params']] end]] end] end |