summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/user/aix.rb5
-rw-r--r--lib/chef/provider/user/dscl.rb1
-rw-r--r--lib/chef/provider/user/linux.rb33
-rw-r--r--lib/chef/provider/user/pw.rb3
-rw-r--r--lib/chef/provider/user/solaris.rb3
-rw-r--r--lib/chef/provider/user/useradd.rb9
-rw-r--r--lib/chef/provider/user/windows.rb2
-rw-r--r--lib/chef/providers.rb5
-rw-r--r--lib/chef/resource/user.rb6
-rw-r--r--lib/chef/resource/user/aix_user.rb31
-rw-r--r--lib/chef/resource/user/dscl_user.rb31
-rw-r--r--lib/chef/resource/user/linux_user.rb52
-rw-r--r--lib/chef/resource/user/pw_user.rb31
-rw-r--r--lib/chef/resource/user/solaris_user.rb31
-rw-r--r--lib/chef/resource/user/windows_user.rb31
-rw-r--r--lib/chef/resources.rb6
16 files changed, 13 insertions, 267 deletions
diff --git a/lib/chef/provider/user/aix.rb b/lib/chef/provider/user/aix.rb
index 8ac229ae4d..befb6ac3fd 100644
--- a/lib/chef/provider/user/aix.rb
+++ b/lib/chef/provider/user/aix.rb
@@ -14,14 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "chef/provider/user/useradd"
-
class Chef
class Provider
class User
class Aix < Chef::Provider::User::Useradd
- provides :user, os: "aix"
- provides :aix_user
+ provides :user, platform: %w{aix}
UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]]
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 821fa8e8a7..e933bf9dc0 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -48,7 +48,6 @@ class Chef
attr_accessor :authentication_authority
attr_accessor :password_shadow_conversion_algorithm
- provides :dscl_user
provides :user, os: "darwin"
def define_resource_requirements
diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb
deleted file mode 100644
index ca331311f1..0000000000
--- a/lib/chef/provider/user/linux.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-require "chef/provider/user/useradd"
-
-class Chef
- class Provider
- class User
- class Linux < Chef::Provider::User::Useradd
- # MAJOR XXX: the implementation of "linux" is the base class and all needs to be moved here
- provides :linux_user
- provides :user, os: "linux"
-
- def managing_home_dir?
- new_resource.manage_home # linux always 'supports' manage_home
- end
- end
- end
- end
-end
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index a1d7671c28..949a21790b 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -22,8 +22,7 @@ class Chef
class Provider
class User
class Pw < Chef::Provider::User
- provides :pw_user
- provides :user, os: "freebsd"
+ provides :user, platform: %w{freebsd}
def load_current_resource
super
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb
index 8d3df9e68b..83ee8346a9 100644
--- a/lib/chef/provider/user/solaris.rb
+++ b/lib/chef/provider/user/solaris.rb
@@ -24,8 +24,7 @@ class Chef
class Provider
class User
class Solaris < Chef::Provider::User::Useradd
- provides :solaris_user
- provides :user, os: %w{omnios solaris2}
+ provides :user, platform: %w{omnios solaris2}
UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]]
attr_writer :password_file
diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb
index 68b62812a7..3fef8d3642 100644
--- a/lib/chef/provider/user/useradd.rb
+++ b/lib/chef/provider/user/useradd.rb
@@ -23,7 +23,7 @@ class Chef
class Provider
class User
class Useradd < Chef::Provider::User
- # MAJOR XXX: this should become the base class of all Useradd providers instead of the linux implementation
+ provides :user
UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:password, "-p"], [:shell, "-s"], [:uid, "-u"]]
@@ -116,15 +116,15 @@ class Chef
update_options(field, option, opts)
end
if updating_home?
- opts << "-d" << new_resource.home
if managing_home_dir?
Chef::Log.debug("#{new_resource} managing the users home directory")
- opts << "-m"
+ opts << "-d" << new_resource.home << "-m"
else
Chef::Log.debug("#{new_resource} setting home to #{new_resource.home}")
+ opts << "-d" << new_resource.home
end
end
- opts << "-o" if new_resource.non_unique
+ opts << "-o" if new_resource.non_unique || new_resource.supports[:non_unique]
opts
end
end
@@ -141,7 +141,6 @@ class Chef
def useradd_options
opts = []
opts << "-r" if new_resource.system
- opts << "-M" unless managing_home_dir?
opts
end
diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb
index b086a1e32b..9545b1fd59 100644
--- a/lib/chef/provider/user/windows.rb
+++ b/lib/chef/provider/user/windows.rb
@@ -26,7 +26,7 @@ class Chef
class Provider
class User
class Windows < Chef::Provider::User
- provides :windows_user
+
provides :user, os: "windows"
def initialize(new_resource, run_context)
diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb
index 9e2a914b71..14c47df939 100644
--- a/lib/chef/providers.rb
+++ b/lib/chef/providers.rb
@@ -101,13 +101,12 @@ require "chef/provider/service/macosx"
require "chef/provider/service/aixinit"
require "chef/provider/service/aix"
-require "chef/provider/user/aix"
require "chef/provider/user/dscl"
-require "chef/provider/user/linux"
require "chef/provider/user/pw"
-require "chef/provider/user/solaris"
require "chef/provider/user/useradd"
require "chef/provider/user/windows"
+require "chef/provider/user/solaris"
+require "chef/provider/user/aix"
require "chef/provider/group/aix"
require "chef/provider/group/dscl"
diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb
index a07ce8b24b..012fa278f1 100644
--- a/lib/chef/resource/user.rb
+++ b/lib/chef/resource/user.rb
@@ -21,7 +21,6 @@ require "chef/resource"
class Chef
class Resource
class User < Chef::Resource
- resource_name :user_resource_abstract_base_class # this prevents magickal class name DSL wiring
identity_attr :username
state_attrs :uid, :gid, :home
@@ -43,8 +42,8 @@ class Chef
@force = false
@non_unique = false
@supports = {
- manage_home: false,
- non_unique: false,
+ :manage_home => false,
+ :non_unique => false,
}
@iterations = 27855
@salt = nil
@@ -155,6 +154,7 @@ class Chef
:kind_of => [ TrueClass, FalseClass ]
)
end
+
end
end
end
diff --git a/lib/chef/resource/user/aix_user.rb b/lib/chef/resource/user/aix_user.rb
deleted file mode 100644
index 7c07db2e25..0000000000
--- a/lib/chef/resource/user/aix_user.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class AixUser < Chef::Resource::User
- resource_name :aix_user
-
- provides :aix_user
- provides :user, os: "aix"
- end
- end
- end
-end
diff --git a/lib/chef/resource/user/dscl_user.rb b/lib/chef/resource/user/dscl_user.rb
deleted file mode 100644
index 61517d8b44..0000000000
--- a/lib/chef/resource/user/dscl_user.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class DsclUser < Chef::Resource::User
- resource_name :dscl_user
-
- provides :dscl_user
- provides :user, os: "darwin"
- end
- end
- end
-end
diff --git a/lib/chef/resource/user/linux_user.rb b/lib/chef/resource/user/linux_user.rb
deleted file mode 100644
index 3452459e39..0000000000
--- a/lib/chef/resource/user/linux_user.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class LinuxUser < Chef::Resource::User
- resource_name :linux_user
-
- provides :linux_user
- provides :user, os: "linux"
-
- def initialize(name, run_context = nil)
- super
- @supports = {
- manage_home: true,
- non_unique: true,
- }
- @manage_home = true
- end
-
- def supports(args = {})
- Chef.log_deprecation "setting supports on the linux_user resource is deprecated"
- # setting is deliberately disabled
- super({})
- end
-
- def supports=(args)
- Chef.log_deprecation "setting supports on the linux_user resource is deprecated"
- # setting is deliberately disabled
- supports({})
- end
- end
- end
- end
-end
diff --git a/lib/chef/resource/user/pw_user.rb b/lib/chef/resource/user/pw_user.rb
deleted file mode 100644
index 873be19d59..0000000000
--- a/lib/chef/resource/user/pw_user.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class PwUser < Chef::Resource::User
- resource_name :pw_user
-
- provides :pw_user
- provides :user, os: "freebsd"
- end
- end
- end
-end
diff --git a/lib/chef/resource/user/solaris_user.rb b/lib/chef/resource/user/solaris_user.rb
deleted file mode 100644
index bb897228b9..0000000000
--- a/lib/chef/resource/user/solaris_user.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class SolarisUser < Chef::Resource::User
- resource_name :solaris_user
-
- provides :solaris_user
- provides :user, os: %w{omnios solaris2}
- end
- end
- end
-end
diff --git a/lib/chef/resource/user/windows_user.rb b/lib/chef/resource/user/windows_user.rb
deleted file mode 100644
index d1a249fb50..0000000000
--- a/lib/chef/resource/user/windows_user.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright:: Copyright 2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "chef/resource/user"
-
-class Chef
- class Resource
- class User
- class WindowsUser < Chef::Resource::User
- resource_name :windows_user
-
- provides :windows_user
- provides :user, os: "windows"
- end
- end
- end
-end
diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb
index 0e73264832..af9c918f55 100644
--- a/lib/chef/resources.rb
+++ b/lib/chef/resources.rb
@@ -82,12 +82,6 @@ require "chef/resource/smartos_package"
require "chef/resource/template"
require "chef/resource/timestamped_deploy"
require "chef/resource/user"
-require "chef/resource/user/aix_user"
-require "chef/resource/user/dscl_user"
-require "chef/resource/user/linux_user"
-require "chef/resource/user/pw_user"
-require "chef/resource/user/solaris_user"
-require "chef/resource/user/windows_user"
require "chef/resource/whyrun_safe_ruby_block"
require "chef/resource/windows_package"
require "chef/resource/yum_package"