Cookbook upload failing with 404


#1

Hi, i try to upload a cookbook to our chef server, but with no success.
I've installed the chef server, reconfigured it, created the organization and user. As next I installed chefdk on my workstation and created a cookbook. I created the knife.rb, downloaded the pem files, but while upload of cookbooks I get following message:

ERROR: The object you are looking for could not be found
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="/css/all.css" />
  <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="/css/lt7.css" /><![endif]-->
</head>
<body>
  <div class="header-block">
    <div id="header">
      <strong class="logo"><a href="https://www.chef.io">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>


chef-server-ctl responses with:
10.21.248.66 - - [06/Sep/2018:17:12:03 +0200] "GET 
/cookbooks?num_versions=all HTTP/1.1" 404 "0.001" 558 "-" "Chef 
Knife/14.2.0 (ruby-2.5.1-p57; ohai-14.2.0; x86_64-linux; 
+https://chef.io)" "-" "-" "-" "14.2.0" "algorithm=sha1;version=1.1;" 
"some_user" "2018-09-06T15:12:03Z" "some_string" 1033

We are running our Chef Server on Ubuntu 16.04. My Chef-workstation is running on Ubuntu 18.04

Anyone idea what is going wrong?


#2

Can you post what command you are actually running to attempt an upload?


#3

The command I am running is:
knife upload cookbook test-cookbook.

But few second ago just solved the problem. My problem was my knife.rb in ~/.chef and not specified config file.
I had to add organisation in the url like https://chef-server/organisation/my-org and call the knife command mit "-c /path/to/config".

Thanks for quick reply anyway. Can you tell me, where can I store informations about knife, like default knife.rb?


#4

I actually use the config.rb to store my configurations, since it is a replacement for knife.rb and all the settings in knife.rb work the same.
https://docs.chef.io/config_rb.html

If you are using the default ~/.chef location it should automatically find it since knife runs through several default paths.
pulled from "https://docs.chef.io/knife_setup.html"
The config.rb file is loaded every time the knife command is invoked using the following load order:

  • From a specified location given the --config flag
  • From a config.rb file within a .chef directory in the current working directory ex: ./.chef/config.rb
  • From a config.rb file within a .chef directory located one directory above the current working directory: ex: ../.chef/config.rb
  • From ~/.chef/config.rb (macOS and Linux platforms) or c:\Users\<username>\.chef (Microsoft Windows platform)