Skip to content

Commit

Permalink
Use ruby_block and notifies instead
Browse files Browse the repository at this point in the history
* Does not reset :new_admin_password
* Runs only if passwords differ
  • Loading branch information
tmaier committed Apr 27, 2015
1 parent 45b237d commit df0d2d7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
26 changes: 16 additions & 10 deletions recipes/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,23 @@
end

#Change admin password
unless node[:aem][:author][:new_admin_password].nil?
aem_user node[:aem][:author][:admin_user] do
password node[:aem][:author][:new_admin_password]
admin_user node[:aem][:author][:admin_user]
admin_password node[:aem][:author][:admin_password]
port node[:aem][:author][:port]
aem_version node[:aem][:version]
action :set_password
aem_user node[:aem][:author][:admin_user] do
password node[:aem][:author][:new_admin_password]
admin_user node[:aem][:author][:admin_user]
admin_password node[:aem][:author][:admin_password]
port node[:aem][:author][:port]
aem_version node[:aem][:version]
action :set_password
only_if { node[:aem][:author][:new_admin_password] }
not_if { node.set[:aem][:author][:new_admin_password] == node.set[:aem][:author][:admin_password] }
notifies :run, 'ruby_block[Store new admin password in node]', :immediately
end

ruby_block 'Store new admin password in node' do
block do
node.set[:aem][:author][:admin_password] = node[:aem][:author][:new_admin_password]
end
node.set[:aem][:author][:admin_password] = node[:aem][:author][:new_admin_password]
node.set[:aem][:author][:new_admin_password] = nil
action :nothing
end

#delete the privileged users from geometrixx, if they're still there.
Expand Down
25 changes: 16 additions & 9 deletions recipes/publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,23 @@
end

#Change admin password
unless node[:aem][:publish][:new_admin_password].nil?
aem_user node[:aem][:publish][:admin_user] do
password node[:aem][:publish][:new_admin_password]
admin_user node[:aem][:publish][:admin_user]
admin_password node[:aem][:publish][:admin_password]
port node[:aem][:publish][:port]
aem_version node[:aem][:version]
action :set_password
aem_user node[:aem][:publish][:admin_user] do
password node[:aem][:publish][:new_admin_password]
admin_user node[:aem][:publish][:admin_user]
admin_password node[:aem][:publish][:admin_password]
port node[:aem][:publish][:port]
aem_version node[:aem][:version]
action :set_password
only_if { node[:aem][:publish][:new_admin_password] }
not_if { node.set[:aem][:publish][:new_admin_password] == node.set[:aem][:publish][:admin_password] }
notifies :run, 'ruby_block[Store new admin password in node]', :immediately
end

ruby_block 'Store new admin password in node' do
block do
node.set[:aem][:publish][:admin_password] = node[:aem][:publish][:new_admin_password]
end
node.set[:aem][:publish][:admin_password] = node[:aem][:publish][:new_admin_password]
action :nothing
end

#delete the privileged users from geometrixx, if they're still there.
Expand Down

0 comments on commit df0d2d7

Please sign in to comment.