diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-02 15:09:07 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-02 15:09:07 -0700 |
commit | 7a1a6c8ef26c787e4b6dd1602f3d158b37e81720 (patch) | |
tree | 1e390cd535b38368d091cbb33e5d419408d5ce00 /lib/chef/provider/group | |
parent | 77f8739a4741e2370e40ec39345a92a6ea393a1a (diff) | |
download | chef-7a1a6c8ef26c787e4b6dd1602f3d158b37e81720.tar.gz |
fix Layout/EmptyLineAfterGuardClause
i like this one, gives visual priority to returns or raises that are
buried in the middle of things.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/group')
-rw-r--r-- | lib/chef/provider/group/aix.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/group/dscl.rb | 3 | ||||
-rw-r--r-- | lib/chef/provider/group/groupadd.rb | 1 | ||||
-rw-r--r-- | lib/chef/provider/group/usermod.rb | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/provider/group/aix.rb b/lib/chef/provider/group/aix.rb index 72bfc76d97..aa4d8ba4c4 100644 --- a/lib/chef/provider/group/aix.rb +++ b/lib/chef/provider/group/aix.rb @@ -54,6 +54,7 @@ class Chef def set_members(members) return if members.empty? + shell_out!("chgrpmem", "-m", "=", members.join(","), new_resource.group_name) end @@ -65,6 +66,7 @@ class Chef opts = [] { gid: "id" }.sort_by { |a| a[0] }.each do |field, option| next unless current_resource.send(field) != new_resource.send(field) + if new_resource.send(field) logger.trace("#{new_resource} setting #{field} to #{new_resource.send(field)}") opts << "#{option}=#{new_resource.send(field)}" diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb index a5c4d27ddb..ce4a6adaf7 100644 --- a/lib/chef/provider/group/dscl.rb +++ b/lib/chef/provider/group/dscl.rb @@ -40,6 +40,7 @@ class Chef return "" if ( args.first =~ /^delete/ ) && ( result[1].exitstatus != 0 ) raise(Chef::Exceptions::Group, "dscl error: #{result.inspect}") unless result[1].exitstatus == 0 raise(Chef::Exceptions::Group, "dscl error: #{result.inspect}") if result[2] =~ /No such key: / + result[2] end @@ -88,6 +89,7 @@ class Chef def gid_used?(gid) return false unless gid + search_gids = safe_dscl("search", "/Groups", "PrimaryGroupID", gid.to_s) # dscl -search should not return anything if the gid doesn't exist, @@ -99,6 +101,7 @@ class Chef def set_gid new_resource.gid(get_free_gid) if [nil, ""].include? new_resource.gid raise(Chef::Exceptions::Group, "gid is already in use") if gid_used?(new_resource.gid) + safe_dscl("create", "/Groups/#{new_resource.group_name}", "PrimaryGroupID", new_resource.gid) end diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb index dd99a1c49a..eca104b565 100644 --- a/lib/chef/provider/group/groupadd.rb +++ b/lib/chef/provider/group/groupadd.rb @@ -111,6 +111,7 @@ class Chef { gid: "-g" }.sort_by { |a| a[0] }.each do |field, option| next unless current_resource.send(field) != new_resource.send(field) next unless new_resource.send(field) + opts << option opts << new_resource.send(field) logger.trace("#{new_resource} set #{field} to #{new_resource.send(field)}") diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb index 79a774a4c3..b4e93580ff 100644 --- a/lib/chef/provider/group/usermod.rb +++ b/lib/chef/provider/group/usermod.rb @@ -59,6 +59,7 @@ class Chef unless new_resource.action.include?(:create) raise Chef::Exceptions::UnsupportedAction, "Setting members directly is not supported by #{self}" end + members.each do |member| add_member(member) end |