summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Asuncion <jose.asuncion@gmail.com>2017-08-16 18:26:32 -0700
committerJose Asuncion <jose.asuncion@gmail.com>2017-08-16 18:27:54 -0700
commitb3eec2dc4c27bba5256b1ae42edb70cf422997ac (patch)
tree44b7c522db02af0308e1bc44479427ab5a20231c
parent61916b652b80f3e6982bac0c925b86b32b7571f6 (diff)
downloadchef-b3eec2dc4c27bba5256b1ae42edb70cf422997ac.tar.gz
initial impl for active check of chef server
Signed-off-by: Jose Asuncion <jeunito@gmail.com>
-rw-r--r--lib/chef/knife/list.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 6f314eb86d..7e19a553bc 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -104,6 +104,18 @@ class Chef
begin
children = result.children.sort_by { |child| child.name }
rescue Chef::ChefFS::FileSystem::NotFoundError => e
+ begin
+ rest.get("/clients/#{Chef::Config[:client_name]}")
+ rescue Net::HTTPServerException => e
+ if e.response.class == Net::HTTPNotFound
+ require "json"
+ begin
+ JSON.load(e.response.body())
+ rescue JSON::ParserError
+ raise Chef::Exceptions::NotAChefServerException
+ end
+ end
+ end
ui.error "#{format_path(e.entry)}: No such file or directory"
return []
end