extend the omnibus command builder with an additional download_path parameter
This commit is contained in:
parent
9e7f705bad
commit
d7bd65b4e2
|
@ -5,10 +5,10 @@ module VagrantPlugins
|
|||
|
||||
# Read more about the Omnibus installer here:
|
||||
# https://docs.getchef.com/install_omnibus.html
|
||||
def build_command(version, prerelease = false)
|
||||
def build_command(version, prerelease = false, download_path = nil)
|
||||
command = "curl -sL #{OMNITRUCK} | sudo bash"
|
||||
|
||||
if prerelease || version != :latest
|
||||
if prerelease || version != :latest || download_path != nil
|
||||
command << " -s --"
|
||||
end
|
||||
|
||||
|
@ -20,6 +20,10 @@ module VagrantPlugins
|
|||
command << " -v \"#{version}\""
|
||||
end
|
||||
|
||||
if download_path
|
||||
command << " -d \"#{download_path}\""
|
||||
end
|
||||
|
||||
command
|
||||
end
|
||||
module_function :build_command
|
||||
|
|
|
@ -7,8 +7,9 @@ describe VagrantPlugins::Chef::Omnibus, :focus do
|
|||
|
||||
let(:version) { :latest }
|
||||
let(:prerelease) { false }
|
||||
let(:download_path) { nil }
|
||||
|
||||
let(:build_command) { described_class.build_command(version, prerelease) }
|
||||
let(:build_command) { described_class.build_command(version, prerelease, download_path) }
|
||||
|
||||
context "when prerelease is given" do
|
||||
let(:prerelease) { true }
|
||||
|
@ -18,6 +19,14 @@ describe VagrantPlugins::Chef::Omnibus, :focus do
|
|||
end
|
||||
end
|
||||
|
||||
context "when download_path is given" do
|
||||
let(:download_path) { '/tmp/path/to/omnibuses' }
|
||||
|
||||
it "returns the correct command" do
|
||||
expect(build_command).to eq("#{prefix} | sudo bash -s -- -d \"/tmp/path/to/omnibuses\"")
|
||||
end
|
||||
end
|
||||
|
||||
context "when version is :latest" do
|
||||
let(:version) { :latest }
|
||||
|
||||
|
@ -34,12 +43,13 @@ describe VagrantPlugins::Chef::Omnibus, :focus do
|
|||
end
|
||||
end
|
||||
|
||||
context "when prerelease and version are given" do
|
||||
context "when prerelease and version and download_path are given" do
|
||||
let(:version) { "1.2.3" }
|
||||
let(:prerelease) { true }
|
||||
let(:download_path) { "/some/path" }
|
||||
|
||||
it "returns the correct command" do
|
||||
expect(build_command).to eq("#{prefix} | sudo bash -s -- -p -v \"1.2.3\"")
|
||||
expect(build_command).to eq("#{prefix} | sudo bash -s -- -p -v \"1.2.3\" -d \"/some/path\"")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue