summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:27:03 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:27:03 -0700
commitdcac6762380d011f73cf53a50476d31dab0025ee (patch)
tree294fef3e2b4fea273c4bb11a086061872ed51598 /lib/chef
parent35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff)
downloadchef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application/solo.rb12
-rw-r--r--lib/chef/cookbook/metadata.rb34
-rw-r--r--lib/chef/exceptions.rb6
-rw-r--r--lib/chef/formatters/error_inspectors/api_error_formatting.rb120
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb22
-rw-r--r--lib/chef/formatters/error_inspectors/node_load_error_inspector.rb26
-rw-r--r--lib/chef/formatters/error_inspectors/registration_error_inspector.rb78
-rw-r--r--lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb36
-rw-r--r--lib/chef/knife/configure.rb10
-rw-r--r--lib/chef/knife/cookbook_upload.rb12
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb6
-rw-r--r--lib/chef/knife/core/node_presenter.rb54
-rw-r--r--lib/chef/knife/key_create.rb8
-rw-r--r--lib/chef/knife/key_edit.rb10
-rw-r--r--lib/chef/knife/key_list.rb6
-rw-r--r--lib/chef/knife/ssl_check.rb94
-rw-r--r--lib/chef/knife/ssl_fetch.rb14
-rw-r--r--lib/chef/knife/user_create.rb22
-rw-r--r--lib/chef/knife/user_delete.rb18
-rw-r--r--lib/chef/knife/user_edit.rb18
-rw-r--r--lib/chef/knife/user_reregister.rb18
-rw-r--r--lib/chef/knife/user_show.rb18
-rw-r--r--lib/chef/mixin/api_version_request_handling.rb12
-rw-r--r--lib/chef/node_map.rb24
-rw-r--r--lib/chef/provider/package/chocolatey.rb12
-rw-r--r--lib/chef/provider/powershell_script.rb146
-rw-r--r--lib/chef/resource/resource_notification.rb32
-rw-r--r--lib/chef/run_context.rb12
-rw-r--r--lib/chef/shell.rb16
-rw-r--r--lib/chef/shell/ext.rb308
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb20
31 files changed, 612 insertions, 612 deletions
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 345cf40e65..3ea8774169 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -315,12 +315,12 @@ class Chef::Application::Solo < Chef::Application
private
def for_ezra
- puts <<-EOH
-For Ezra Zygmuntowicz:
- The man who brought you Chef Solo
- Early contributor to Chef
- Kind hearted open source advocate
- Rest in peace, Ezra.
+ puts <<~EOH
+ For Ezra Zygmuntowicz:
+ The man who brought you Chef Solo
+ Early contributor to Chef
+ Kind hearted open source advocate
+ Rest in peace, Ezra.
EOH
end
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb
index 94604ea0d9..8a70a77168 100644
--- a/lib/chef/cookbook/metadata.rb
+++ b/lib/chef/cookbook/metadata.rb
@@ -649,14 +649,14 @@ class Chef
elsif version_constraints.size == 1
version_constraints.first
else
- msg = <<-OBSOLETED
-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")}
+ msg = <<~OBSOLETED
+ 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")}
OBSOLETED
raise Exceptions::ObsoleteDependencySyntax, msg
end
@@ -667,15 +667,15 @@ OBSOLETED
rescue Chef::Exceptions::InvalidVersionConstraint => e
Log.debug(e)
- msg = <<-INVALID
-The version constraint syntax you are using is not valid. If you recently
-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")}
+ msg = <<~INVALID
+ The version constraint syntax you are using is not valid. If you recently
+ 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")}
INVALID
raise Exceptions::InvalidVersionConstraint, msg
end
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 1ed71d2a55..ca388d33cd 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -398,9 +398,9 @@ class Chef
# length declared in the http response.
class ContentLengthMismatch < RuntimeError
def initialize(response_length, content_length)
- super <<-EOF
-Response body length #{response_length} does not match HTTP Content-Length header #{content_length}.
-This error is most often caused by network issues (proxies, etc) outside of chef-client.
+ super <<~EOF
+ Response body length #{response_length} does not match HTTP Content-Length header #{content_length}.
+ This error is most often caused by network issues (proxies, etc) outside of chef-client.
EOF
end
end
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
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index fb2954c982..4b33998eaa 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -75,11 +75,11 @@ class Chef
confirm("Overwrite #{config_file_path}") if ::File.exist?(config_file_path)
::File.open(config_file_path, "w") do |f|
- f.puts <<-EOH
-[default]
-client_name = '#{new_client_name}'
-client_key = '#{new_client_key}'
-chef_server_url = '#{chef_server}'
+ f.puts <<~EOH
+ [default]
+ client_name = '#{new_client_name}'
+ client_key = '#{new_client_key}'
+ chef_server_url = '#{chef_server}'
EOH
end
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index 241eb03862..854945bf5f 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -209,12 +209,12 @@ class Chef
unless cookbook_repo.merged_cookbooks.empty?
ui.warn "* " * 40
- 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.
+ 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
ui.warn "The affected cookbooks are located:"
ui.output ui.format_for_display(cookbook_repo.merged_cookbook_paths)
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index 17d62f597f..bb20780590 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -86,9 +86,9 @@ class Chef
end
def config_content
- client_rb = <<-CONFIG
-chef_server_url "#{@chef_config[:chef_server_url]}"
-validation_client_name "#{@chef_config[:validation_client_name]}"
+ client_rb = <<~CONFIG
+ chef_server_url "#{@chef_config[:chef_server_url]}"
+ validation_client_name "#{@chef_config[:validation_client_name]}"
CONFIG
if !(@chef_config[:config_log_level].nil? || @chef_config[:config_log_level].empty?)
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index 0c00601981..7cb0e4d6fe 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -98,49 +98,49 @@ class Chef
# special case ec2 with their split horizon whatsis.
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
- summarized = <<-SUMMARY
-#{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)}
+ summarized = <<~SUMMARY
+ #{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)}
SUMMARY
show_policy = !(node.policy_name.nil? && node.policy_group.nil?)
if show_policy
- summarized << <<-POLICY
-#{key('Policy Name:')} #{node.policy_name}
-#{key('Policy Group:')} #{node.policy_group}
+ summarized << <<~POLICY
+ #{key('Policy Name:')} #{node.policy_name}
+ #{key('Policy Group:')} #{node.policy_group}
POLICY
else
- summarized << <<-ENV
-#{key('Environment:')} #{node.chef_environment}
+ summarized << <<~ENV
+ #{key('Environment:')} #{node.chef_environment}
ENV
end
- summarized << <<-SUMMARY
-#{key('FQDN:')} #{node[:fqdn]}
-#{key('IP:')} #{ip}
-#{key('Run List:')} #{node.run_list}
+ summarized << <<~SUMMARY
+ #{key('FQDN:')} #{node[:fqdn]}
+ #{key('IP:')} #{ip}
+ #{key('Run List:')} #{node.run_list}
SUMMARY
unless show_policy
- summarized << <<-ROLES
-#{key('Roles:')} #{Array(node[:roles]).join(', ')}
+ summarized << <<~ROLES
+ #{key('Roles:')} #{Array(node[:roles]).join(', ')}
ROLES
end
- summarized << <<-SUMMARY
-#{key('Recipes:')} #{Array(node[:recipes]).join(', ')}
-#{key('Platform:')} #{node[:platform]} #{node[:platform_version]}
-#{key('Tags:')} #{node.tags.join(', ')}
+ summarized << <<~SUMMARY
+ #{key('Recipes:')} #{Array(node[:recipes]).join(', ')}
+ #{key('Platform:')} #{node[:platform]} #{node[:platform_version]}
+ #{key('Tags:')} #{node.tags.join(', ')}
SUMMARY
if config[:medium_output] || config[:long_output]
- summarized += <<-MORE
-#{key('Attributes:')}
-#{text_format(node.normal_attrs)}
+ summarized += <<~MORE
+ #{key('Attributes:')}
+ #{text_format(node.normal_attrs)}
MORE
end
if config[:long_output]
- summarized += <<-MOST
-#{key('Default Attributes:')}
-#{text_format(node.default_attrs)}
-#{key('Override Attributes:')}
-#{text_format(node.override_attrs)}
-#{key('Automatic Attributes (Ohai Data):')}
-#{text_format(node.automatic_attrs)}
+ summarized += <<~MOST
+ #{key('Default Attributes:')}
+ #{text_format(node.default_attrs)}
+ #{key('Override Attributes:')}
+ #{text_format(node.override_attrs)}
+ #{key('Automatic Attributes (Ohai Data):')}
+ #{text_format(node.automatic_attrs)}
MOST
end
summarized
diff --git a/lib/chef/knife/key_create.rb b/lib/chef/knife/key_create.rb
index a9f9da97a7..395bbc4bfd 100644
--- a/lib/chef/knife/key_create.rb
+++ b/lib/chef/knife/key_create.rb
@@ -40,10 +40,10 @@ class Chef
end
def public_key_or_key_name_error_msg
- <<EOS
-You must pass either --public-key or --key-name, or both.
-If you only pass --public-key, a key name will be generated from the fingerprint of your key.
-If you only pass --key-name, a key pair will be generated by the server.
+ <<~EOS
+ You must pass either --public-key or --key-name, or both.
+ If you only pass --public-key, a key name will be generated from the fingerprint of your key.
+ If you only pass --key-name, a key pair will be generated by the server.
EOS
end
diff --git a/lib/chef/knife/key_edit.rb b/lib/chef/knife/key_edit.rb
index 8490d10fa5..d05ee11d1c 100644
--- a/lib/chef/knife/key_edit.rb
+++ b/lib/chef/knife/key_edit.rb
@@ -41,11 +41,11 @@ class Chef
end
def public_key_and_create_key_error_msg
- <<EOS
-You passed both --public-key and --create-key. Only pass one, or the other, or neither.
-Do not pass either if you do not want to change the public_key field of your key.
-Pass --public-key if you want to update the public_key field of your key from a specific public key.
-Pass --create-key if you want the server to generate a new key and use that to update the public_key field of your key.
+ <<~EOS
+ You passed both --public-key and --create-key. Only pass one, or the other, or neither.
+ Do not pass either if you do not want to change the public_key field of your key.
+ Pass --public-key if you want to update the public_key field of your key from a specific public key.
+ Pass --create-key if you want the server to generate a new key and use that to update the public_key field of your key.
EOS
end
diff --git a/lib/chef/knife/key_list.rb b/lib/chef/knife/key_list.rb
index 9a820b7a50..9d3a2c0c26 100644
--- a/lib/chef/knife/key_list.rb
+++ b/lib/chef/knife/key_list.rb
@@ -40,9 +40,9 @@ class Chef
end
def expired_and_non_expired_msg
- <<EOS
-You cannot pass both --only-expired and --only-non-expired.
-Please pass one or none.
+ <<~EOS
+ You cannot pass both --only-expired and --only-non-expired.
+ Please pass one or none.
EOS
end
diff --git a/lib/chef/knife/ssl_check.rb b/lib/chef/knife/ssl_check.rb
index c864ef52ec..e3005711fe 100644
--- a/lib/chef/knife/ssl_check.rb
+++ b/lib/chef/knife/ssl_check.rb
@@ -151,26 +151,26 @@ class Chef
debug_ssl_settings
debug_chef_ssl_config
- 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.
-
+ 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
@@ -184,22 +184,22 @@ BAD_CERTS
debug_ssl_settings
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.
-
+ 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
@@ -211,17 +211,17 @@ 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.
+ 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
end
diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb
index 98c98d06ae..cc0ad3bbd6 100644
--- a/lib/chef/knife/ssl_fetch.rb
+++ b/lib/chef/knife/ssl_fetch.rb
@@ -130,13 +130,13 @@ class Chef
def run
validate_uri
- 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.
-
+ 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/knife/user_create.rb b/lib/chef/knife/user_create.rb
index 9273f0344d..a1761de979 100644
--- a/lib/chef/knife/user_create.rb
+++ b/lib/chef/knife/user_create.rb
@@ -69,17 +69,17 @@ class Chef
end
def osc_11_warning
- <<-EOF
-IF YOU ARE USING CHEF SERVER 12+, PLEASE FOLLOW THE INSTRUCTIONS UNDER knife user create --help.
-You only passed a single argument to knife user create.
-For backwards compatibility, when only a single argument is passed,
-knife user create assumes you want Open Source 11 Server user creation.
-knife user create for Open Source 11 Server is being deprecated.
-Open Source 11 Server user commands now live under the knife osc_user namespace.
-For backwards compatibility, we will forward this request to knife osc_user create.
-If you are using an Open Source 11 Server, please use that command to avoid this warning.
-NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
-in Chef 15 which will be released April 2019.
+ <<~EOF
+ IF YOU ARE USING CHEF SERVER 12+, PLEASE FOLLOW THE INSTRUCTIONS UNDER knife user create --help.
+ You only passed a single argument to knife user create.
+ For backwards compatibility, when only a single argument is passed,
+ knife user create assumes you want Open Source 11 Server user creation.
+ knife user create for Open Source 11 Server is being deprecated.
+ Open Source 11 Server user commands now live under the knife osc_user namespace.
+ For backwards compatibility, we will forward this request to knife osc_user create.
+ If you are using an Open Source 11 Server, please use that command to avoid this warning.
+ NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
+ in Chef 15 which will be released April 2019.
EOF
end
diff --git a/lib/chef/knife/user_delete.rb b/lib/chef/knife/user_delete.rb
index abfb45253e..b0a2ece065 100644
--- a/lib/chef/knife/user_delete.rb
+++ b/lib/chef/knife/user_delete.rb
@@ -30,15 +30,15 @@ class Chef
banner "knife user delete USER (options)"
def osc_11_warning
- <<-EOF
-The Chef Server you are using does not support the username field.
-This means it is an Open Source 11 Server.
-knife user delete for Open Source 11 Server is being deprecated.
-Open Source 11 Server user commands now live under the knife osc_user namespace.
-For backwards compatibility, we will forward this request to knife osc_user delete.
-If you are using an Open Source 11 Server, please use that command to avoid this warning.
-NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
-in Chef 15 which will be released April 2019.
+ <<~EOF
+ The Chef Server you are using does not support the username field.
+ This means it is an Open Source 11 Server.
+ knife user delete for Open Source 11 Server is being deprecated.
+ Open Source 11 Server user commands now live under the knife osc_user namespace.
+ For backwards compatibility, we will forward this request to knife osc_user delete.
+ If you are using an Open Source 11 Server, please use that command to avoid this warning.
+ NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
+ in Chef 15 which will be released April 2019.
EOF
end
diff --git a/lib/chef/knife/user_edit.rb b/lib/chef/knife/user_edit.rb
index d184b85a6c..8b89b847a9 100644
--- a/lib/chef/knife/user_edit.rb
+++ b/lib/chef/knife/user_edit.rb
@@ -30,15 +30,15 @@ class Chef
banner "knife user edit USER (options)"
def osc_11_warning
- <<-EOF
-The Chef Server you are using does not support the username field.
-This means it is an Open Source 11 Server.
-knife user edit for Open Source 11 Server is being deprecated.
-Open Source 11 Server user commands now live under the knife oc_user namespace.
-For backwards compatibility, we will forward this request to knife osc_user edit.
-If you are using an Open Source 11 Server, please use that command to avoid this warning.
-NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
-in Chef 15 which will be released April 2019.
+ <<~EOF
+ The Chef Server you are using does not support the username field.
+ This means it is an Open Source 11 Server.
+ knife user edit for Open Source 11 Server is being deprecated.
+ Open Source 11 Server user commands now live under the knife oc_user namespace.
+ For backwards compatibility, we will forward this request to knife osc_user edit.
+ If you are using an Open Source 11 Server, please use that command to avoid this warning.
+ NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
+ in Chef 15 which will be released April 2019.
EOF
end
diff --git a/lib/chef/knife/user_reregister.rb b/lib/chef/knife/user_reregister.rb
index b993dfc636..c79deb09a7 100644
--- a/lib/chef/knife/user_reregister.rb
+++ b/lib/chef/knife/user_reregister.rb
@@ -30,15 +30,15 @@ class Chef
banner "knife user reregister USER (options)"
def osc_11_warning
- <<-EOF
-The Chef Server you are using does not support the username field.
-This means it is an Open Source 11 Server.
-knife user reregister for Open Source 11 Server is being deprecated.
-Open Source 11 Server user commands now live under the knife osc_user namespace.
-For backwards compatibility, we will forward this request to knife osc_user reregister.
-If you are using an Open Source 11 Server, please use that command to avoid this warning.
-NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
-in Chef 15 which will be released April 2019.
+ <<~EOF
+ The Chef Server you are using does not support the username field.
+ This means it is an Open Source 11 Server.
+ knife user reregister for Open Source 11 Server is being deprecated.
+ Open Source 11 Server user commands now live under the knife osc_user namespace.
+ For backwards compatibility, we will forward this request to knife osc_user reregister.
+ If you are using an Open Source 11 Server, please use that command to avoid this warning.
+ NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
+ in Chef 15 which will be released April 2019.
EOF
end
diff --git a/lib/chef/knife/user_show.rb b/lib/chef/knife/user_show.rb
index 6ba4ab5016..c2842aa576 100644
--- a/lib/chef/knife/user_show.rb
+++ b/lib/chef/knife/user_show.rb
@@ -32,15 +32,15 @@ class Chef
banner "knife user show USER (options)"
def osc_11_warning
- <<-EOF
-The Chef Server you are using does not support the username field.
-This means it is an Open Source 11 Server.
-knife user show for Open Source 11 Server is being deprecated.
-Open Source 11 Server user commands now live under the knife osc_user namespace.
-For backwards compatibility, we will forward this request to knife osc_user show.
-If you are using an Open Source 11 Server, please use that command to avoid this warning.
-NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
-in Chef 15 which will be released April 2019.
+ <<~EOF
+ The Chef Server you are using does not support the username field.
+ This means it is an Open Source 11 Server.
+ knife user show for Open Source 11 Server is being deprecated.
+ Open Source 11 Server user commands now live under the knife osc_user namespace.
+ For backwards compatibility, we will forward this request to knife osc_user show.
+ If you are using an Open Source 11 Server, please use that command to avoid this warning.
+ NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
+ in Chef 15 which will be released April 2019.
EOF
end
diff --git a/lib/chef/mixin/api_version_request_handling.rb b/lib/chef/mixin/api_version_request_handling.rb
index 5566addf1d..5b9a588cac 100644
--- a/lib/chef/mixin/api_version_request_handling.rb
+++ b/lib/chef/mixin/api_version_request_handling.rb
@@ -50,12 +50,12 @@ class Chef
end
def reregister_only_v0_supported_error_msg(max_version, min_version)
- <<-EOH
-The reregister command only supports server API version 0.
-The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
-User keys are now managed via the key rotation commmands.
-Please refer to the documentation on how to manage your keys via the key rotation commands:
-https://docs.chef.io/server_security.html#key-rotation
+ <<~EOH
+ The reregister command only supports server API version 0.
+ The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
+ User keys are now managed via the key rotation commmands.
+ Please refer to the documentation on how to manage your keys via the key rotation commands:
+ https://docs.chef.io/server_security.html#key-rotation
EOH
end
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index c0066bfce5..6496d91de7 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -37,20 +37,20 @@
#
class Chef
class NodeMap
- COLLISION_WARNING_14 = <<-EOH.gsub(/\s+/, " ").strip
-%{type_caps} %{key} has been loaded from a cookbook. The %{type} %{key} is now
-included in Chef and will take precedence over the existing cookbook %{type} in the
-next major release of Chef (15.0, April 2019). You may be able to remove this cookbook dependency from
-your runlist if you do not use other recipes/resources/libraries from the cookbook.
-Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+ COLLISION_WARNING_14 = <<~EOH.gsub(/\s+/, " ").strip
+ %{type_caps} %{key} has been loaded from a cookbook. The %{type} %{key} is now
+ included in Chef and will take precedence over the existing cookbook %{type} in the
+ next major release of Chef (15.0, April 2019). You may be able to remove this cookbook dependency from
+ your runlist if you do not use other recipes/resources/libraries from the cookbook.
+ Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
EOH
- COLLISION_WARNING_15 = <<-EOH.gsub(/\s+/, " ").strip
-%{type_caps} %{key} attempted to load from a cookbook. The %{type} %{key} is now
-included in Chef and takes precedence over the existing cookbook %{type}
-which will be ignored. You may be able to remove this cookbook dependency from
-your runlist if you do not use other recipes/resources/libraries from the cookbook.
-Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+ COLLISION_WARNING_15 = <<~EOH.gsub(/\s+/, " ").strip
+ %{type_caps} %{key} attempted to load from a cookbook. The %{type} %{key} is now
+ included in Chef and takes precedence over the existing cookbook %{type}
+ which will be ignored. You may be able to remove this cookbook dependency from
+ your runlist if you do not use other recipes/resources/libraries from the cookbook.
+ Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
EOH
#
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index c60483d0dc..eb27b23408 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -31,12 +31,12 @@ class Chef
use_multipackage_api
PATHFINDING_POWERSHELL_COMMAND = "[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')".freeze
- CHOCO_MISSING_MSG = <<-EOS.freeze
-Could not locate your Chocolatey install. To install chocolatey, we recommend
-the 'chocolatey' cookbook (https://github.com/chocolatey/chocolatey-cookbook).
-If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment
-variable is correctly set. You can verify this with the PowerShell command
-'#{PATHFINDING_POWERSHELL_COMMAND}'.
+ CHOCO_MISSING_MSG = <<~EOS.freeze
+ Could not locate your Chocolatey install. To install chocolatey, we recommend
+ the 'chocolatey' cookbook (https://github.com/chocolatey/chocolatey-cookbook).
+ If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment
+ variable is correctly set. You can verify this with the PowerShell command
+ '#{PATHFINDING_POWERSHELL_COMMAND}'.
EOS
# Responsible for building the current_resource.
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index 5af73b8b69..6117fa4e1c 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -85,10 +85,10 @@ class Chef
# in that block will still trigger a syntax error which is
# exactly what we want here -- verify the syntax without
# actually running the script.
- user_code_wrapped_in_powershell_script_block = <<-EOH
-{
- #{new_resource.code}
-}
+ user_code_wrapped_in_powershell_script_block = <<~EOH
+ {
+ #{new_resource.code}
+ }
EOH
user_script_file.puts user_code_wrapped_in_powershell_script_block
@@ -146,75 +146,75 @@ EOH
# executed, otherwise 0 or 1 based on whether $? is set to true
# (success, where we return 0) or false (where we return 1).
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
-if ( get-module -ListAvailable Microsoft.PowerShell.Utility )
-{
- 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')
-{
- $exitstatus = [int32](!$chefscriptresult)
-}
-elseif ($lastcmdlet)
-{
- # Otherwise, a successful cmdlet execution defines the status
- $exitstatus = 0
-}
-elseif ( $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0 )
-{
- # If the cmdlet status is failed, allow the Win32 status
- # in $LASTEXITCODE to define exit status. This handles the case
- # where no cmdlets, only Win32 processes have run since $?
- # will be set to $false whenever a Win32 process returns a non-zero
- # 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,
-# 1 (i.e. failed) otherwise.
-exit $exitstatus
+ <<~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
+ if ( get-module -ListAvailable Microsoft.PowerShell.Utility )
+ {
+ 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')
+ {
+ $exitstatus = [int32](!$chefscriptresult)
+ }
+ elseif ($lastcmdlet)
+ {
+ # Otherwise, a successful cmdlet execution defines the status
+ $exitstatus = 0
+ }
+ elseif ( $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0 )
+ {
+ # If the cmdlet status is failed, allow the Win32 status
+ # in $LASTEXITCODE to define exit status. This handles the case
+ # where no cmdlets, only Win32 processes have run since $?
+ # will be set to $false whenever a Win32 process returns a non-zero
+ # 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,
+ # 1 (i.e. failed) otherwise.
+ exit $exitstatus
EOH
end
diff --git a/lib/chef/resource/resource_notification.rb b/lib/chef/resource/resource_notification.rb
index 24f8821b6b..a3475e3301 100644
--- a/lib/chef/resource/resource_notification.rb
+++ b/lib/chef/resource/resource_notification.rb
@@ -79,18 +79,18 @@ class Chef
self.resource = matching_resource
rescue Chef::Exceptions::ResourceNotFound => e
- err = Chef::Exceptions::ResourceNotFound.new(<<-FAIL)
-resource #{notifying_resource} is configured to notify resource #{resource} with action #{action}, \
-but #{resource} cannot be found in the resource collection. #{notifying_resource} is defined in \
-#{notifying_resource.source_line}
+ err = Chef::Exceptions::ResourceNotFound.new(<<~FAIL)
+ resource #{notifying_resource} is configured to notify resource #{resource} with action #{action}, \
+ but #{resource} cannot be found in the resource collection. #{notifying_resource} is defined in \
+ #{notifying_resource.source_line}
FAIL
err.set_backtrace(e.backtrace)
raise err
rescue Chef::Exceptions::InvalidResourceSpecification => e
- err = Chef::Exceptions::InvalidResourceSpecification.new(<<-F)
-Resource #{notifying_resource} is configured to notify resource #{resource} with action #{action}, \
-but #{resource.inspect} is not valid syntax to look up a resource in the resource collection. Notification \
-is defined near #{notifying_resource.source_line}
+ err = Chef::Exceptions::InvalidResourceSpecification.new(<<~F)
+ Resource #{notifying_resource} is configured to notify resource #{resource} with action #{action}, \
+ but #{resource.inspect} is not valid syntax to look up a resource in the resource collection. Notification \
+ is defined near #{notifying_resource.source_line}
F
err.set_backtrace(e.backtrace)
raise err
@@ -112,18 +112,18 @@ is defined near #{notifying_resource.source_line}
self.notifying_resource = matching_notifier
rescue Chef::Exceptions::ResourceNotFound => e
- err = Chef::Exceptions::ResourceNotFound.new(<<-FAIL)
-Resource #{resource} is configured to receive notifications from #{notifying_resource} with action #{action}, \
-but #{notifying_resource} cannot be found in the resource collection. #{resource} is defined in \
-#{resource.source_line}
+ err = Chef::Exceptions::ResourceNotFound.new(<<~FAIL)
+ Resource #{resource} is configured to receive notifications from #{notifying_resource} with action #{action}, \
+ but #{notifying_resource} cannot be found in the resource collection. #{resource} is defined in \
+ #{resource.source_line}
FAIL
err.set_backtrace(e.backtrace)
raise err
rescue Chef::Exceptions::InvalidResourceSpecification => e
- err = Chef::Exceptions::InvalidResourceSpecification.new(<<-F)
-Resource #{resource} is configured to receive notifications from #{notifying_resource} with action #{action}, \
-but #{notifying_resource.inspect} is not valid syntax to look up a resource in the resource collection. Notification \
-is defined near #{resource.source_line}
+ err = Chef::Exceptions::InvalidResourceSpecification.new(<<~F)
+ Resource #{resource} is configured to receive notifications from #{notifying_resource} with action #{action}, \
+ but #{notifying_resource.inspect} is not valid syntax to look up a resource in the resource collection. Notification \
+ is defined near #{resource.source_line}
F
err.set_backtrace(e.backtrace)
raise err
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb
index 2b8c7cda30..a11cc676eb 100644
--- a/lib/chef/run_context.rb
+++ b/lib/chef/run_context.rb
@@ -331,12 +331,12 @@ class Chef
cookbook_name, recipe_short_name = Chef::Recipe.parse_recipe_name(recipe_name, current_cookbook: current_cookbook)
if unreachable_cookbook?(cookbook_name) # CHEF-4367
- logger.warn(<<-ERROR_MESSAGE)
-MissingCookbookDependency:
-Recipe `#{recipe_name}` is not in the run_list, and cookbook '#{cookbook_name}'
-is not a dependency of any cookbook in the run_list. To load this recipe,
-first add a dependency on cookbook '#{cookbook_name}' in the cookbook you're
-including it from in that cookbook's metadata.
+ logger.warn(<<~ERROR_MESSAGE)
+ MissingCookbookDependency:
+ Recipe `#{recipe_name}` is not in the run_list, and cookbook '#{cookbook_name}'
+ is not a dependency of any cookbook in the run_list. To load this recipe,
+ first add a dependency on cookbook '#{cookbook_name}' in the cookbook you're
+ including it from in that cookbook's metadata.
ERROR_MESSAGE
end
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index 70c93f653b..6c5f70edcc 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -207,14 +207,14 @@ module Shell
banner("chef-shell #{Chef::VERSION}\n\nUsage: chef-shell [NAMED_CONF] (OPTIONS)")
- footer(<<-FOOTER)
-When no CONFIG is specified, chef-shell attempts to load a default configuration file:
-* If a NAMED_CONF is given, chef-shell will load ~/.chef/NAMED_CONF/chef_shell.rb
-* If no NAMED_CONF is given chef-shell will load ~/.chef/chef_shell.rb if it exists
-* If no chef_shell.rb can be found, chef-shell falls back to load:
- /etc/chef/client.rb if -z option is given.
- /etc/chef/solo.rb if --solo-legacy-mode option is given.
- .chef/knife.rb if -s option is given.
+ footer(<<~FOOTER)
+ When no CONFIG is specified, chef-shell attempts to load a default configuration file:
+ * If a NAMED_CONF is given, chef-shell will load ~/.chef/NAMED_CONF/chef_shell.rb
+ * If no NAMED_CONF is given chef-shell will load ~/.chef/chef_shell.rb if it exists
+ * If no chef_shell.rb can be found, chef-shell falls back to load:
+ /etc/chef/client.rb if -z option is given.
+ /etc/chef/solo.rb if --solo-legacy-mode option is given.
+ .chef/knife.rb if -s option is given.
FOOTER
option :config_file,
diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb
index 727eb6b344..558c8ad5ca 100644
--- a/lib/chef/shell/ext.rb
+++ b/lib/chef/shell/ext.rb
@@ -190,12 +190,12 @@ module Shell
extend Shell::Extensions::ObjectCoreExtensions
desc "prints this help message"
- explain(<<-E)
-## SUMMARY ##
- When called with no argument, +help+ prints a table of all
- chef-shell commands. When called with an argument COMMAND, +help+
- prints a detailed explanation of the command if available, or the
- description if no explanation is available.
+ explain(<<~E)
+ ## SUMMARY ##
+ When called with no argument, +help+ prints a table of all
+ chef-shell commands. When called with an argument COMMAND, +help+
+ prints a detailed explanation of the command if available, or the
+ description if no explanation is available.
E
def help(commmand = nil)
if commmand
@@ -302,18 +302,18 @@ module Shell
RESTApiExtensions = Proc.new do
desc "edit an object in your EDITOR"
- explain(<<-E)
-## 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"
- 2. Looks for an EDITOR configured in your chef-shell config file
- 3. Uses the value of the EDITOR environment variable
+ explain(<<~E)
+ ## 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"
+ 2. Looks for an EDITOR configured in your chef-shell config file
+ 3. Uses the value of the EDITOR environment variable
E
def edit(object)
unless Shell.editor
@@ -340,58 +340,58 @@ module Shell
end
desc "Find and edit API clients"
- explain(<<-E)
-## 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)
- true
- else
- nil
- end
- end
-
- This will strip the admin privileges from any client named after borat.
+ explain(<<~E)
+ ## 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)
+ true
+ else
+ nil
+ end
+ end
+
+ This will strip the admin privileges from any client named after borat.
E
subcommands all: "list all api clients",
show: "load an api client by name",
@@ -410,50 +410,50 @@ module Shell
end
desc "Find and edit nodes via the API"
- 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.
+ 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",
show: "load a node by name",
@@ -464,18 +464,18 @@ module Shell
end
desc "Find and edit roles via the API"
- 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.
+ 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
subcommands all: "list all roles",
show: "load a role by name",
@@ -486,22 +486,22 @@ module Shell
end
desc "Find and edit +databag_name+ via the api"
- explain(<<-E)
-## SUMMARY ##
- +databags(DATABAG_NAME)+ allows you to query and edit data bag items on your
- 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.
-
+ explain(<<~E)
+ ## SUMMARY ##
+ +databags(DATABAG_NAME)+ allows you to query and edit data bag items on your
+ 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",
@@ -513,18 +513,18 @@ module Shell
end
desc "Find and edit environments via the API"
- 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.
+ 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
subcommands all: "list all environments",
show: "load an environment by name",
diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb
index 78092b3c0d..409730ce20 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -81,16 +81,16 @@ class Chef::Util::DSC
end
def configuration_code(code, configuration_name, imports)
- <<-EOF
-$ProgressPreference = 'SilentlyContinue';
-Configuration '#{configuration_name}'
-{
- #{generate_import_resource_statements(imports).join(" \n")}
- node 'localhost'
- {
- #{code}
- }
-}
+ <<~EOF
+ $ProgressPreference = 'SilentlyContinue';
+ Configuration '#{configuration_name}'
+ {
+ #{generate_import_resource_statements(imports).join(" \n")}
+ node 'localhost'
+ {
+ #{code}
+ }
+ }
EOF
end