Method: Chef::Formatters::APIErrorFormatting#describe_401_error

Defined in:
lib/chef/formatters/error_inspectors/api_error_formatting.rb

#describe_401_error(error_description) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/chef/formatters/error_inspectors/api_error_formatting.rb', line 77

def describe_401_error(error_description)
  if clock_skew?
    error_description.section("Authentication Error:", "      Failed to authenticate to the chef server (http 401).\n      The request failed because your clock has drifted by more than 15 minutes.\n      Syncing your clock to an NTP Time source should resolve the issue.\n    E\n  else\n    error_description.section(\"Authentication Error:\", <<~E)\n      Failed to authenticate to the chef server (http 401).\n    E\n\n    error_description.section(\"Server Response:\", format_rest_error)\n    error_description.section(\"Relevant Config Settings:\", <<~E)\n      chef_server_url   \"\#{server_url}\"\n      node_name         \"\#{username}\"\n      client_key        \"\#{api_key}\"\n\n      If these settings are correct, your client_key may be invalid, or\n      you may have a chef user with the same client name as this node.\n    E\n  end\nend\n")