diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-12-08 15:56:22 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-12-08 18:41:51 -0800 |
commit | e24146bec9a972166724cb93ac717a1c71b95e57 (patch) | |
tree | 9c686c64527bf4257c3541b6044c832cff7b5789 | |
parent | 4c37b87e6f9e78d60e31fe498f2a9a4460f155b8 (diff) | |
download | chef-e24146bec9a972166724cb93ac717a1c71b95e57.tar.gz |
knife-windows bootstrap context inherits from Chef::Knife::Core::BootstrapContext
and uses the Chef 11 arity in its constructor (https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/core/windows_bootstrap_context.rb#L36)
In order to protect compatibility with knife-windows make sure that we have a default
for the new parameter that is added to the BootstrapContext constructor.
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/core/bootstrap_context_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index ffc36436ec..f7fee023de 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -30,7 +30,7 @@ class Chef # class BootstrapContext - def initialize(config, run_list, chef_config, secret) + def initialize(config, run_list, chef_config, secret = nil) @config = config @run_list = run_list @chef_config = chef_config diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index af8fa3f698..e7d2464fa1 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -34,6 +34,10 @@ describe Chef::Knife::Core::BootstrapContext do subject(:bootstrap_context) { described_class.new(config, run_list, chef_config, secret) } + it "initializes with Chef 11 parameters" do + expect{described_class.new(config, run_list, chef_config)}.not_to raise_error + end + it "runs chef with the first-boot.json in the _default environment" do expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -E _default" end |