Class: ChefApply::Action::GenerateLocalPolicy
- Inherits:
-
Base
- Object
- Base
- ChefApply::Action::GenerateLocalPolicy
show all
- Defined in:
- lib/chef_apply/action/generate_local_policy.rb
Constant Summary
Constants inherited
from Base
Base::PATH_MAPPING
Instance Attribute Summary collapse
Attributes inherited from Base
#config, #target_host
Instance Method Summary
collapse
Methods inherited from Base
#escape_windows_path, #name, #notify, #run, #run_chef
Constructor Details
23
24
25
26
|
# File 'lib/chef_apply/action/generate_local_policy.rb', line 23
def initialize(config)
super(config)
@cookbook = config.delete :cookbook
end
|
Instance Attribute Details
#archive_file_location ⇒ Object
Returns the value of attribute archive_file_location.
22
23
24
|
# File 'lib/chef_apply/action/generate_local_policy.rb', line 22
def archive_file_location
@archive_file_location
end
|
Instance Method Details
#exporter ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/chef_apply/action/generate_local_policy.rb', line 39
def exporter
require "chef-dk/policyfile_services/export_repo"
@exporter ||=
ChefDK::PolicyfileServices::ExportRepo.new(policyfile: @cookbook.policyfile_lock_path,
root_dir: @cookbook.path,
export_dir: @cookbook.export_path,
archive: true, force: true)
end
|
#installer ⇒ Object
48
49
50
51
52
53
|
# File 'lib/chef_apply/action/generate_local_policy.rb', line 48
def installer
require "chef-dk/policyfile_services/install"
require "chef-dk/ui"
@installer ||=
ChefDK::PolicyfileServices::Install.new(ui: ChefDK::UI.null(), root_dir: @cookbook.path)
end
|
28
29
30
31
32
33
34
35
36
37
|
# 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 ChefDK::PolicyfileInstallError => e
raise PolicyfileInstallError.new(e)
end
|