# Knife command

**URL:** <https://discourse.chef.io/t/knife-command/5541>\
**Category:** Chef Infra (archive)\
**Created:** [July 3, 2014, 8:39am UTC](https://discourse.chef.io/t/knife-command/5541 "2014-07-03T08:39:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![idzzy](https://avatars.discourse-cdn.com/v4/letter/i/d6d6ee/32.png) [@idzzy](https://discourse.chef.io/u/idzzy)\
**Post date:** [July 3, 2014, 8:39am UTC](https://discourse.chef.io/t/knife-command/5541/1 "2014-07-03T08:39:21Z")

</div>

Hello

I’m trying to upload objects(cookbook, role…etc) from workstation to chef-server.

these knife command works: (knife OBJECT …)  
e.g)

- knife cookbook upload
- knife cookbook list
- knife node list

But these knife command does not work: (knife VERB …)

- Regarding list command,  
if use /, it works. but I don’t want to use /. How can I do it?

- Regarding upload command,  
following error is displayed. How can I fix this?

if use /, the responce is back(but no message). but the role is not uploaded to chef-server.

```
# knife role list

# knife upload /roles
# knife role list

#

```

Although I tried to move knife.rb from /root/.chef/ to /root/chef-repo/.chef/ and modify appropriate path, it was same result.

[version]  
chef-server : 11.1.0-1  
chef-client in workstation: 11.12.4

[.chef]

# ls -al /root/.chef/

-rw-------. 1 root root 1679 Jun 3 16:18 admin.pem  
drwxr-xr-x. 2 root root 4096 Jul 2 18:07 bootstrap/  
-rw-------. 1 root root 1679 Jun 3 16:18 chef-validator.pem  
-rw-r–r--. 1 root root 610 Jul 3 11:16 knife.rb  
-rw-r–r--. 1 root root 1675 Jun 3 17:55 root.pem  
drwxr-xr-x. 2 root root 12288 Jun 5 13:48 syntax\_check\_cache/

[knife.rb]

# cat /root/.chef/knife.rb

log\_level :info  
log\_location STDOUT  
node\_name 'root’  
client\_key '/root/.chef/root.pem’  
validation\_client\_name 'chef-validator’  
validation\_key '/root/.chef/chef-validator.pem’  
chef\_server\_url '[https://10.32.37.20:443](https://10.32.37.20:443)’  
syntax\_check\_cache\_path '/root/.chef/syntax\_check\_cache’  
cookbook\_path [‘/root/chef-repo/cookbooks’ ‘/root/chef-repo/site-cookbooks’]

[chef-repo]

# ls -al /root/chef-repo/

drwxr-xr-x. 8 root root 4096 Jul 2 19:34 .git/  
-rw-r–r--. 1 root root 106 Jul 2 19:34 .gitignore  
-rw-r–r--. 1 root root 77 Jul 2 19:48 Berksfile  
-rw-------. 1 root root 164 Jul 2 20:01 Berksfile.lock  
-rw-r–r--. 1 root root 10850 Jul 2 19:34 LICENSE  
-rw-r–r--. 1 root root 3510 Jul 2 19:34 [README.md](http://README.md)  
-rw-r–r--. 1 root root 2169 Jul 2 19:34 Rakefile  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 certificates/  
-rw-r–r--. 1 root root 156 Jul 2 19:34 chefignore  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 config/  
drwxr-xr-x. 6 root root 4096 Jul 2 20:01 cookbooks/  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 data\_bags/  
drwxr-xr-x. 2 root root 4096 Jul 3 10:05 environments/  
drwxr-xr-x. 2 root root 4096 Jul 3 10:05 roles/  
drwxr-xr-x. 4 root root 4096 Jul 3 10:06 site-cookbooks/

Thank you.

---

<div class="post-metadata">

**Author:** ![Eduardo\_Dias](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@Eduardo\_Dias](https://discourse.chef.io/u/Eduardo_Dias)\
**Post date:** [July 3, 2014, 5:28pm UTC](https://discourse.chef.io/t/knife-command/5541/2 "2014-07-03T17:28:53Z")

</div>

go to the folder before the cookbook folder and try:  
knife cookbook upload \<cookbook\_name\> -o .  
look that has a dot after the -o

2014-07-03 5:39 GMT-03:00 idzzy [idezebi@gmail.com](mailto:idezebi@gmail.com):

> Hello
> 
> I'm trying to upload objects(cookbook, role...etc) from workstation to  
> chef-server.
> 
> these knife command works: (knife OBJECT ...)  
> e.g)
> 
> - knife cookbook upload
> - knife cookbook list
> - knife node list
> 
> But these knife command does not work: (knife VERB ...)
> 
> - Regarding list command,  
> if use /, it works. but I don't want to use /. How can I do it?
> 
> - Regarding upload command,  
> following error is displayed. How can I fix this?
> 
> if use /, the responce is back(but no message). but the role is not  
> uploaded to chef-server.
> 
> ```
> # knife role list
> 
> # knife upload /roles
> # knife role list
> 
> #
> 
> ```
> 
> Although I tried to move knife.rb from /root/.chef/ to  
> /root/chef-repo/.chef/ and modify appropriate path, it was same result.
> 
> [version]  
> chef-server : 11.1.0-1  
> chef-client in workstation: 11.12.4
> 
> [.chef]
> 
> # ls -al /root/.chef/
> 
> -rw-------. 1 root root 1679 Jun 3 16:18  
> [http://airmail.calendar/2014-06-03%2016:18:00%20GMT+9](http://airmail.calendar/2014-06-03%2016:18:00%20GMT+9) admin.pem  
> drwxr-xr-x. 2 root root 4096 Jul 2 18:07  
> [http://airmail.calendar/2014-07-02%2018:07:00%20GMT+9](http://airmail.calendar/2014-07-02%2018:07:00%20GMT+9) bootstrap/  
> -rw-------. 1 root root 1679 Jun 3 16:18  
> [http://airmail.calendar/2014-06-03%2016:18:00%20GMT+9](http://airmail.calendar/2014-06-03%2016:18:00%20GMT+9) chef-validator.pem  
> -rw-r--r--. 1 root root 610 Jul 3 11:16  
> [http://airmail.calendar/2014-07-03%2011:16:00%20GMT+9](http://airmail.calendar/2014-07-03%2011:16:00%20GMT+9) knife.rb  
> -rw-r--r--. 1 root root 1675 Jun 3 17:55  
> [http://airmail.calendar/2014-06-03%2017:55:00%20GMT+9](http://airmail.calendar/2014-06-03%2017:55:00%20GMT+9) root.pem  
> drwxr-xr-x. 2 root root 12288 Jun 5 13:48  
> [http://airmail.calendar/2014-06-05%2013:48:00%20GMT+9](http://airmail.calendar/2014-06-05%2013:48:00%20GMT+9)  
> syntax\_check\_cache/
> 
> [knife.rb]
> 
> # cat /root/.chef/knife.rb
> 
> log\_level :info  
> log\_location STDOUT  
> node\_name 'root'  
> client\_key '/root/.chef/root.pem'  
> validation\_client\_name 'chef-validator'  
> validation\_key '/root/.chef/chef-validator.pem'  
> chef\_server\_url '[https://10.32.37.20:443](https://10.32.37.20:443)'  
> syntax\_check\_cache\_path '/root/.chef/syntax\_check\_cache'  
> cookbook\_path [ '/root/chef-repo/cookbooks'  
> '/root/chef-repo/site-cookbooks' ]
> 
> [chef-repo]
> 
> # ls -al /root/chef-repo/
> 
> drwxr-xr-x. 8 root root 4096 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) .git/  
> -rw-r--r--. 1 root root 106 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) .gitignore  
> -rw-r--r--. 1 root root 77 Jul 2  
> [http://airmail.calendar/2014-07-02%2012:00:00%20GMT+9](http://airmail.calendar/2014-07-02%2012:00:00%20GMT+9) 19:48  
> [http://airmail.calendar/2014-07-03%2019:48:00%20GMT+9](http://airmail.calendar/2014-07-03%2019:48:00%20GMT+9) Berksfile  
> -rw-------. 1 root root 164 Jul 2 20:01  
> [http://airmail.calendar/2014-07-02%2020:01:00%20GMT+9](http://airmail.calendar/2014-07-02%2020:01:00%20GMT+9) Berksfile.lock  
> -rw-r--r--. 1 root root 10850 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) LICENSE  
> -rw-r--r--. 1 root root 3510 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) README.md  
> -rw-r--r--. 1 root root 2169 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) Rakefile  
> drwxr-xr-x. 2 root root 4096 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) certificates/  
> -rw-r--r--. 1 root root 156 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) chefignore  
> drwxr-xr-x. 2 root root 4096 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) config/  
> drwxr-xr-x. 6 root root 4096 Jul 2 20:01  
> [http://airmail.calendar/2014-07-02%2020:01:00%20GMT+9](http://airmail.calendar/2014-07-02%2020:01:00%20GMT+9) cookbooks/  
> drwxr-xr-x. 2 root root 4096 Jul 2 19:34  
> [http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9](http://airmail.calendar/2014-07-02%2019:34:00%20GMT+9) data\_bags/  
> drwxr-xr-x. 2 root root 4096 Jul 3 10:05  
> [http://airmail.calendar/2014-07-03%2010:05:00%20GMT+9](http://airmail.calendar/2014-07-03%2010:05:00%20GMT+9) environments/  
> drwxr-xr-x. 2 root root 4096 Jul 3 10:05  
> [http://airmail.calendar/2014-07-03%2010:05:00%20GMT+9](http://airmail.calendar/2014-07-03%2010:05:00%20GMT+9) roles/  
> drwxr-xr-x. 4 root root 4096 Jul 3 10:06  
> [http://airmail.calendar/2014-07-03%2010:06:00%20GMT+9](http://airmail.calendar/2014-07-03%2010:06:00%20GMT+9) site-cookbooks/
> 
> Thank you.

--

Atenciosamente,

Eduardo

---

<div class="post-metadata">

**Author:** ![idzzy](https://avatars.discourse-cdn.com/v4/letter/i/d6d6ee/32.png) [@idzzy](https://discourse.chef.io/u/idzzy)\
**Post date:** [July 4, 2014, 12:46am UTC](https://discourse.chef.io/t/knife-command/5541/3 "2014-07-04T00:46:22Z")

</div>

Hello,

“knife cookbook upload” command works.  
“knife upload” command does not work.

But I could upload by this command instead.  
"knife role from file roles/\*.json”

And after that, upload command works.  
“knife upload roles”

I’m not sure why once upload files to chef-server, upload command works.

Anyway Thank you for the reply.

Thanks.

—  
idzzy

On July 4, 2014 at 2:29:15 AM, Eduardo Dias ([eduardodiasbr@gmail.com](mailto:eduardodiasbr@gmail.com)) wrote:

go to the folder before the cookbook folder and try:  
knife cookbook upload \<cookbook\_name\> -o .  
look that has a dot after the -o

2014-07-03 5:39 GMT-03:00 idzzy [idezebi@gmail.com](mailto:idezebi@gmail.com):  
Hello

I’m trying to upload objects(cookbook, role…etc) from workstation to chef-server.

these knife command works: (knife OBJECT …)  
e.g)

- knife cookbook upload
- knife cookbook list
- knife node list

But these knife command does not work: (knife VERB …)

- Regarding list command,  
if use /, it works. but I don’t want to use /. How can I do it?

- Regarding upload command,  
following error is displayed. How can I fix this?

if use /, the responce is back(but no message). but the role is not uploaded to chef-server.

```
# knife role list

# knife upload /roles
# knife role list

#

```

Although I tried to move knife.rb from /root/.chef/ to /root/chef-repo/.chef/ and modify appropriate path, it was same result.

[version]  
chef-server : 11.1.0-1  
chef-client in workstation: 11.12.4

[.chef]

# ls -al /root/.chef/

-rw-------. 1 root root 1679 Jun 3 16:18 admin.pem  
drwxr-xr-x. 2 root root 4096 Jul 2 18:07 bootstrap/  
-rw-------. 1 root root 1679 Jun 3 16:18 chef-validator.pem  
-rw-r–r--. 1 root root 610 Jul 3 11:16 knife.rb  
-rw-r–r--. 1 root root 1675 Jun 3 17:55 root.pem  
drwxr-xr-x. 2 root root 12288 Jun 5 13:48 syntax\_check\_cache/

[knife.rb]

# cat /root/.chef/knife.rb

log\_level :info  
log\_location STDOUT  
node\_name 'root’  
client\_key '/root/.chef/root.pem’  
validation\_client\_name 'chef-validator’  
validation\_key '/root/.chef/chef-validator.pem’  
chef\_server\_url '[https://10.32.37.20:443](https://10.32.37.20:443)’  
syntax\_check\_cache\_path '/root/.chef/syntax\_check\_cache’  
cookbook\_path [‘/root/chef-repo/cookbooks’ ‘/root/chef-repo/site-cookbooks’]

[chef-repo]

# ls -al /root/chef-repo/

drwxr-xr-x. 8 root root 4096 Jul 2 19:34 .git/  
-rw-r–r--. 1 root root 106 Jul 2 19:34 .gitignore  
-rw-r–r--. 1 root root 77 Jul 2 19:48 Berksfile  
-rw-------. 1 root root 164 Jul 2 20:01 Berksfile.lock  
-rw-r–r--. 1 root root 10850 Jul 2 19:34 LICENSE  
-rw-r–r--. 1 root root 3510 Jul 2 19:34 [README.md](http://README.md)  
-rw-r–r--. 1 root root 2169 Jul 2 19:34 Rakefile  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 certificates/  
-rw-r–r--. 1 root root 156 Jul 2 19:34 chefignore  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 config/  
drwxr-xr-x. 6 root root 4096 Jul 2 20:01 cookbooks/  
drwxr-xr-x. 2 root root 4096 Jul 2 19:34 data\_bags/  
drwxr-xr-x. 2 root root 4096 Jul 3 10:05 environments/  
drwxr-xr-x. 2 root root 4096 Jul 3 10:05 roles/  
drwxr-xr-x. 4 root root 4096 Jul 3 10:06 site-cookbooks/

Thank you.

–

Atenciosamente,

Eduardo
