Class: ChefCLI::Policyfile::ComparisonBase::PolicyGroup
- Inherits:
 - 
      Object
      
        
- Object
 - ChefCLI::Policyfile::ComparisonBase::PolicyGroup
 
 
- Defined in:
 - lib/chef-cli/policyfile/comparison_base.rb
 
Instance Attribute Summary collapse
- 
  
    
      #group  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute group.
 - 
  
    
      #http_client  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute http_client.
 - 
  
    
      #policy_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute policy_name.
 
Instance Method Summary collapse
- 
  
    
      #initialize(group, policy_name, http_client)  ⇒ PolicyGroup 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of PolicyGroup.
 - #lock ⇒ Object
 - #name ⇒ Object
 
Constructor Details
#initialize(group, policy_name, http_client) ⇒ PolicyGroup
Returns a new instance of PolicyGroup.
      102 103 104 105 106  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 102 def initialize(group, policy_name, http_client) @group = group @policy_name = policy_name @http_client = http_client end  | 
  
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
      98 99 100  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 98 def group @group end  | 
  
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
      100 101 102  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 100 def http_client @http_client end  | 
  
#policy_name ⇒ Object (readonly)
Returns the value of attribute policy_name.
      99 100 101  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 99 def policy_name @policy_name end  | 
  
Instance Method Details
#lock ⇒ Object
      112 113 114 115 116 117 118 119 120 121 122  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 112 def lock http_client.get("policy_groups/#{group}/policies/#{policy_name}") rescue Net::ProtocolError => e if e.respond_to?(:response) && e.response.code.to_s == "404" raise PolicyfileDownloadError.new("No Policyfile lock named '#{policy_name}' found in policy_group '#{group}' at #{http_client.url}", e) else raise PolicyfileDownloadError.new("HTTP error attempting to fetch Policyfile lock from #{http_client.url}", e) end rescue => e raise PolicyfileDownloadError.new("Failed to fetch Policyfile lock from #{http_client.url}", e) end  | 
  
#name ⇒ Object
      108 109 110  | 
    
      # File 'lib/chef-cli/policyfile/comparison_base.rb', line 108 def name "policy_group:#{group}" end  |