diff --git a/Gemfile.lock b/Gemfile.lock index 000375571c..df29499775 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: chef-apply (0.3.2) chef (>= 15.0) - chef-dk (>= 4.0) + chef-cli (>= 1.0.3) chef-telemetry license-acceptance (~> 1.0, >= 1.0.11) mixlib-cli @@ -33,11 +33,11 @@ GEM debug_inspector (>= 0.0.1) builder (3.2.3) byebug (11.0.1) - chef (15.0.300) + chef (15.1.36) addressable bcrypt_pbkdf (~> 1.0) bundler (>= 1.10) - chef-config (= 15.0.300) + chef-config (= 15.1.36) chef-zero (>= 14.0.11) diff-lcs (~> 1.2, >= 1.2.4) ed25519 (~> 1.2) @@ -50,7 +50,7 @@ GEM license-acceptance (~> 1.0, >= 1.0.5) mixlib-archive (>= 0.4, < 2.0) mixlib-authentication (~> 2.1) - mixlib-cli (>= 1.7, < 3.0) + mixlib-cli (>= 2.1.1, < 3.0) mixlib-log (>= 2.0.3, < 4.0) mixlib-shellout (>= 2.4, < 4.0) net-sftp (~> 2.1, >= 2.1.2) @@ -63,13 +63,7 @@ GEM train-core (~> 2.0, >= 2.0.12) tty-screen (~> 0.6) uuidtools (~> 2.1.5) - chef-config (15.0.300) - addressable - fuzzyurl - mixlib-config (>= 2.2.12, < 4.0) - mixlib-shellout (>= 2.0, < 4.0) - tomlrb (~> 1.2) - chef-dk (4.0.60) + chef-cli (1.0.3) addressable (>= 2.3.5, < 2.6) chef (~> 15.0) cookbook-omnifetch (~> 0.5) @@ -81,6 +75,12 @@ GEM mixlib-shellout (>= 2.0, < 4.0) paint (~> 1.0) solve (> 2.0, < 5.0) + chef-config (15.1.36) + addressable + fuzzyurl + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) + tomlrb (~> 1.2) chef-telemetry (0.1.8) chef-config concurrent-ruby (~> 1.0) @@ -97,7 +97,7 @@ GEM citrus (3.0.2) coderay (1.1.2) concurrent-ruby (1.1.5) - cookbook-omnifetch (0.8.1) + cookbook-omnifetch (0.9.0) mixlib-archive (>= 0.4, < 2.0) debug_inspector (0.0.3) declarative (0.0.10) @@ -107,7 +107,7 @@ GEM docker-api (1.34.2) excon (>= 0.47.0) multi_json - domain_name (0.5.20180417) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) ed25519 (1.2.4) equatable (0.6.1) diff --git a/chef-apply.gemspec b/chef-apply.gemspec index a5380e73f2..5b52aaed79 100644 --- a/chef-apply.gemspec +++ b/chef-apply.gemspec @@ -52,7 +52,7 @@ Gem::Specification.new do |spec| spec.add_dependency "pastel" # A color library spec.add_dependency "tty-spinner" # Pretty output for status updates in the CLI spec.add_dependency "chef", ">= 15.0" # Needed to load cookbooks - spec.add_dependency "chef-dk", ">= 4.0" + spec.add_dependency "chef-cli", ">= 1.0.3 " # Policyfile spec.add_dependency "chef-telemetry" spec.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11" diff --git a/lib/chef_apply/action/generate_local_policy.rb b/lib/chef_apply/action/generate_local_policy.rb index 086f8bc2b9..c0636b0f83 100644 --- a/lib/chef_apply/action/generate_local_policy.rb +++ b/lib/chef_apply/action/generate_local_policy.rb @@ -32,24 +32,24 @@ def perform_action exporter.run @archive_file_location = exporter.archive_file_location notify(:success) - rescue ChefDK::PolicyfileInstallError => e + rescue ChefCLI::PolicyfileInstallError => e raise PolicyfileInstallError.new(e) end def exporter - require "chef-dk/policyfile_services/export_repo" + require "chef-cli/policyfile_services/export_repo" @exporter ||= - ChefDK::PolicyfileServices::ExportRepo.new(policyfile: @cookbook.policyfile_lock_path, + ChefCLI::PolicyfileServices::ExportRepo.new(policyfile: @cookbook.policyfile_lock_path, root_dir: @cookbook.path, export_dir: @cookbook.export_path, archive: true, force: true) end def installer - require "chef-dk/policyfile_services/install" - require "chef-dk/ui" + require "chef-cli/policyfile_services/install" + require "chef-cli/ui" @installer ||= - ChefDK::PolicyfileServices::Install.new(ui: ChefDK::UI.null(), root_dir: @cookbook.path) + ChefCLI::PolicyfileServices::Install.new(ui: ChefCLI::UI.null(), root_dir: @cookbook.path) end end diff --git a/spec/unit/action/generate_local_policy_spec.rb b/spec/unit/action/generate_local_policy_spec.rb index 5206f4e886..4511631f80 100644 --- a/spec/unit/action/generate_local_policy_spec.rb +++ b/spec/unit/action/generate_local_policy_spec.rb @@ -16,9 +16,9 @@ # require "spec_helper" require "chef_apply/action/generate_local_policy" -require "chef-dk/policyfile_services/install" -require "chef-dk/ui" -require "chef-dk/policyfile_services/export_repo" +require "chef-cli/policyfile_services/install" +require "chef-cli/ui" +require "chef-cli/policyfile_services/export_repo" RSpec.describe ChefApply::Action::GenerateLocalPolicy do subject { ChefApply::Action::GenerateLocalPolicy.new(cookbook: cookbook) } @@ -30,11 +30,11 @@ end let(:installer_double) do - instance_double(ChefDK::PolicyfileServices::Install, run: :ok) + instance_double(ChefCLI::PolicyfileServices::Install, run: :ok) end let(:exporter_double) do - instance_double(ChefDK::PolicyfileServices::ExportRepo, + instance_double(ChefCLI::PolicyfileServices::ExportRepo, archive_file_location: "/path/to/export", run: :ok) end @@ -62,7 +62,7 @@ context "when PolicyfileServices raises an error" do it "reraises as PolicyfileInstallError" do expect(subject).to receive(:installer).and_return installer_double - expect(installer_double).to receive(:run).and_raise(ChefDK::PolicyfileInstallError.new("", nil)) + expect(installer_double).to receive(:run).and_raise(ChefCLI::PolicyfileInstallError.new("", nil)) expect { subject.perform_action }.to raise_error(ChefApply::Action::PolicyfileInstallError) end end @@ -72,7 +72,7 @@ # There is an issue with policyfile generation where, if we have a cookbook with too long # of a name or directory name the policyfile will not generate. This is because the tar - # library that ChefDK uses comes from the Rubygems package and is meant for packaging + # library that ChefCLI uses comes from the Rubygems package and is meant for packaging # gems up, so it can impose a 100 character limit. We attempt to solve this by ensuring # that the paths/names we generate with `TempCookbook` are short. # @@ -80,7 +80,7 @@ # 2018-05-18 mp addendum: this cna take upwards of 15s to run on ci nodes, pending # for now since it's not testing any Chef Apply functionality. xit "fails to create when there is a long path name" do - err = ChefDK::PolicyfileExportRepoError + err = ChefCLI::PolicyfileExportRepoError expect { subject.perform_action }.to raise_error(err) do |e| expect(e.cause.class).to eq(Gem::Package::TooLongFileName) expect(e.cause.message).to match(/should be 100 or less/) @@ -92,7 +92,7 @@ describe "#exporter" do it "returns a correctly constructed ExportRepo" do - expect(ChefDK::PolicyfileServices::ExportRepo).to receive(:new) + expect(ChefCLI::PolicyfileServices::ExportRepo).to receive(:new) .with(policyfile: cookbook.policyfile_lock_path, root_dir: cookbook.path, export_dir: cookbook.export_path, @@ -104,8 +104,8 @@ describe "#installer" do it "returns a correctly constructed Install service" do - expect(ChefDK::PolicyfileServices::Install).to receive(:new) - .with(ui: ChefDK::UI, root_dir: cookbook.path) + expect(ChefCLI::PolicyfileServices::Install).to receive(:new) + .with(ui: ChefCLI::UI, root_dir: cookbook.path) .and_return(installer_double) expect(subject.installer).to eq installer_double end diff --git a/spec/unit/cli_spec.rb b/spec/unit/cli_spec.rb index 081e82d98e..a396d5c40b 100644 --- a/spec/unit/cli_spec.rb +++ b/spec/unit/cli_spec.rb @@ -23,9 +23,7 @@ require "chef_apply/ui/terminal" require "chef_apply/action/generate_temp_cookbook" -require "chef-dk/ui" -require "chef-dk/policyfile_services/export_repo" -require "chef-dk/policyfile_services/install" +require "chef-cli/ui" RSpec.describe ChefApply::CLI do subject { ChefApply::CLI.new(argv) }