class Configchannel

Attributes

label[R]

Public Class Methods

new(configchannel) click to toggle source
# 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
reader(sat, id) click to toggle source
# 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

Public Instance Methods

create(sat) click to toggle source
# 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) click to toggle source
# File lib/satops/operator.rb, line 507
def delete(sat)
  sat.configchannel.deleteChannels([@label])
end
set_files(sat, cfg_file) click to toggle source
# 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) click to toggle source
# 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