public
Description: Server automation framework and application
Homepage: http://reductivelabs.com/trac/puppet/
Clone URL: git://github.com/lak/puppet.git
Click here to lend your support to: puppet and make a donation at www.pledgie.com !
Brice Figureau (author)
Tue Nov 11 04:43:29 -0800 2008
jamtur01 (committer)
Tue Nov 11 14:19:16 -0800 2008
puppet / lib / puppet / type / ssh_authorized_key.rb
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 1 module Puppet
2 newtype(:ssh_authorized_key) do
5268487a » ctrlaltdel 2008-09-27 Fixed documentation, typo a... 3 @doc = "Manages SSH authorized keys. Currently only type 2 keys are
4 supported."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 5
6 ensurable
7
8 newparam(:name) do
731d0f22 » jamtur01 2008-07-02 Minor documentation updates... 9 desc "The SSH key comment."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 10
11 isnamevar
12 end
13
14 newproperty(:type) do
5268487a » ctrlaltdel 2008-09-27 Fixed documentation, typo a... 15 desc "The encryption type used: ssh-dss or ssh-rsa."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 16
17 newvalue("ssh-dss")
18 newvalue("ssh-rsa")
19
20 aliasvalue(:dsa, "ssh-dss")
21 aliasvalue(:rsa, "ssh-rsa")
22 end
23
24 newproperty(:key) do
25 desc "The key itself; generally a long string of hex digits."
26 end
27
28 newproperty(:user) do
731d0f22 » jamtur01 2008-07-02 Minor documentation updates... 29 desc "The user account in which the SSH key should be installed."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 30 end
31
32 newproperty(:target) do
731d0f22 » jamtur01 2008-07-02 Minor documentation updates... 33 desc "The file in which to store the SSH key."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 34 end
35
36 newproperty(:options, :array_matching => :all) do
731d0f22 » jamtur01 2008-07-02 Minor documentation updates... 37 desc "Key options, see sshd(8) for possible values. Multiple values
38 should be specified as an array."
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 39
40 defaultto do :absent end
bf5be00f » Brice Figureau 2008-11-11 Fix #1737 - part2 - Fix dis... 41
42 def is_to_s(value)
43 if value == :absent or value.include?(:absent)
44 super
45 else
46 value.join(",")
47 end
48 end
49
50 def should_to_s(value)
51 if value == :absent or value.include?(:absent)
52 super
53 else
54 value.join(",")
55 end
56 end
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 57 end
8c5c949b » ctrlaltdel 2008-06-27 ssh_authorized_key: autoreq... 58
59 autorequire(:user) do
60 if should(:user)
61 should(:user)
62 end
63 end
64
65 validate do
4c5293b8 » ctrlaltdel 2008-07-11 Fix #1409, Move path expans... 66 unless should(:target) or should(:user)
8c5c949b » ctrlaltdel 2008-06-27 ssh_authorized_key: autoreq... 67 raise Puppet::Error, "Attribute 'user' or 'target' is mandatory"
68 end
69 end
db8a46c6 » ctrlaltdel 2008-04-10 New native ssh_authorized_k... 70 end
71 end
72