Ok, so this started because I was trying to get auto-scaled nodes to self register with Chef. I had the following in my client.rb
file:
node_name "some_prefix-#{`hostname`}"
the idea was that each node would have the same prefix but a hostname based suffix. Sadly, hostname
returns a string with a \n
on the end of it. Chef happily let me create this client, but it is unable to actually access it in any way.
knife client show some_prefix-myHostname
knife client show "some_prefix-myHostname\n"
knife client show "some_prefix-myHostname%0A"
all three result in a 404
knife client list
does show the client, and a blank newline after it.
I have fixed my client.rb template, but I can't get rid of the nodes I created with the newline in their names. I've tried using knife, the webui, and even manually using the Chef::REST library in irb, but everything results in a 404.
Any ideas?
EDIT:
I have also tried knife client bulk delete
but that fails as well. It appears that the REST library sanitizes the url and removes the newline before attempting to send the request.
You can try using knife raw which lets you send requests directly to the Chef Server API
knife raw /nodes/<node-name>
knife raw delete -m /nodes/<node-name>
This worked for me on a similar issue with an invalid role name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With