summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-02-25 13:57:19 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2020-02-25 14:45:27 -0800
commitc617c753a317db947ac505857da721a3f2feebde (patch)
tree24945411b203706f0c21f8fe052c5e1ae2101972
parentaa30467a340c7d195fd92d64834e1f4defeb3b3a (diff)
downloadchef-lcg/unified-mode3.tar.gz
convert move resources to unified_modelcg/unified-mode3
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/user.rb14
-rw-r--r--lib/chef/provider/user/dscl.rb2
-rw-r--r--lib/chef/provider/user/mac.rb20
-rw-r--r--lib/chef/resource/ohai_hint.rb2
-rw-r--r--lib/chef/resource/pacman_package.rb2
-rw-r--r--lib/chef/resource/paludis_package.rb4
-rw-r--r--lib/chef/resource/portage_package.rb4
-rw-r--r--lib/chef/resource/smartos_package.rb4
-rw-r--r--lib/chef/resource/snap_package.rb4
-rw-r--r--lib/chef/resource/solaris_package.rb4
-rw-r--r--lib/chef/resource/swap_file.rb6
-rw-r--r--lib/chef/resource/user/dscl_user.rb4
-rw-r--r--lib/chef/resource/user/linux_user.rb2
-rw-r--r--lib/chef/resource/user/mac_user.rb2
14 files changed, 47 insertions, 27 deletions
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index 8c99e36dfc..481de6e4cb 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2018, Chef Software Inc.
+# Copyright:: Copyright 2008-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -116,7 +116,7 @@ class Chef
false
end
- def action_create
+ action :create do
if !@user_exists
converge_by("create user #{new_resource.username}") do
create_user
@@ -130,7 +130,7 @@ class Chef
end
end
- def action_remove
+ action :remove do
return unless @user_exists
converge_by("remove user #{new_resource.username}") do
@@ -139,7 +139,7 @@ class Chef
end
end
- def action_manage
+ action :manage do
return unless @user_exists && compare_user
converge_by("manage user #{new_resource.username}") do
@@ -148,7 +148,7 @@ class Chef
end
end
- def action_modify
+ action :modify do
return unless compare_user
converge_by("modify user #{new_resource.username}") do
@@ -157,7 +157,7 @@ class Chef
end
end
- def action_lock
+ action :lock do
if check_lock == false
converge_by("lock the user #{new_resource.username}") do
lock_user
@@ -168,7 +168,7 @@ class Chef
end
end
- def action_unlock
+ action :unlock do
if check_lock == true
converge_by("unlock user #{new_resource.username}") do
unlock_user
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 027f9eba38..687fc021da 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -1,6 +1,6 @@
#
# Author:: Dreamcat4 (<dreamcat4@gmail.com>)
-# Copyright:: Copyright 2009-2019, Chef Software Inc.
+# Copyright:: Copyright 2009-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/lib/chef/provider/user/mac.rb b/lib/chef/provider/user/mac.rb
index c570399ca3..fb220b2128 100644
--- a/lib/chef/provider/user/mac.rb
+++ b/lib/chef/provider/user/mac.rb
@@ -1,6 +1,6 @@
#
# Author:: Ryan Cragun (<ryan@chef.io>)
-# Copyright:: Copyright (c) 2019-2019, Chef Software Inc.
+# Copyright:: Copyright (c) 2019-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -196,12 +196,12 @@ class Chef
# group magement should be done outside of the core resource.
group_name, group_id, group_action = user_group_info
- declare_resource(:group, group_name) do
+ group group_name do
members new_resource.username
gid group_id if group_id
- action :nothing
+ action group_action
append true
- end.run_action(group_action)
+ end
converge_by("create primary group ID") do
run_dscl("create", "/Users/#{new_resource.username}", "PrimaryGroupID", group_id)
@@ -246,16 +246,16 @@ class Chef
if diverged?(:admin)
converge_by("alter admin group membership") do
- declare_resource(:group, "admin") do
+ group "admin" do
if new_resource.admin
members new_resource.username
else
excluded_members new_resource.username
end
- action :nothing
+ action :create
append true
- end.run_action(:create)
+ end
admins = admin_group_plist[:group_members]
if new_resource.admin
@@ -271,12 +271,12 @@ class Chef
end
group_name, group_id, group_action = user_group_info
- declare_resource(:group, group_name) do
+ group group_name do
gid group_id if group_id
members new_resource.username
- action :nothing
+ action group_action
append true
- end.run_action(group_action)
+ end
if diverged?(:gid)
converge_by("alter group membership") do
diff --git a/lib/chef/resource/ohai_hint.rb b/lib/chef/resource/ohai_hint.rb
index a2f06acaac..bf3c344cb0 100644
--- a/lib/chef/resource/ohai_hint.rb
+++ b/lib/chef/resource/ohai_hint.rb
@@ -20,6 +20,8 @@ require_relative "../resource"
class Chef
class Resource
class OhaiHint < Chef::Resource
+ unified_mode true
+
resource_name :ohai_hint
provides(:ohai_hint) { true }
diff --git a/lib/chef/resource/pacman_package.rb b/lib/chef/resource/pacman_package.rb
index 71177a42aa..79627cd3ae 100644
--- a/lib/chef/resource/pacman_package.rb
+++ b/lib/chef/resource/pacman_package.rb
@@ -21,6 +21,8 @@ require_relative "package"
class Chef
class Resource
class PacmanPackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :pacman_package
provides :pacman_package
diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb
index 94b73ab570..ee439b7e4e 100644
--- a/lib/chef/resource/paludis_package.rb
+++ b/lib/chef/resource/paludis_package.rb
@@ -1,6 +1,6 @@
#
# Author:: Vasiliy Tolstov (<v.tolstov@selfip.ru>)
-# Copyright:: Copyright 2014-2018, Chef Software Inc.
+# Copyright:: Copyright 2014-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +22,8 @@ require_relative "../provider/package/paludis"
class Chef
class Resource
class PaludisPackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :paludis_package
provides :paludis_package
diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb
index b7b434804b..ab79e9c789 100644
--- a/lib/chef/resource/portage_package.rb
+++ b/lib/chef/resource/portage_package.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2018, Chef Software Inc.
+# Copyright:: Copyright 2008-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@ require_relative "package"
class Chef
class Resource
class PortagePackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :portage_package
provides :portage_package
diff --git a/lib/chef/resource/smartos_package.rb b/lib/chef/resource/smartos_package.rb
index 510e1ccc7b..10ef027ef9 100644
--- a/lib/chef/resource/smartos_package.rb
+++ b/lib/chef/resource/smartos_package.rb
@@ -1,6 +1,6 @@
#
# Author:: Toomas Pelberg (<toomasp@gmx.net>)
-# Copyright:: Copyright 2010-2016, Chef Software Inc.
+# Copyright:: Copyright 2010-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@ require_relative "package"
class Chef
class Resource
class SmartosPackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :smartos_package
provides :smartos_package
provides :package, platform_family: "smartos"
diff --git a/lib/chef/resource/snap_package.rb b/lib/chef/resource/snap_package.rb
index 8fb6b61c2c..263ab0161b 100644
--- a/lib/chef/resource/snap_package.rb
+++ b/lib/chef/resource/snap_package.rb
@@ -1,6 +1,6 @@
#
# Author:: S.Cavallo (<smcavallo@hotmail.com>)
-# Copyright:: Copyright 2008-2018, Chef Software Inc.
+# Copyright:: Copyright 2008-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@ require_relative "package"
class Chef
class Resource
class SnapPackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :snap_package
description "Use the snap_package resource to manage snap packages on Debian and Ubuntu platforms."
diff --git a/lib/chef/resource/solaris_package.rb b/lib/chef/resource/solaris_package.rb
index c6cda0ef36..8cade4abba 100644
--- a/lib/chef/resource/solaris_package.rb
+++ b/lib/chef/resource/solaris_package.rb
@@ -1,7 +1,7 @@
#
# Author:: Toomas Pelberg (<toomasp@gmx.net>)
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
-# Copyright:: Copyright 2013-2018, Chef Software Inc.
+# Copyright:: Copyright 2013-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +22,8 @@ require_relative "package"
class Chef
class Resource
class SolarisPackage < Chef::Resource::Package
+ unified_mode true
+
resource_name :solaris_package
provides :solaris_package
provides :package, os: "solaris2", platform_family: "nexentacore"
diff --git a/lib/chef/resource/swap_file.rb b/lib/chef/resource/swap_file.rb
index 2efe040c47..a2838c5be7 100644
--- a/lib/chef/resource/swap_file.rb
+++ b/lib/chef/resource/swap_file.rb
@@ -1,6 +1,6 @@
#
# Copyright 2012-2018, Seth Vargo
-# Copyright 2017-2018, Chef Software, Inc.
+# Copyright 2017-2020, Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@ require_relative "../resource"
class Chef
class Resource
class SwapFile < Chef::Resource
+ unified_mode true
+
resource_name :swap_file
provides(:swap_file) { true }
@@ -60,7 +62,7 @@ class Chef
end
end
if new_resource.swappiness
- declare_resource(:sysctl, "vm.swappiness") do
+ sysctl "vm.swappiness" do
value new_resource.swappiness
end
end
diff --git a/lib/chef/resource/user/dscl_user.rb b/lib/chef/resource/user/dscl_user.rb
index 5ba9d3d099..34d8a4180c 100644
--- a/lib/chef/resource/user/dscl_user.rb
+++ b/lib/chef/resource/user/dscl_user.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2016-2017, Chef Software Inc.
+# Copyright:: Copyright 2016-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@ class Chef
class Resource
class User
class DsclUser < Chef::Resource::User
+ unified_mode true
+
resource_name :dscl_user
provides :dscl_user
diff --git a/lib/chef/resource/user/linux_user.rb b/lib/chef/resource/user/linux_user.rb
index 9ec6480035..4f3622213d 100644
--- a/lib/chef/resource/user/linux_user.rb
+++ b/lib/chef/resource/user/linux_user.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2016-2017, Chef Software Inc.
+# Copyright:: Copyright 2016-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/lib/chef/resource/user/mac_user.rb b/lib/chef/resource/user/mac_user.rb
index 6f40287951..62245f8df1 100644
--- a/lib/chef/resource/user/mac_user.rb
+++ b/lib/chef/resource/user/mac_user.rb
@@ -58,6 +58,8 @@ class Chef
# the 'password' property corresponds to a plaintext password and will
# attempt to use it in place of secure_token_password if it not set.
class MacUser < Chef::Resource::User
+ unified_mode true
+
resource_name :mac_user
provides :mac_user