summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/configuration/yaml.rb
blob: 1330aaffa50f5e2b09224ec5fd5f65810fc67345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'puppet/node/configuration'
require 'puppet/indirector/yaml'

class Puppet::Node::Configuration::Yaml < Puppet::Indirector::Yaml
    desc "Store configurations as flat files, serialized using YAML."

    private

    # Override these, because yaml doesn't want to convert our self-referential
    # objects.  This is hackish, but eh.
    def from_yaml(text)
        if config = YAML.load(text)
            # We can't yaml-dump classes.
            #config.edgelist_class = Puppet::Relationship
            return config
        end
    end

    def to_yaml(config)
        # We can't yaml-dump classes.
        #config.edgelist_class = nil
        YAML.dump(config)
    end
end