Class: PuppetX::Puppetlabs::Migration::CatalogDeltaModel::ResourceConflict
- Inherits:
-
Diff
- Object
- DeltaEntity
- Diff
- PuppetX::Puppetlabs::Migration::CatalogDeltaModel::ResourceConflict
- Defined in:
- lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb
Overview
Represents a resource conflict between a resource in the baseline and a resource with the same type and title in the preview
Instance Attribute Summary collapse
- #added_attribute_count ⇒ Object readonly
- #added_attributes ⇒ Object readonly
- #baseline_location ⇒ Object readonly
- #conflicting_attribute_count ⇒ Object readonly
- #conflicting_attributes ⇒ Object readonly
- #equal_attribute_count ⇒ Object readonly
- #missing_attribute_count ⇒ Object readonly
- #missing_attributes ⇒ Object readonly
- #preview_location ⇒ Object readonly
- #title ⇒ Object readonly
- #type ⇒ Object readonly
Attributes inherited from Diff
Instance Method Summary collapse
- #assign_ids(start) ⇒ Object
- #compliant? ⇒ Boolean
-
#initialize(baseline_location, preview_location, type, title, equal_attribute_count, added_attributes, missing_attributes, conflicting_attributes) ⇒ ResourceConflict
constructor
A new instance of ResourceConflict.
- #initialize_from_hash(hash) ⇒ Object
Methods inherited from DeltaEntity
Methods included from ModelObject
Constructor Details
#initialize(baseline_location, preview_location, type, title, equal_attribute_count, added_attributes, missing_attributes, conflicting_attributes) ⇒ ResourceConflict
Returns a new instance of ResourceConflict.
344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 344 def initialize(baseline_location, preview_location, type, title, equal_attribute_count, added_attributes, missing_attributes, conflicting_attributes) @baseline_location = baseline_location @preview_location = preview_location @type = type @title = title @equal_attribute_count = equal_attribute_count @added_attributes = added_attributes @added_attribute_count = added_attributes.size @missing_attributes = missing_attributes @missing_attribute_count = missing_attributes.size @conflicting_attributes = conflicting_attributes @conflicting_attribute_count = conflicting_attributes.size end |
Instance Attribute Details
#added_attribute_count ⇒ Object (readonly)
324 325 326 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 324 def added_attribute_count @added_attribute_count end |
#added_attributes ⇒ Object (readonly)
304 305 306 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 304 def added_attributes @added_attributes end |
#baseline_location ⇒ Object (readonly)
284 285 286 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 284 def baseline_location @baseline_location end |
#conflicting_attribute_count ⇒ Object (readonly)
334 335 336 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 334 def conflicting_attribute_count @conflicting_attribute_count end |
#conflicting_attributes ⇒ Object (readonly)
314 315 316 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 314 def conflicting_attributes @conflicting_attributes end |
#equal_attribute_count ⇒ Object (readonly)
319 320 321 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 319 def equal_attribute_count @equal_attribute_count end |
#missing_attribute_count ⇒ Object (readonly)
329 330 331 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 329 def missing_attribute_count @missing_attribute_count end |
#missing_attributes ⇒ Object (readonly)
309 310 311 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 309 def missing_attributes @missing_attributes end |
#preview_location ⇒ Object (readonly)
289 290 291 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 289 def preview_location @preview_location end |
#title ⇒ Object (readonly)
299 300 301 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 299 def title @title end |
#type ⇒ Object (readonly)
294 295 296 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 294 def type @type end |
Instance Method Details
#assign_ids(start) ⇒ Object
358 359 360 361 362 363 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 358 def assign_ids(start) start = super start = assign_ids_on_each(start, added_attributes) start = assign_ids_on_each(start, missing_attributes) assign_ids_on_each(start, conflicting_attributes) end |
#compliant? ⇒ Boolean
365 366 367 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 365 def compliant? @missing_attribute_count == 0 && @conflicting_attributes.all? { |ca| ca.compliant? } end |
#initialize_from_hash(hash) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 369 def initialize_from_hash(hash) hash.each_pair do |k, v| k = :"@#{k}" instance_variable_set(k, case k when :@baseline_location, :@preview_location Location.from_hash(v) when :@added_attributes, :@missing_attributes v.map { |rh| Attribute.from_hash(rh) } when :@conflicting_attributes v.map { |rh| AttributeConflict.from_hash(rh) } else v end) end end |