Skip to content

Commit

Permalink
fix for chef 13 duplication resource deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
chasebolt committed Feb 8, 2017
1 parent baf56aa commit c475c40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions providers/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def load_current_resource
action :create do # ~FC017: LWRP does not notify when updated
user_resource :create
home_dir_resource :create
home_ssh_dir_resource :create unless new_resource.ssh_keys.empty? || @ssh_keygen
authorized_keys_resource :create
keygen_resource :create
group_resource :create
Expand All @@ -54,27 +55,31 @@ def load_current_resource
action :modify do # ~FC017: LWRP does not notify when updated
user_resource :modify
home_dir_resource :create
home_ssh_dir_resource :create unless new_resource.ssh_keys.empty? || @ssh_keygen
authorized_keys_resource :create
keygen_resource :create
end

action :manage do # ~FC017: LWRP does not notify when updated
user_resource :manage
home_dir_resource :create
home_ssh_dir_resource :create unless new_resource.ssh_keys.empty? || @ssh_keygen
authorized_keys_resource :create
keygen_resource :create
end

action :lock do # ~FC017: LWRP does not notify when updated
user_resource :lock
home_dir_resource :create
home_ssh_dir_resource :create unless new_resource.ssh_keys.empty? || @ssh_keygen
authorized_keys_resource :create
keygen_resource :create
end

action :unlock do # ~FC017: LWRP does not notify when updated
user_resource :unlock
home_dir_resource :create
home_ssh_dir_resource :create unless new_resource.ssh_keys.empty? || @ssh_keygen
authorized_keys_resource :create
keygen_resource :create
end
Expand Down Expand Up @@ -172,8 +177,6 @@ def authorized_keys_resource(exec_action)
# avoid variable scoping issues in resource block
ssh_keys = Array(new_resource.ssh_keys)
unless ssh_keys.empty?
home_ssh_dir_resource(exec_action)

resource_gid = user_gid
r = template "#{@my_home}/.ssh/authorized_keys" do
cookbook 'user'
Expand Down Expand Up @@ -209,7 +212,6 @@ def keygen_resource(exec_action)

creates "#{my_home}/.ssh/id_rsa"
end
home_ssh_dir_resource(exec_action)
e.run_action(:run) if @ssh_keygen && exec_action == :create
new_resource.updated_by_last_action(true) if e.updated_by_last_action?

Expand Down

0 comments on commit c475c40

Please sign in to comment.