diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:30:53 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:30:53 -0700 |
commit | 34a6dd714503abbb0e6d240a4832f245d5c3ab06 (patch) | |
tree | 90e7b709c931ad394ebf9fc4490145405776ea94 /lib | |
parent | 878560a22f37aec0c2dfe681b3743e027155be88 (diff) | |
download | chef-34a6dd714503abbb0e6d240a4832f245d5c3ab06.tar.gz |
clean up whitespace again
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 4 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/api_error_formatting.rb | 20 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb | 2 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/registration_error_inspector.rb | 4 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/cookbook_upload.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/ssl_check.rb | 32 | ||||
-rw-r--r-- | lib/chef/knife/ssl_fetch.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/powershell_script.rb | 22 | ||||
-rw-r--r-- | lib/chef/shell/ext.rb | 76 |
10 files changed, 85 insertions, 85 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 8a70a77168..03e2d7a090 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -653,7 +653,7 @@ class Chef The dependency specification syntax you are using is no longer valid. You may not specify more than one version constraint for a particular cookbook. Consult https://docs.chef.io/config_rb_metadata.html for the updated syntax. - + Called by: #{caller_name} '#{dep_name}', #{version_constraints.map { |vc| vc.inspect }.join(", ")} Called from: #{caller[0...5].map { |line| " " + line }.join("\n")} @@ -672,7 +672,7 @@ OBSOLETED upgraded to Chef 0.10.0, be aware that you no may longer use "<<" and ">>" for 'less than' and 'greater than'; use '<' and '>' instead. Consult https://docs.chef.io/config_rb_metadata.html for more information. - + Called by: #{caller_name} '#{dep_name}', '#{constraint_str}' Called from: #{caller[0...5].map { |line| " " + line }.join("\n")} diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb index f306a5a5f1..954eebafdb 100644 --- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb +++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb @@ -28,7 +28,7 @@ class Chef 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. E error_description.section("Relevant Config Settings:", <<~E) @@ -40,25 +40,25 @@ E 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 @@ -66,7 +66,7 @@ E 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 @@ -89,7 +89,7 @@ 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 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 a45d5ea45f..a046f1a277 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb @@ -59,7 +59,7 @@ class Chef 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 diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index cfc536192c..b912800bc5 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -32,7 +32,7 @@ class Chef 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. E when Chef::Exceptions::PrivateKeyMissing @@ -74,7 +74,7 @@ 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 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 93e29e4017..9d46465947 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 @@ -38,7 +38,7 @@ class Chef 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. E when Net::HTTPServerException, Net::HTTPFatalError @@ -85,7 +85,7 @@ 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 diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index 854945bf5f..b19c352b79 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -212,7 +212,7 @@ class Chef ui.warn(<<~WARNING) The cookbooks: #{cookbook_repo.merged_cookbooks.join(', ')} exist in multiple places in your cookbook_path. A composite version of these cookbooks has been compiled for uploading. - + #{ui.color('IMPORTANT:', :red, :bold)} In a future version of Chef, this behavior will be removed and you will no longer be able to have the same version of a cookbook in multiple places in your cookbook_path. WARNING diff --git a/lib/chef/knife/ssl_check.rb b/lib/chef/knife/ssl_check.rb index e3005711fe..858ab3cf89 100644 --- a/lib/chef/knife/ssl_check.rb +++ b/lib/chef/knife/ssl_check.rb @@ -154,23 +154,23 @@ class Chef ui.warn(<<~BAD_CERTS) There are invalid certificates in your trusted_certs_dir. OpenSSL will not use the following certificates when verifying SSL connections: - + #{cert_debug_msg} - + #{ui.color("TO FIX THESE WARNINGS:", :bold)} - + We are working on documentation for resolving common issues uncovered here. - + * If the certificate is generated by the server, you may try redownloading the server's certificate. By default, the certificate is stored in the following location on the host where your chef-server runs: - + /var/opt/opscode/nginx/ca/SERVER_HOSTNAME.crt - + Copy that file to your trusted_certs_dir (currently: #{configuration.trusted_certs_dir}) using SSH/SCP or some other secure method, then re-run this command to confirm that the server's certificate is now trusted. - + BAD_CERTS # @TODO: ^ needs URL once documentation is posted. end @@ -185,21 +185,21 @@ BAD_CERTS debug_chef_ssl_config ui.err(<<~ADVICE) - + #{ui.color("TO FIX THIS ERROR:", :bold)} - + If the server you are connecting to uses a self-signed certificate, you must configure chef to trust that server's certificate. - + By default, the certificate is stored in the following location on the host where your chef-server runs: - + /var/opt/opscode/nginx/ca/SERVER_HOSTNAME.crt - + Copy that file to your trusted_certs_dir (currently: #{configuration.trusted_certs_dir}) using SSH/SCP or some other secure method, then re-run this command to confirm that the server's certificate is now trusted. - + ADVICE end @@ -212,14 +212,14 @@ ADVICE ui.error("You are attempting to connect to: '#{host}'") ui.error("The server's certificate belongs to '#{cn}'") ui.err(<<~ADVICE) - + #{ui.color("TO FIX THIS ERROR:", :bold)} - + The solution for this issue depends on your networking configuration. If you are able to connect to this server using the hostname #{cn} instead of #{host}, then you can resolve this issue by updating chef_server_url in your configuration file. - + If you are not able to connect to the server using the hostname #{cn} you will have to update the certificate on the server to use the correct hostname. ADVICE diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb index cc0ad3bbd6..88eb95e97d 100644 --- a/lib/chef/knife/ssl_fetch.rb +++ b/lib/chef/knife/ssl_fetch.rb @@ -133,10 +133,10 @@ class Chef ui.warn(<<~TRUST_TRUST) Certificates from #{host} will be fetched and placed in your trusted_cert directory (#{trusted_certs_dir}). - + Knife has no means to verify these are the correct certificates. You should verify the authenticity of these certificates after downloading. - + TRUST_TRUST remote_cert_chain.each do |cert| write_cert(cert) diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 6117fa4e1c..31521c3675 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -148,7 +148,7 @@ EOH def wrapper_script <<~EOH # Chef Client wrapper for powershell_script resources - + # In rare cases, such as when PowerShell is executed # as an alternate user, the new-variable cmdlet is not # available, so import it just in case @@ -156,36 +156,36 @@ EOH { Import-Module Microsoft.PowerShell.Utility } - + # LASTEXITCODE can be uninitialized -- make it explictly 0 # to avoid incorrect detection of failure (non-zero) codes $global:LASTEXITCODE = 0 - + # Catch any exceptions -- without this, exceptions will result # In a zero return code instead of the desired non-zero code # that indicates a failure trap [Exception] {write-error ($_.Exception.Message);exit 1} - + # Variable state that should not be accessible to the user code new-variable -name interpolatedexitcode -visibility private -value $#{new_resource.convert_boolean_return} new-variable -name chefscriptresult -visibility private - + # Initialize a variable we use to capture $? inside a block $global:lastcmdlet = $null - + # Execute the user's code in a script block -- $chefscriptresult = { #{new_resource.code} - + # This assignment doesn't affect the block's return value $global:lastcmdlet = $? }.invokereturnasis() - + # Assume failure status of 1 -- success cases # will have to override this $exitstatus = 1 - + # If convert_boolean_return is enabled, the block's return value # gets precedence in determining our exit status if ($interpolatedexitcode -and $chefscriptresult -ne $null -and $chefscriptresult.gettype().name -eq 'boolean') @@ -206,10 +206,10 @@ EOH # status. $exitstatus = $LASTEXITCODE } - + # Print STDOUT for the script execution Write-Output $chefscriptresult - + # If this script is launched with -File, the process exit # status of PowerShell.exe will be $exitstatus. If it was # launched with -Command, it will be 0 if $exitstatus was 0, diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb index 558c8ad5ca..cb1fb9041b 100644 --- a/lib/chef/shell/ext.rb +++ b/lib/chef/shell/ext.rb @@ -306,9 +306,9 @@ module Shell ## SUMMARY ## +edit(object)+ allows you to edit any object that can be converted to JSON. When finished editing, this method will return the edited object: - + new_node = edit(existing_node) - + ## EDITOR SELECTION ## chef-shell looks for an editor using the following logic 1. Looks for an EDITOR set by Shell.editor = "EDITOR" @@ -344,44 +344,44 @@ module Shell ## SUMMARY ## +clients+ allows you to query you chef server for information about your api clients. - + ## LIST ALL CLIENTS ## To see all clients on the system, use - + clients.all #=> [<Chef::ApiClient...>, ...] - + If the output from all is too verbose, or you're only interested in a specific value from each of the objects, you can give a code block to +all+: - + clients.all { |client| client.name } #=> [CLIENT1_NAME, CLIENT2_NAME, ...] - + ## SHOW ONE CLIENT ## To see a specific client, use - + clients.show(CLIENT_NAME) - + ## SEARCH FOR CLIENTS ## You can also search for clients using +find+ or +search+. You can use the familiar string search syntax: - + clients.search("KEY:VALUE") - + Just as the +all+ subcommand, the +search+ subcommand can use a code block to filter or transform the information returned from the search: - + clients.search("KEY:VALUE") { |c| c.name } - + You can also use a Hash based syntax, multiple search conditions will be joined with AND. - + clients.find :KEY => :VALUE, :KEY2 => :VALUE2, ... - + ## BULK-EDIT CLIENTS ## **BE CAREFUL, THIS IS DESTRUCTIVE** You can bulk edit API Clients using the +transform+ subcommand, which requires a code block. Each client will be saved after the code block is run. If the code block returns +nil+ or +false+, that client will be skipped: - + clients.transform("*:*") do |client| if client.name =~ /borat/i client.admin(false) @@ -390,7 +390,7 @@ module Shell nil end end - + This will strip the admin privileges from any client named after borat. E subcommands all: "list all api clients", @@ -413,46 +413,46 @@ module Shell explain(<<~E) ## SUMMARY ## +nodes+ Allows you to query your chef server for information about your nodes. - + ## LIST ALL NODES ## You can list all nodes using +all+ or +list+ - + nodes.all #=> [<Chef::Node...>, <Chef::Node...>, ...] - + To limit the information returned for each node, pass a code block to the +all+ subcommand: - + nodes.all { |node| node.name } #=> [NODE1_NAME, NODE2_NAME, ...] - + ## SHOW ONE NODE ## You can show the data for a single node using the +show+ subcommand: - + nodes.show("NODE_NAME") => <Chef::Node @name="NODE_NAME" ...> - + ## SEARCH FOR NODES ## You can search for nodes using the +search+ or +find+ subcommands: - + nodes.find(:name => "app*") #=> [<Chef::Node @name="app1.example.com" ...>, ...] - + Similarly to +all+, you can pass a code block to limit or transform the information returned: - + nodes.find(:name => "app#") { |node| node.ec2 } - + ## BULK EDIT NODES ## **BE CAREFUL, THIS OPERATION IS DESTRUCTIVE** - + Bulk edit nodes by passing a code block to the +transform+ or +bulk_edit+ subcommand. The block will be applied to each matching node, and then the node will be saved. If the block returns +nil+ or +false+, that node will be skipped. - + nodes.transform do |node| if node.fqdn =~ /.*\\.preprod\\.example\\.com/ node.set[:environment] = "preprod" end end - + This will assign the attribute to every node with a FQDN matching the regex. E subcommands all: "list all nodes", @@ -467,13 +467,13 @@ module Shell explain(<<~E) ## SUMMARY ## +roles+ allows you to query and edit roles on your Chef server. - + ## SUBCOMMANDS ## * all (list) * show (load) * search (find) * transform (bulk_edit) - + ## SEE ALSO ## See the help for +nodes+ for more information about the subcommands. E @@ -492,16 +492,16 @@ module Shell Chef server. Unlike other commands for working with data on the server, +databags+ requires the databag name as an argument, for example: databags(:users).all - + ## SUBCOMMANDS ## * all (list) * show (load) * search (find) * transform (bulk_edit) - + ## SEE ALSO ## See the help for +nodes+ for more information about the subcommands. - + E subcommands all: "list all items in the data bag", show: "load a data bag item by id", @@ -516,13 +516,13 @@ module Shell explain(<<~E) ## SUMMARY ## +environments+ allows you to query and edit environments on your Chef server. - + ## SUBCOMMANDS ## * all (list) * show (load) * search (find) * transform (bulk_edit) - + ## SEE ALSO ## See the help for +nodes+ for more information about the subcommands. E |