knife list when excuted from chef-workstation does not list my chef-server

Hi I have installed the chef server with the below commands.

#!/bin/bash

set -x

sudo yum update -y
sudo yum install firewalld -y
sudo systemctl status firewalld
sudo systemctl start firewalld
sudo systemctl status firewalld
sudo yum install git -y
sudo firewall-cmd --add-port=443/tcp --permanent
sudo firewall-cmd --reload
cd /tmp
wget  https://packages.chef.io/files/stable/chef-server/13.2.0/el/7/chef-server-core-13.2.0-1.el7.x86_64.rpm
sudo rpm -Uvh chef-server-core-13.2.0-1.el7.x86_64.rpm
sudo chef-server-ctl reconfigure  --chef-license=accept
sudo chef-server-ctl user-create tuser Test User testuser@yahoo.com 'Test1234' --filename /home/ec2-user/tuser.pem
sudo chef-server-ctl org-create testdemo 'Test Demo Inc' --association_user tuser --filename /home/ec2-user/testdemo.pem
wget  https://packages.chef.io/files/stable/chef-manage/2.5.16/el/7/chef-manage-2.5.16-1.el7.x86_64.rpm
sudo rpm -Uvh chef-manage-2.5.16-1.el7.x86_64.rpm
sudo chef-server-ctl reconfigure  --chef-license=accept
sudo chef-manage-ctl reconfigure --accept-license
sudo chef-server-ctl service-list

At NSG, I have allowed port 443 from anywhere. However, I want to create a simple EC2 instance from my workstation, obviously with chef-server, to do so. When I do **knife list**, I get error message below

ERROR: CONFIGURATION ERROR:You have invalid ruby syntax in your config file c:/Users/hp/.chef/config.rb

       SyntaxError: c:/Users/hp/.chef/config.rb:7: unterminated string meets end of file
       c:/Users/hp/.chef/config.rb:7: syntax error, unexpected end-of-input, expecting ']'
       Relevant file content:
         6:   'c:\Users\hp\chef-repo\'
         7: ]

My C:\users\hp.chef\config.rb is as below:

chef_server_url 'https://52.23.248.110/organizations/testdemo'
chef_zero.enabled true
#chef_zero[:port] 8889
client_key '/etc/chef/client.pem'
cookbook_path [
  'c:\Users\hp\chef-repo\'
]

Note client_key is pointing to pem file and I have two pem files, 1 user pem file and another is organization pem file. Which one chould client_key point to? and how to have this error resolved?

Note:

  1. Chef Work station is Windows 10 Laptop

  2. Chef Server is on AWS

  3. Want to provision an ec2 and bootstrap with some basic software as part of POC

Changing this to 'c:\\Users\\hp\\chef-repo\\' should get past the syntax error. The backslashes are interpreted as escape characters, so you have to escape the escapes.

1 Like

Yep, works fine now. Thanks for your help.