Class: ChefApply::Action::GenerateLocalPolicy
- Defined in:
- lib/chef_apply/action/generate_local_policy.rb
Instance Attribute Summary collapse
- 
  
    
      #archive_file_location  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute archive_file_location. 
Attributes inherited from Base
Instance Method Summary collapse
- #exporter ⇒ Object
- 
  
    
      #initialize(config)  ⇒ GenerateLocalPolicy 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of GenerateLocalPolicy. 
- #installer ⇒ Object
- #perform_action ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(config) ⇒ GenerateLocalPolicy
Returns a new instance of GenerateLocalPolicy.
| 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 (readonly)
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-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 ⇒ Object
| 48 49 50 51 52 53 | # 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 ⇒ Object
| 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 ChefCLI::PolicyfileInstallError => e raise PolicyfileInstallError.new(e) end |