Permalink
Browse files

Still learning ruby :)

  • Loading branch information...
flashingpumpkin committed Dec 1, 2011
1 parent c351d08 commit 2e73ef726b2717cf85fd99ff7c840f376977cb9a
Showing with 10 additions and 6 deletions.
  1. +7 −4 authorized/providers/keys.rb
  2. +3 −2 authorized/resources/keys.rb
@@ -24,21 +24,24 @@ def save_keys(resource)
directory "#{resource.homeroot}/#{resource.user}/.ssh" do
owner resource.user
mode 0700
- action: create
+ action :create
end
+
template "#{resource.homeroot}/#{resource.user}/.ssh/authorized_keys" do
cookbook "authorized"
source "authorized_keys.erb"
+ owner resource.user
mode 0600
variables (:keys => resource.keys)
- end
+ end
end
private
def delete_keys
- ::File.delete("#{resource.homeroot}/#{@new_resource.user}/.ssh/authorized_keys")
+ ::File.delete("#{@new_resource.homeroot}/#{@new_resource.user}/.ssh/authorized_keys")
end
private
def exists?
- ::File.exists?("#{resource.homeroot}/#{@new_resource.user}/.ssh/authorized_keys")
+ ::File.exists?("#{@new_resource.homeroot}/#{@new_resource.user}/.ssh/authorized_keys")
+end
@@ -1,9 +1,10 @@
actions :create, :delete, :create_if_missing
attribute :user, :kind_of => String, :name_attribute => true
-attribute :keys
+attribute :keys, :kind_of => Array
attribute :homeroot, :kind_of => String, :default => "/home"
def initialize(*args)
super
- @action = :create
+ @action = :create
+end

0 comments on commit 2e73ef7

Please sign in to comment.