class ChefApply::Action::GenerateLocalPolicy
Attributes
archive_file_location[R]
Public Class Methods
new(config)
click to toggle source
Calls superclass method
ChefApply::Action::Base::new
# File lib/chef_apply/action/generate_local_policy.rb, line 23 def initialize(config) super(config) @cookbook = config.delete :cookbook end
Public Instance Methods
exporter()
click to toggle source
# File lib/chef_apply/action/generate_local_policy.rb, line 39 def exporter require "chef-cli/policyfile_services/export_repo" @exporter ||= ChefCLI::PolicyfileServices::ExportRepo.new(policyfile: @cookbook.policyfile_lock_path, root_dir: @cookbook.path, export_dir: @cookbook.export_path, archive: true, force: true) end
installer()
click to toggle source
# File lib/chef_apply/action/generate_local_policy.rb, line 48 def installer require "chef-cli/policyfile_services/install" require "chef-cli/ui" @installer ||= ChefCLI::PolicyfileServices::Install.new(ui: ChefCLI::UI.null, root_dir: @cookbook.path) end
perform_action()
click to toggle source
# File lib/chef_apply/action/generate_local_policy.rb, line 28 def perform_action notify(:generating) installer.run notify(:exporting) exporter.run @archive_file_location = exporter.archive_file_location notify(:success) rescue ChefCLI::PolicyfileInstallError => e raise PolicyfileInstallError.new(e) end