summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-06-03 22:48:09 -0700
committerGitHub <noreply@github.com>2019-06-03 22:48:09 -0700
commit58fb2f23ea4daf7b4fae9a6538e42b08c6e87339 (patch)
treeb07621463768be0f37db2ac6ef9b50a5e811a769
parent8ab574c75ada5112b89149cc63b3a4f007664974 (diff)
parent06662be51728188d982abe57fdcab35593fe4e9b (diff)
downloadchef-58fb2f23ea4daf7b4fae9a6538e42b08c6e87339.tar.gz
Merge pull request #8631 from chef/btm/bootstrap-binmode
Create bootstrap template in binmode to fix line endings
-rw-r--r--lib/chef/knife/bootstrap/train_connector.rb1
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef/knife/bootstrap/train_connector.rb b/lib/chef/knife/bootstrap/train_connector.rb
index af09a8c366..a29581a51d 100644
--- a/lib/chef/knife/bootstrap/train_connector.rb
+++ b/lib/chef/knife/bootstrap/train_connector.rb
@@ -148,6 +148,7 @@ class Chef
# @return NilClass
def upload_file_content!(content, remote_path)
t = Tempfile.new("chef-content")
+ t.binmode
t << content
t.close
upload_file!(t.path, remote_path)
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index 385a192648..c3c559c65b 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -171,6 +171,7 @@ describe Chef::Knife::Bootstrap::TrainConnector do
expect(File.read(local_path)).to eq "test data"
expect(remote_path).to eq "/target/path"
end
+ expect_any_instance_of(Tempfile).to receive(:binmode)
subject.upload_file_content!("test data", "/target/path")
end
end