chef - knife utility fails - 404 not found


Keywords:chef 


Question: 

I have chef server (12) installed on a redhat 7.3 server and ran the chef-server-ctl user-create USERNAME FIRST_NAME LAST_NAME EMAIL PASSWORD and chef-server org-create commands, which also generated the required pem files.

I then installed the chefdk (output of chef --version below) chef --version Chef Development Kit Version: 2.4.17 chef-client version: 13.6.4 delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks version: 6.3.1 kitchen version: 1.19.2 inspec version: 1.45.13

Went on to create an app using chef generate app chef-repo This created the chef-repo folder and the sub-folders in it. I then went ahead and created the .chef folder and created a knife.rb file under the .chef folder Here are the contents of the knife.rb file:

cat .chef/knife.rb

current_dir = File.dirname(__FILE__)
log_level                :debug
log_location             STDOUT
node_name                "daddepalli"
client_key               "#{current_dir}/daddepalli.pem"
validation_client_name   "XXX"
validation_key           "#{current_dir}/XXX.pem"
chef_server_url          "https://rhel73-chef-srv12.XXX.com/organizations/RMT"
syntax_check_cache_path  "#{ENV['HOME']}/.chef/syntaxcache"
cookbook_path            ["#{current_dir}/../cookbooks"]

knife ssl check checks out successfully

knife ssl check Connecting to host rhel73-chef-srv12.RMT.com:443 Successfully verified certificates from `rhel73-chef-srv12.RMT.com'

but when I run knife client list, I get the following error:

Response: <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <title>Chef - 404 Not Found</title>
  <link media="all" rel="stylesheet" type="text/css" href="" />
  <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="" /><![endif]-->
</head>
<body>
  <div class="header-block">
    <div id="header">
      <strong class="logo"><a href="">Chef</a></strong>
    </div>
  </div>
  <div id="wrapper">
    <div id="main">
      <div class="mybox">
        <div id="content">
          <h1>404 - Not Found</h1>
          <p>Sorry, I can't find what you are looking for.</p>
        </div>
      </div>
    </div>
  </div>
  <div class="footer-block">
    <div id="footer">
      <div class="mybox">
      </div>
      <div class="footer-bottom">
        <span>&copy; 2010&thinsp;&ndash;&thinsp;2017 Chef Software, Inc. All Rights Reserved</span>
      </div>
    </div>
  </div>
</body>
</html>

1 Answer: 

ok I found the issue. the issue was in the knife.rb file. the organization I created was rmt while I had RMT in the chef_server_url attribute. Once I fixed that, it showed my client list.