diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-11-07 17:04:33 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-11-07 17:05:14 -0800 |
commit | 06078faf3d2052debeab50a46e52ecaf243c6d4d (patch) | |
tree | 4211692ce9fa3366b733f847d8fe3aab394ecd56 /spec | |
parent | 929f3d0a057443151832151a3065c557f1c1580e (diff) | |
download | chef-06078faf3d2052debeab50a46e52ecaf243c6d4d.tar.gz |
Merge pull request #2368 from opscode/sersut/knife-cloud-bootstrap-options
Knife cloud plugins bootstrap problem with Chef 12 when using custom templates.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index 2599e44a56..9769be5b8a 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -29,7 +29,7 @@ describe Chef::Knife::Bootstrap do Chef::Log.logger = Logger.new(StringIO.new) Chef::Config[:knife][:bootstrap_template] = bootstrap_template unless bootstrap_template.nil? - k = Chef::Knife::Bootstrap.new + k = Chef::Knife::Bootstrap.new(bootstrap_cli_options) k.merge_configs k.ui.stub(:stderr).and_return(stderr) @@ -41,11 +41,37 @@ describe Chef::Knife::Bootstrap do let(:bootstrap_template) { nil } + let(:bootstrap_cli_options) { [ ] } + it "should use chef-full as default template" do knife.bootstrap_template.should be_a_kind_of(String) File.basename(knife.bootstrap_template).should eq("chef-full") end + context "with :distro and :bootstrap_template cli options" do + let(:bootstrap_cli_options) { [ "--bootstrap-template", "my-template", "--distro", "other-template" ] } + + it "should select bootstrap template" do + expect(File.basename(knife.bootstrap_template)).to eq("my-template") + end + end + + context "with :distro and :template_file cli options" do + let(:bootstrap_cli_options) { [ "--distro", "my-template", "--template-file", "other-template" ] } + + it "should select bootstrap template" do + expect(File.basename(knife.bootstrap_template)).to eq("other-template") + end + end + + context "with :bootstrap_template and :template_file cli options" do + let(:bootstrap_cli_options) { [ "--bootstrap-template", "my-template", "--template-file", "other-template" ] } + + it "should select bootstrap template" do + expect(File.basename(knife.bootstrap_template)).to eq("my-template") + end + end + context "when finding templates" do context "when :bootstrap_template config is set to a file" do context "that doesn't exist" do |