This repository was archived by the owner on May 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Unhelpful/Erroneous error on bad node search #78
Copy link
Copy link
Open
Description
My Environment:
- Windows
- Python 3.6.2
- PyChef 0.3.0
Issue:
Erroneous "unauthorized" error message if the node hostname is in the wrong format.
Good Example (No erroneous space in front of hostname):
hostname = "hostname"
api = chef.ChefAPI.from_config_file("E:\\path\\to\\knife\\file")
node = chef.Node(hostname)
Good Result:
Comes back with node information if the node exists in Chef.
Bad Example (Erroneous space in front of hostname):
hostname = " hostname"
api = chef.ChefAPI.from_config_file("E:\\path\\to\\knife\\file")
node = chef.Node(hostname)
Bad Result:
Traceback (most recent call last):
File "e:/chef/validate_host.py", line 33, in <module>
node = chef.Node(hostname)
File "C:\Program Files\Python36\lib\site-packages\chef\base.py", line 58, in __init__
data = self.api[self.url]
File "C:\Program Files\Python36\lib\site-packages\chef\api.py", line 221, in __getitem__
return self.api_request('GET', path)
File "C:\Program Files\Python36\lib\site-packages\chef\api.py", line 217, in api_request
response = self.request(method, path, headers, data)
File "C:\Program Files\Python36\lib\site-packages\chef\api.py", line 207, in request
raise ChefServerError.from_error(response.reason, code=response.status_code)
chef.exceptions.ChefServerError: Unauthorized
Metadata
Metadata
Assignees
Labels
No labels