summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application/exit_code.rb9
-rw-r--r--lib/chef/exceptions.rb1
-rw-r--r--lib/chef/knife/ssh.rb1
-rw-r--r--lib/chef/provider/user.rb10
-rw-r--r--lib/chef/provider/user/dscl.rb4
-rw-r--r--lib/chef/provider/user/linux.rb18
-rw-r--r--lib/chef/provider/user/pw.rb4
-rw-r--r--lib/chef/provider/user/useradd.rb6
-rw-r--r--lib/chef/version.rb2
9 files changed, 31 insertions, 24 deletions
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb
index 753f1a0d80..6fec2524dd 100644
--- a/lib/chef/application/exit_code.rb
+++ b/lib/chef/application/exit_code.rb
@@ -35,6 +35,7 @@ class Chef
REBOOT_NEEDED: 37,
REBOOT_FAILED: 41,
AUDIT_MODE_FAILURE: 42,
+ CLIENT_UPGRADED: 213,
}
DEPRECATED_RFC_062_EXIT_CODES = {
@@ -127,6 +128,8 @@ class Chef
VALID_RFC_062_EXIT_CODES[:REBOOT_FAILED]
elsif audit_failure?(exception)
VALID_RFC_062_EXIT_CODES[:AUDIT_MODE_FAILURE]
+ elsif client_upgraded?(exception)
+ VALID_RFC_062_EXIT_CODES[:CLIENT_UPGRADED]
else
VALID_RFC_062_EXIT_CODES[:GENERIC_FAILURE]
end
@@ -162,6 +165,12 @@ class Chef
end
end
+ def client_upgraded?(exception)
+ resolve_exception_array(exception).any? do |e|
+ e.is_a? Chef::Exceptions::ClientUpgraded
+ end
+ end
+
def sigint_received?(exception)
resolve_exception_array(exception).any? do |e|
e.is_a? Chef::Exceptions::SigInt
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index ea779754e2..7126323ff7 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -79,6 +79,7 @@ class Chef
class Reboot < Exception; end
class RebootPending < Exception; end
class RebootFailed < Mixlib::ShellOut::ShellCommandFailed; end
+ class ClientUpgraded < Exception; end
class PrivateKeyMissing < RuntimeError; end
class CannotWritePrivateKey < RuntimeError; end
class RoleNotFound < RuntimeError; end
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 6f266b2719..f827aca280 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -541,6 +541,7 @@ class Chef
configure_user
configure_password
+ @password = config[:ssh_password] if config[:ssh_password]
configure_ssh_identity_file
configure_gateway
configure_session
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index 2bc4cc10bc..f6b088d333 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -210,6 +210,16 @@ class Chef
def check_lock
raise NotImplementedError
end
+
+ def non_unique?
+ # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.non_unique
+ new_resource.non_unique || new_resource.supports[:non_unique]
+ end
+
+ def managing_home_dir?
+ # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.manage_home
+ new_resource.manage_home || new_resource.supports[:manage_home]
+ end
end
end
end
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 821fa8e8a7..01203c0d9f 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -292,7 +292,7 @@ user password using shadow hash.")
return
end
- if new_resource.supports[:manage_home]
+ if managing_home_dir?
validate_home_dir_specification!
if (current_resource.home == new_resource.home) && !new_home_exists?
@@ -438,7 +438,7 @@ user password using shadow hash.")
# and deleting home directory if needed.
#
def remove_user
- if new_resource.supports[:manage_home]
+ if managing_home_dir?
# Remove home directory
FileUtils.rm_rf(current_resource.home)
end
diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb
index 4a2491d806..968cf771e4 100644
--- a/lib/chef/provider/user/linux.rb
+++ b/lib/chef/provider/user/linux.rb
@@ -52,14 +52,14 @@ class Chef
opts << "-s" << new_resource.shell if should_set?(:shell)
opts << "-u" << new_resource.uid if should_set?(:uid)
opts << "-d" << new_resource.home if updating_home?
- opts << "-o" if non_unique
+ opts << "-o" if non_unique?
opts
end
def usermod_options
opts = []
if updating_home?
- if manage_home
+ if managing_home_dir?
opts << "-m"
end
end
@@ -69,7 +69,7 @@ class Chef
def useradd_options
opts = []
opts << "-r" if new_resource.system
- if manage_home
+ if managing_home_dir?
opts << "-m"
else
opts << "-M"
@@ -79,7 +79,7 @@ class Chef
def userdel_options
opts = []
- opts << "-r" if manage_home
+ opts << "-r" if managing_home_dir?
opts << "-f" if new_resource.force
opts
end
@@ -122,16 +122,6 @@ class Chef
# FIXME: should probably go on the current_resource
@locked
end
-
- def non_unique
- # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.non_unique
- new_resource.non_unique || new_resource.supports[:non_unique]
- end
-
- def manage_home
- # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.manage_home
- new_resource.manage_home || new_resource.supports[:manage_home]
- end
end
end
end
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index a1d7671c28..b210374eb9 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -46,7 +46,7 @@ class Chef
def remove_user
command = "pw userdel #{@new_resource.username}"
- command << " -r" if @new_resource.supports[:manage_home]
+ command << " -r" if managing_home_dir?
run_command(:command => command)
end
@@ -87,7 +87,7 @@ class Chef
end
end
end
- if @new_resource.supports[:manage_home]
+ if managing_home_dir?
Chef::Log.debug("#{@new_resource} is managing the users home directory")
opts << " -m"
end
diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb
index 68b62812a7..35a106b0b6 100644
--- a/lib/chef/provider/user/useradd.rb
+++ b/lib/chef/provider/user/useradd.rb
@@ -124,7 +124,7 @@ class Chef
Chef::Log.debug("#{new_resource} setting home to #{new_resource.home}")
end
end
- opts << "-o" if new_resource.non_unique
+ opts << "-o" if non_unique?
opts
end
end
@@ -154,10 +154,6 @@ class Chef
new_resource.home && Pathname.new(@current_resource.home).cleanpath != Pathname.new(new_resource.home).cleanpath
end
- def managing_home_dir?
- new_resource.manage_home || new_resource.supports[:manage_home]
- end
-
end
end
end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index bb3cdfe80c..fa2afd7074 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -21,7 +21,7 @@
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "12.15.14"
+ VERSION = "12.15.21"
end
#