diff options
author | Jose Asuncion <jose.asuncion@gmail.com> | 2017-08-16 18:26:32 -0700 |
---|---|---|
committer | Jose Asuncion <jose.asuncion@gmail.com> | 2017-08-16 18:27:54 -0700 |
commit | b3eec2dc4c27bba5256b1ae42edb70cf422997ac (patch) | |
tree | 44b7c522db02af0308e1bc44479427ab5a20231c | |
parent | 61916b652b80f3e6982bac0c925b86b32b7571f6 (diff) | |
download | chef-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.rb | 12 |
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 |