diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-03-25 11:28:13 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-03-25 14:31:27 -0700 |
| commit | da082d500e1f1192dbc987483d753d93b5698094 (patch) | |
| tree | 7ea0886f5d12c29ad653224e8eed68edbf99abbd /lib/puppet | |
| parent | 4196699f5fbb90ceecbb709c8502622eaad39062 (diff) | |
| download | puppet-da082d500e1f1192dbc987483d753d93b5698094.tar.gz puppet-da082d500e1f1192dbc987483d753d93b5698094.tar.xz puppet-da082d500e1f1192dbc987483d753d93b5698094.zip | |
Fixed #6850 - Clean up ResourceType#to_pson
There's no value in including the code when we convert a resource
type to JSON, since you can't convert it back again, so this removes
it.
I also cleaned up a few of the other attributes which were
producing unnecessary information.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/indirector/resource_type/parser.rb | 7 | ||||
| -rw-r--r-- | lib/puppet/resource/type.rb | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/puppet/indirector/resource_type/parser.rb b/lib/puppet/indirector/resource_type/parser.rb index 8b1bed0a9..24b4b065e 100644 --- a/lib/puppet/indirector/resource_type/parser.rb +++ b/lib/puppet/indirector/resource_type/parser.rb @@ -18,6 +18,13 @@ class Puppet::Indirector::ResourceType::Parser < Puppet::Indirector::Code end def search(request) +=begin + @modulepath = set_modulepath(options[:modulepath]) + get_code(@modulepath)[:manifests].collect do |file| + Puppet[:manifest]=file + get_resources_of_type(:hostclass) + end.flatten +=end raise ArgumentError, "Only '*' is acceptable as a search request" unless request.key == "*" krt = request.environment.known_resource_types result = [krt.hostclasses.values, krt.definitions.values, krt.nodes.values].flatten diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index b9cf6991a..48d8c1f48 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -34,13 +34,13 @@ class Puppet::Resource::Type end def to_pson_data_hash - data = [:code, :doc, :line, :file, :parent].inject({}) do |hash, param| - next hash unless value = self.send(param) + data = [:doc, :line, :file, :parent].inject({}) do |hash, param| + next hash unless (value = self.send(param)) and (value != "") hash[param.to_s] = value hash end - data['arguments'] = arguments.dup + data['arguments'] = arguments.dup unless arguments.empty? data['name'] = name data['type'] = type |
