I’ve been doing some experimentation with the user/group resources and I’m
confused by some of the behavior. Here is a snippet that I fed to chef-solo:
group “mwhiteley” do
gid 1000
end
user “mwhiteley” do
comment "Matt Whiteley"
uid 1000
gid "mwhiteley"
home "/home/mwhiteley"
shell "/bin/zsh"
end
I then ran chef-solo starting from various states:
-
neither exists
before:
after:
/etc/passwd:mwhiteley:x:1000:1000:Matt Whiteley:/home/mwhiteley:/bin/zsh
/etc/group:mwhiteley:x:1000: -
both created perfectly
-
user exists
before:
/etc/passwd:mwhiteley:x:1000:100:Matt Whiteley:/home/mwhiteley:/bin/zsh
after:
/etc/passwd:mwhiteley:x:1000:1000:Matt Whiteley:/home/mwhiteley:/bin/zsh
/etc/group:mwhiteley:x:1000: -
group created, user[gid] changed
-
group exists
before:
/etc/group:mwhiteley:x:500:
after:
/etc/passwd:mwhiteley:x:1000:500:Matt Whiteley:/home/mwhiteley:/bin/zsh
/etc/group:mwhiteley:x:500: -
user created, group[gid] not changed
-
both exist
before:
/etc/passwd:mwhiteley:x:500:500::/home/mwhiteley:/bin/bash
/etc/group:mwhiteley:x:500:
after:
/etc/passwd:mwhiteley:x:1000:500:Matt Whiteley:/home/mwhiteley:/bin/zsh
/etc/group:mwhiteley:x:500: -
user[uid] changed, group[gid] not changed
I would like to know if this is a bug or if I just need to understand rules
about what will or won’t be changed when encountering pre-existing resources.
I also noticed on the http://wiki.opscode.com/display/chef/Resources page the
group[gid] isn’t quoted while the similarly numeric user[uid] is quoted. When I
placed quotes on the group[gid] I got the following error:
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/mixin/params_validate.rb:140:in
`_pv_kind_of’: Option gid must be a kind of Integer! You passed “1000”.
(Chef::Exceptions::ValidationFailed)
I appreciate someone pointing out my misunderstanding.
thanks,
Matt Whiteley mattwhiteley@gmail.com