Revision a989a617
Added by Ohad Levy about 12 years ago
- ID a989a6171e3130f50933e7d6694ab416c8f69cda
app/models/puppetclass.rb | ||
---|---|---|
name
|
||
end
|
||
|
||
# Scans a directory path for puppet classes
|
||
# +paths+ : String containing a colon separated module path
|
||
# returns
|
||
# Array of Strings containing puppet class names
|
||
def self.scanForClasses(paths)
|
||
klasses=Array.new
|
||
for path in paths.split(":")
|
||
Dir.glob("#{path}/*/manifests/**/*.pp").each do |manifest|
|
||
File.read(manifest).each_line do |line|
|
||
klass=line.match(/^class\s+([\w:-]*)/)
|
||
klasses << klass[1] if klass
|
||
end
|
||
end
|
||
end
|
||
return klasses.uniq
|
||
end
|
||
|
||
# returns a hash containing modules and associated classes
|
||
def self.classes2hash classes
|
||
hash = {}
|
||
... | ... | |
klass <=> other.klass
|
||
end
|
||
|
||
# Retrieve the manifest dir from the puppet configuration
|
||
# Returns: String
|
||
def self.manifestdir
|
||
ps = Puppet.settings.instance_variable_get(:@values)
|
||
ps[:main][:manifestdir] || ps[:puppetmasterd][:manifestdir] || ps[:puppetd][:manifestdir] || Puppet.settings[:manifestdir] || "/etc/puppet/manifests"
|
||
end
|
||
|
||
# Populates the rdoc tree with information about all the classes in your modules.
|
||
# Firstly, we prepare the modules tree
|
||
# Secondly we run puppetdoc over the modulespath and manifestdir for all environments
|
Also available in: Unified diff
fixes #1509 - Foreman should use the proxy to import puppet classes