Sha256: 045db766e4705f0749f1f4df3f9c9563ad20a2ffcbe0c9e365ddb755bbe698da

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'puppet/provider/parsedfile'

known = nil
case Facter.value(:operatingsystem)
when "Darwin": known = "/etc/ssh_known_hosts"
else
    known = "/etc/ssh/ssh_known_hosts"
end

Puppet::Type.type(:sshkey).provide(:parsed,
    :parent => Puppet::Provider::ParsedFile,
    :default_target => known,
    :filetype => :flat
) do
    desc "Parse and generate host-wide known hosts files for SSH."

    text_line :comment, :match => /^#/
    text_line :blank, :match => /^\s+/

    record_line :parsed, :fields => %w{name type key},
        :post_parse => proc { |hash|
            if hash[:name] =~ /,/
                names = hash[:name].split(",")
                hash[:name] = names.shift
                hash[:alias] = names
            end
        },
        :pre_gen => proc { |hash|
            if hash[:alias]
                names = [hash[:name], hash[:alias]].flatten
                
                hash[:name] = [hash[:name], hash[:alias]].flatten.join(",")
                hash.delete(:alias)
            end
        }
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-0.24.9 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.2 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.4 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.3 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.5 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.7 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.6 lib/puppet/provider/sshkey/parsed.rb
puppet-0.24.8 lib/puppet/provider/sshkey/parsed.rb