diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
commit | dcac6762380d011f73cf53a50476d31dab0025ee (patch) | |
tree | 294fef3e2b4fea273c4bb11a086061872ed51598 /lib/chef/formatters | |
parent | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff) | |
download | chef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz |
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/formatters')
5 files changed, 141 insertions, 141 deletions
diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb index 53549ee77c..f306a5a5f1 100644 --- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb +++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb @@ -26,79 +26,79 @@ class Chef NETWORK_ERROR_CLASSES = [Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError] def describe_network_errors(error_description) - error_description.section("Networking Error:", <<-E) -#{exception.message} - -Your chef_server_url may be misconfigured, or the network could be down. + error_description.section("Networking Error:", <<~E) + #{exception.message} + + Your chef_server_url may be misconfigured, or the network could be down. E - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" E end def describe_eof_error(error_description) - error_description.section("Authentication Error:", <<-E) -Received an EOF on transport socket. This almost always indicates a network -error external to chef-client. Some causes include: - - - Blocking ICMP Dest Unreachable (breaking Path MTU Discovery) - - IPsec or VPN tunnelling / TCP Encapsulation MTU issues - - Jumbo frames configured only on one side (breaking Path MTU) - - Jumbo frames configured on a LAN that does not support them - - Proxies or Load Balancers breaking large POSTs - - Broken TCP offload in network drivers/hardware - -Try sending large pings to the destination: - - windows: ping server.example.com -f -l 9999 - unix: ping server.example.com -s 9999 - -Try sending large POSTs to the destination (any HTTP code returned is success): - - e.g.: curl http://server.example.com/`printf '%*s' 9999 '' | tr ' ' 'a'` - -Try disabling TCP Offload Engines (TOE) in your ethernet drivers. - - windows: - Disable-NetAdapterChecksumOffload * -TcpIPv4 -UdpIPv4 -IpIPv4 -NoRestart - Disable-NetAdapterLso * -IPv4 -NoRestart - Set-NetAdapterAdvancedProperty * -DisplayName "Large Receive Offload (IPv4)" -DisplayValue Disabled –NoRestart - Restart-NetAdapter * - unix(bash): - for i in rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash; do /sbin/ethtool -K eth0 $i off; done - -In some cases the underlying virtualization layer (Xen, VMware, KVM, Hyper-V, etc) may have -broken virtual networking code. + error_description.section("Authentication Error:", <<~E) + Received an EOF on transport socket. This almost always indicates a network + error external to chef-client. Some causes include: + + - Blocking ICMP Dest Unreachable (breaking Path MTU Discovery) + - IPsec or VPN tunnelling / TCP Encapsulation MTU issues + - Jumbo frames configured only on one side (breaking Path MTU) + - Jumbo frames configured on a LAN that does not support them + - Proxies or Load Balancers breaking large POSTs + - Broken TCP offload in network drivers/hardware + + Try sending large pings to the destination: + + windows: ping server.example.com -f -l 9999 + unix: ping server.example.com -s 9999 + + Try sending large POSTs to the destination (any HTTP code returned is success): + + e.g.: curl http://server.example.com/`printf '%*s' 9999 '' | tr ' ' 'a'` + + Try disabling TCP Offload Engines (TOE) in your ethernet drivers. + + windows: + Disable-NetAdapterChecksumOffload * -TcpIPv4 -UdpIPv4 -IpIPv4 -NoRestart + Disable-NetAdapterLso * -IPv4 -NoRestart + Set-NetAdapterAdvancedProperty * -DisplayName "Large Receive Offload (IPv4)" -DisplayValue Disabled –NoRestart + Restart-NetAdapter * + unix(bash): + for i in rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash; do /sbin/ethtool -K eth0 $i off; done + + In some cases the underlying virtualization layer (Xen, VMware, KVM, Hyper-V, etc) may have + broken virtual networking code. E end def describe_401_error(error_description) if clock_skew? - error_description.section("Authentication Error:", <<-E) -Failed to authenticate to the chef server (http 401). -The request failed because your clock has drifted by more than 15 minutes. -Syncing your clock to an NTP Time source should resolve the issue. + error_description.section("Authentication Error:", <<~E) + Failed to authenticate to the chef server (http 401). + The request failed because your clock has drifted by more than 15 minutes. + Syncing your clock to an NTP Time source should resolve the issue. E else - error_description.section("Authentication Error:", <<-E) -Failed to authenticate to the chef server (http 401). + error_description.section("Authentication Error:", <<~E) + Failed to authenticate to the chef server (http 401). E error_description.section("Server Response:", format_rest_error) - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" -node_name "#{username}" -client_key "#{api_key}" - -If these settings are correct, your client_key may be invalid, or -you may have a chef user with the same client name as this node. + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" + node_name "#{username}" + client_key "#{api_key}" + + If these settings are correct, your client_key may be invalid, or + you may have a chef user with the same client name as this node. E end end def describe_400_error(error_description) - error_description.section("Invalid Request Data:", <<-E) -The data in your request was invalid (HTTP 400). + error_description.section("Invalid Request Data:", <<~E) + The data in your request was invalid (HTTP 400). E error_description.section("Server Response:", format_rest_error) end @@ -110,11 +110,11 @@ E min_server_version = version_header["min_version"] max_server_version = version_header["max_version"] - error_description.section("Incompatible server API version:", <<-E) -This version of the API that this Chef request specified is not supported by the Chef server you sent this request to. -The server supports a min API version of #{min_server_version} and a max API version of #{max_server_version}. -Chef just made a request with an API version of #{client_api_version}. -Please either update your Chef client or server to be a compatible set. + error_description.section("Incompatible server API version:", <<~E) + This version of the API that this Chef request specified is not supported by the Chef server you sent this request to. + The server supports a min API version of #{min_server_version} and a max API version of #{max_server_version}. + Chef just made a request with an API version of #{client_api_version}. + Please either update your Chef client or server to be a compatible set. E else describe_http_error(error_description) @@ -122,8 +122,8 @@ E end def describe_500_error(error_description) - error_description.section("Unknown Server Error:", <<-E) -The server had a fatal error attempting to load the node data. + error_description.section("Unknown Server Error:", <<~E) + The server had a fatal error attempting to load the node data. E error_description.section("Server Response:", format_rest_error) end diff --git a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb index eb1aa629ff..a45d5ea45f 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb @@ -56,12 +56,12 @@ class Chef # TODO: we're rescuing errors from Node.find_or_create # * could be no write on nodes container # * could be no read on the node - error_description.section("Authorization Error", <<-E) -This client is not authorized to read some of the information required to -access its cookbooks (HTTP 403). - -To access its cookbooks, a client needs to be able to read its environment and -all of the cookbooks in its expanded run list. + error_description.section("Authorization Error", <<~E) + This client is not authorized to read some of the information required to + access its cookbooks (HTTP 403). + + To access its cookbooks, a client needs to be able to read its environment and + all of the cookbooks in its expanded run list. E error_description.section("Expanded Run List:", expanded_run_list_ul) error_description.section("Server Response:", format_rest_error) @@ -115,11 +115,11 @@ E explanation << "Error message: #{error_reasons["message"]}\n" end - explanation << <<EOM -You might be able to resolve this issue with: - 1-) Removing cookbook versions that depend on deleted cookbooks. - 2-) Removing unused cookbook versions. - 3-) Pinning exact cookbook versions using environments. + explanation << <<~EOM + You might be able to resolve this issue with: + 1-) Removing cookbook versions that depend on deleted cookbooks. + 2-) Removing unused cookbook versions. + 3-) Pinning exact cookbook versions using environments. EOM error_description.section("Cookbook dependency resolution error:", explanation) end diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb index c52dad4c09..a2f77c8287 100644 --- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb @@ -43,12 +43,12 @@ class Chef when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) when Chef::Exceptions::PrivateKeyMissing - error_description.section("Private Key Not Found:", <<-E) -Your private key could not be loaded. If the key file exists, ensure that it is -readable by chef-client. + error_description.section("Private Key Not Found:", <<~E) + Your private key could not be loaded. If the key file exists, ensure that it is + readable by chef-client. E - error_description.section("Relevant Config Settings:", <<-E) -client_key "#{api_key}" + error_description.section("Relevant Config Settings:", <<~E) + client_key "#{api_key}" E when EOFError describe_eof_error(error_description) @@ -69,13 +69,13 @@ E # TODO: we're rescuing errors from Node.find_or_create # * could be no write on nodes container # * could be no read on the node - error_description.section("Authorization Error", <<-E) -Your client is not authorized to load the node data (HTTP 403). + error_description.section("Authorization Error", <<~E) + Your client is not authorized to load the node data (HTTP 403). E error_description.section("Server Response:", format_rest_error) - error_description.section("Possible Causes:", <<-E) -* Your client (#{username}) may have misconfigured authorization permissions. + error_description.section("Possible Causes:", <<~E) + * Your client (#{username}) may have misconfigured authorization permissions. E when Net::HTTPBadRequest describe_400_error(error_description) @@ -97,11 +97,11 @@ E # one, e.g., PUT http://wrong.url/nodes/node-name becomes a GET after a # redirect. def describe_404_error(error_description) - error_description.section("Resource Not Found:", <<-E) -The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. + error_description.section("Resource Not Found:", <<~E) + The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. E - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" E end diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index c7c1454311..cfc536192c 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -26,26 +26,26 @@ class Chef when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError - error_description.section("Network Error:", <<-E) -There was a network error connecting to the Chef Server: -#{exception.message} + error_description.section("Network Error:", <<~E) + There was a network error connecting to the Chef Server: + #{exception.message} E - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" - -If your chef_server_url is correct, your network could be down. + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" + + If your chef_server_url is correct, your network could be down. E when Chef::Exceptions::PrivateKeyMissing - error_description.section("Private Key Not Found:", <<-E) -Your private key could not be loaded. If the key file exists, ensure that it is -readable by chef-client. + error_description.section("Private Key Not Found:", <<~E) + Your private key could not be loaded. If the key file exists, ensure that it is + readable by chef-client. E - error_description.section("Relevant Config Settings:", <<-E) -validation_key "#{api_key}" + error_description.section("Relevant Config Settings:", <<~E) + validation_key "#{api_key}" E when Chef::Exceptions::InvalidRedirect - error_description.section("Invalid Redirect:", <<-E) -Change your server location in client.rb to the server's FQDN to avoid unwanted redirections. + error_description.section("Invalid Redirect:", <<~E) + Change your server location in client.rb to the server's FQDN to avoid unwanted redirections. E when EOFError describe_eof_error(error_description) @@ -59,50 +59,50 @@ E case response when Net::HTTPUnauthorized if clock_skew? - error_description.section("Authentication Error:", <<-E) -Failed to authenticate to the chef server (http 401). -The request failed because your clock has drifted by more than 15 minutes. -Syncing your clock to an NTP Time source should resolve the issue. + error_description.section("Authentication Error:", <<~E) + Failed to authenticate to the chef server (http 401). + The request failed because your clock has drifted by more than 15 minutes. + Syncing your clock to an NTP Time source should resolve the issue. E else - error_description.section("Authentication Error:", <<-E) -Failed to authenticate to the chef server (http 401). + error_description.section("Authentication Error:", <<~E) + Failed to authenticate to the chef server (http 401). E error_description.section("Server Response:", format_rest_error) - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" -validation_client_name "#{username}" -validation_key "#{api_key}" - -If these settings are correct, your validation_key may be invalid. + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" + validation_client_name "#{username}" + validation_key "#{api_key}" + + If these settings are correct, your validation_key may be invalid. E end when Net::HTTPForbidden - error_description.section("Authorization Error:", <<-E) -Your validation client is not authorized to create the client for this node (HTTP 403). + error_description.section("Authorization Error:", <<~E) + Your validation client is not authorized to create the client for this node (HTTP 403). E - error_description.section("Possible Causes:", <<-E) -* There may already be a client named "#{config[:node_name]}" -* Your validation client (#{username}) may have misconfigured authorization permissions. + error_description.section("Possible Causes:", <<~E) + * There may already be a client named "#{config[:node_name]}" + * Your validation client (#{username}) may have misconfigured authorization permissions. E when Net::HTTPBadRequest - error_description.section("Invalid Request Data:", <<-E) -The data in your request was invalid (HTTP 400). + error_description.section("Invalid Request Data:", <<~E) + The data in your request was invalid (HTTP 400). E error_description.section("Server Response:", format_rest_error) when Net::HTTPNotFound - error_description.section("Resource Not Found:", <<-E) -The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. + error_description.section("Resource Not Found:", <<~E) + The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. E - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" E when Net::HTTPNotAcceptable describe_406_error(error_description, response) when Net::HTTPInternalServerError - error_description.section("Unknown Server Error:", <<-E) -The server had a fatal error attempting to load the node data. + error_description.section("Unknown Server Error:", <<~E) + The server had a fatal error attempting to load the node data. E error_description.section("Server Response:", format_rest_error) when Net::HTTPBadGateway, Net::HTTPServiceUnavailable diff --git a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb index e94b347378..93e29e4017 100644 --- a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb @@ -36,10 +36,10 @@ class Chef def add_explanation(error_description) case exception when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError - error_description.section("Networking Error:", <<-E) -#{exception.message} - -Your chef_server_url may be misconfigured, or the network could be down. + error_description.section("Networking Error:", <<~E) + #{exception.message} + + Your chef_server_url may be misconfigured, or the network could be down. E when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) @@ -76,35 +76,35 @@ E response = exception.response case response when Net::HTTPUnauthorized - error_description.section("Authentication Error:", <<-E) -Failed to authenticate to the chef server (http 401). + error_description.section("Authentication Error:", <<~E) + Failed to authenticate to the chef server (http 401). E error_description.section("Server Response:", format_rest_error) - error_description.section("Relevant Config Settings:", <<-E) -chef_server_url "#{server_url}" -node_name "#{username}" -client_key "#{api_key}" - -If these settings are correct, your client_key may be invalid. + error_description.section("Relevant Config Settings:", <<~E) + chef_server_url "#{server_url}" + node_name "#{username}" + client_key "#{api_key}" + + If these settings are correct, your client_key may be invalid. E when Net::HTTPForbidden # TODO: we're rescuing errors from Node.find_or_create # * could be no write on nodes container # * could be no read on the node - error_description.section("Authorization Error", <<-E) -Your client is not authorized to load one or more of your roles (HTTP 403). + error_description.section("Authorization Error", <<~E) + Your client is not authorized to load one or more of your roles (HTTP 403). E error_description.section("Server Response:", format_rest_error) - error_description.section("Possible Causes:", <<-E) -* Your client (#{username}) may have misconfigured authorization permissions. + error_description.section("Possible Causes:", <<~E) + * Your client (#{username}) may have misconfigured authorization permissions. E when Net::HTTPNotAcceptable describe_406_error(error_description, response) when Net::HTTPInternalServerError - error_description.section("Unknown Server Error:", <<-E) -The server had a fatal error attempting to load a role. + error_description.section("Unknown Server Error:", <<~E) + The server had a fatal error attempting to load a role. E error_description.section("Server Response:", format_rest_error) when Net::HTTPBadGateway, Net::HTTPServiceUnavailable |