Class: Configchannel
- Inherits:
-
Object
- Object
- Configchannel
- Defined in:
- lib/satops/operator.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Class Method Summary collapse
Instance Method Summary collapse
- #create(sat) ⇒ Object
- #delete(sat) ⇒ Object
-
#initialize(configchannel) ⇒ Configchannel
constructor
A new instance of Configchannel.
- #set_files(sat, cfg_file) ⇒ Object
- #update(sat) ⇒ Object
Constructor Details
#initialize(configchannel) ⇒ Configchannel
Returns a new instance of Configchannel.
476 477 478 479 480 481 482 483 484 |
# File 'lib/satops/operator.rb', line 476 def initialize(configchannel) @id=configchannel['id'] @orgId=configchannel['orgId'] @label=configchannel['label'] @name=configchannel['name'] @description=configchannel['description'] @configChannelType=configchannel['configChannelType'] @file_revisions=configchannel['file_revisions'] end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
461 462 463 |
# File 'lib/satops/operator.rb', line 461 def label @label end |
Class Method Details
.reader(sat, id) ⇒ Object
463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/satops/operator.rb', line 463 def self.reader(sat, id) # Configchannel files are files, directories or symlinks configchannel ={} configchannel.merge!(sat.configchannel.getDetails(id)) file_revisions=Hash.new sat.configchannel.listFiles(configchannel['label']).each do |file| file_revisions.merge!("#{file['path']}" => sat.configchannel.getFileRevisions(configchannel['label'], file['path'])) end configchannel.merge!({'file_revisions' => file_revisions}) configchannel end |
Instance Method Details
#create(sat) ⇒ Object
497 498 499 500 501 502 503 504 505 |
# File 'lib/satops/operator.rb', line 497 def create(sat) sat.configchannel.create(@label, @name, @description) # Create file revisions @file_revisions.each do |cfg_file, revisions| revisions.each do |file_revision| set_files(sat, file_revision) end end end |
#delete(sat) ⇒ Object
507 508 509 |
# File 'lib/satops/operator.rb', line 507 def delete(sat) sat.configchannel.deleteChannels([@label]) end |
#set_files(sat, cfg_file) ⇒ Object
486 487 488 489 490 491 492 493 494 495 |
# File 'lib/satops/operator.rb', line 486 def set_files(sat, cfg_file) case cfg_file['type'] when 'file' sat.configchannel.createOrUpdatePath(@label, cfg_file, false) when 'directory' sat.configchannel.createOrUpdatePath(@label, cfg_file, true) when 'symlink' sat.configchannel.createOrUpdateSymlink(@label, cfg_file) end end |
#update(sat) ⇒ Object
511 512 513 514 515 516 517 518 519 520 |
# File 'lib/satops/operator.rb', line 511 def update(sat) sat.configchannel.update(@label, @name, @description) @file_revisions.each do |cfg_file, revisions| # dst_cfg_files=sat.configchannel.deleteFiles(@label, [cfg_file]) revisions.each do |file_revision| set_files(sat, file_revision) end end end |