Issue with chef-client 12 on OS X workstations


#1

I use chef to manage OS X workstations, slowly but surely moving out of my old
method of building pkg installers for everything than using munki.

Prior to updating to chef 12 (for instance running 11.12.8) on my bootstrapped
workstations this portion of a recipe I use to set a base config would work:

directory "/Users/#{node['current_user']}/.ssh" do
    owner node['current_user']
    mode "0700"
    action :create
end

With the result being that an .ssh folder was created for the logged in admin
user, for instance foo-admin, not the root user.

However after updating to chef-client 12, this same recipe fails, as it tries
to create a .ssh folder for root, who doesn’t have a home at /Users.

Any ideas on how I can improve this so that I get my expected result?

Thanks
Ryan Moon


#2

Inside of your loop:

next if node['current_user'] == 'root'

cheers,

–aj

On Wed, Dec 31, 2014 at 12:17 PM, Ryan Moon ryan.moon@gmail.com wrote:

I use chef to manage OS X workstations, slowly but surely moving out of my old
method of building pkg installers for everything than using munki.

Prior to updating to chef 12 (for instance running 11.12.8) on my bootstrapped
workstations this portion of a recipe I use to set a base config would work:

    directory "/Users/#{node['current_user']}/.ssh" do
        owner node['current_user']
        mode "0700"
        action :create
    end

With the result being that an .ssh folder was created for the logged in admin
user, for instance foo-admin, not the root user.

However after updating to chef-client 12, this same recipe fails, as it tries
to create a .ssh folder for root, who doesn’t have a home at /Users.

Any ideas on how I can improve this so that I get my expected result?

Thanks
Ryan Moon


#3

Hello,

If you’re running chef-client with sudo, then you may find this post
helpful - I wrote it with this kind of use case in mind (though not the
specific change in Chef 12 that you encountered).

http://jtimberman.housepub.org/blog/2014/12/29/chef-12-homebrew-user-mixin/

Cheers,
Joshua

On Tue, Dec 30, 2014 at 4:17 PM, Ryan Moon ryan.moon@gmail.com wrote:

I use chef to manage OS X workstations, slowly but surely moving out of my
old
method of building pkg installers for everything than using munki.

Prior to updating to chef 12 (for instance running 11.12.8) on my
bootstrapped
workstations this portion of a recipe I use to set a base config would
work:

    directory "/Users/#{node['current_user']}/.ssh" do
        owner node['current_user']
        mode "0700"
        action :create
    end

With the result being that an .ssh folder was created for the logged in
admin
user, for instance foo-admin, not the root user.

However after updating to chef-client 12, this same recipe fails, as it
tries
to create a .ssh folder for root, who doesn’t have a home at /Users.

Any ideas on how I can improve this so that I get my expected result?

Thanks
Ryan Moon

Joshua Timberman, Code Cleric


#4

On Tue, 30 Dec 2014, Ryan Moon wrote:

I use chef to manage OS X workstations, slowly but surely moving out of my old
method of building pkg installers for everything than using munki.

Prior to updating to chef 12 (for instance running 11.12.8) on my bootstrapped
workstations this portion of a recipe I use to set a base config would work:

directory “/Users/#{node[‘current_user’]}/.ssh” do
owner node[‘current_user’]
mode "0700"
action :create
end

With the result being that an .ssh folder was created for the logged in admin
user, for instance foo-admin, not the root user.

However after updating to chef-client 12, this same recipe fails, as it tries
to create a .ssh folder for root, who doesn’t have a home at /Users.

Note that the semantics for node[‘current_user’] changed in Chef 12/Ohai 8
to correct confusing behavior when running under sudo.

  • Julian

[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]