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
- #finish_attributes ⇒ Object
-
#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.
356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 356 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)
336 337 338 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 336 def added_attribute_count @added_attribute_count end |
#added_attributes ⇒ Object (readonly)
316 317 318 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 316 def added_attributes @added_attributes end |
#baseline_location ⇒ Object (readonly)
296 297 298 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 296 def baseline_location @baseline_location end |
#conflicting_attribute_count ⇒ Object (readonly)
346 347 348 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 346 def conflicting_attribute_count @conflicting_attribute_count end |
#conflicting_attributes ⇒ Object (readonly)
326 327 328 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 326 def conflicting_attributes @conflicting_attributes end |
#equal_attribute_count ⇒ Object (readonly)
331 332 333 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 331 def equal_attribute_count @equal_attribute_count end |
#missing_attribute_count ⇒ Object (readonly)
341 342 343 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 341 def missing_attribute_count @missing_attribute_count end |
#missing_attributes ⇒ Object (readonly)
321 322 323 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 321 def missing_attributes @missing_attributes end |
#preview_location ⇒ Object (readonly)
301 302 303 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 301 def preview_location @preview_location end |
#title ⇒ Object (readonly)
311 312 313 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 311 def title @title end |
#type ⇒ Object (readonly)
306 307 308 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 306 def type @type end |
Instance Method Details
#assign_ids(start) ⇒ Object
370 371 372 373 374 375 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 370 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
377 378 379 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 377 def compliant? @missing_attribute_count == 0 && @conflicting_attributes.all? { |ca| ca.compliant? } end |
#finish_attributes ⇒ Object
381 382 383 384 385 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 381 def finish_attributes @added_attributes.each {|a| a.finish} @missing_attributes.each {|a| a.finish} @conflicting_attributes.each {|a| a.finish} end |
#initialize_from_hash(hash) ⇒ Object
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 387 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 |