Revision 1ce43f91
Added by Ohad Levy almost 12 years ago
- ID 1ce43f91fee51a7539cd3751799fe0d3d560d743
lib/puppet_api.rb | ||
---|---|---|
begin
|
||
env = Proxy::Puppet::Environment.find(params[:environment])
|
||
log_halt 404, "Not found" unless env
|
||
env.classes.map{|k| {k.to_s => { :name => k.name, :module => k.module} } }.to_json
|
||
env.classes.map{|k| {k.to_s => { :name => k.name, :module => k.module, :params => k.params} } }.to_json
|
||
rescue => e
|
||
log_halt 406, "Failed to show puppet classes: #{e}"
|
||
end
|
||
end
|
||
|
||
end
|
||
end
|
Also available in: Unified diff
Export arguments of parameterized classes
Use puppet/parser for a first class analysis of the class definitions.
Using regexes would have been a nightmare.
Exports a "params" sub-object whose keys are the parameter names and
values are a best-effort convertion from AST leaves to native ruby
types, before being exported as native JSON values.
Compatible with Puppet 2.6 and 2.7, at least.
Tests:
- Manifest must now parse in order to extract classes from it,
hence the fix in the test.
- Functional tests