Ruby_block as a specific user

any way possible to do this? try an execute that notifies a ruby_block still no dice.

A ruby_block resource just runs its code, users don’t enter in to it. If you want to do a fork+setuid dance in your code, that’s up to you (also that won’t work on Windows).

its ok since its not for windows. I am trying to figure out if its at all possible to run this guy as a specific user.

Chef::Resource::OsxProfile.new(identifier, run_context)

Mac OS X profiles have two contexts. System and User.

oh wait…didnt read you reply properly.

Process.fork do
Process.uid = u.uid
block.call(user)
end

wonder if this will work…

That’s a Chef resource, you don’t run them from ruby_block resources :slight_smile: More to the point the osx_profile resource doesn’t support installing a profile as any user other than the one running Chef. If you want to improve this it would have to be in Chef’s code, not your recipe.

sorry just a terminology mistake. still getting my head around chef (im not a ruby guy)

do you know if the osx_profile resource generates the actual profile on disk anywhere before processing?

dont worry found it.

-mode-cache/cache/