class Channel

Constants

REDHAT

Attributes

id[R]
label[R]

Public Class Methods

new(channel) click to toggle source
# File lib/satops/operator.rb, line 370
def initialize(channel)
  @id=channel['id']
  @label=channel['label']
  @name=channel['name']
  @arch_name=channel['arch_name']
  @summary=channel['summary']
  @provider_name= channel['provider_name']
  @packages=channel['packages']
  @systems=channel['systems']
  @is_globally_subscribable=channel['isGloballySubscribable']
  @subscribers=channel['subscribers']
  @managers=channel['managers']
  @description=channel['description']
  @checksum_label=channel['checksum_label']
  @last_modified=channel['last_modified']
  @maintainer_name=channel['maintainer_name']
  @maintainer_email=channel['maintainer_email']
  @maintainer_phone=channel['maintainer_phone']
  @support_policy=channel['support_policy']
  @gpg_key_url=channel['gpg_key_url']
  @gpg_key_id=channel['gpg_key_id']
  @gpg_key_fp=channel['gpg_key_fp']
  @yumrepo_source_url=channel['yumrepo_source_url']
  @yumrepo_label=channel['yumrepo_label']
  @yumrepo_last_sync=channel['yumrepo_last_sync']
  @end_of_life=channel['end_of_life']
  @parent_channel_label=channel['parent_channel_label']
  @clone_original=channel['clone_original']
end
reader(sat, channel) click to toggle source
# File lib/satops/operator.rb, line 350
def self.reader(sat, channel)
  channel.merge!(sat.channelSoftware.getDetails(channel['label']))
  channel.merge!({'isGloballySubscribable'=>sat.channelSoftware.isGloballySubscribable(channel['label'])})
  unless channel['isGloballySubscribable']
    subscribers={}
    Helpers.filter(sat.user.listUsers, 'login').each do |login|
      subscribers.merge!({login => sat.channelSoftware.isUserSubscribable(channel['label'], login)})
    end
    channel.merge!({'subscribers'=>subscribers})
  end
  unless channel['provider_name'] == REDHAT
    managers={}
    Helpers.filter(sat.user.listUsers, 'login').each do |login|
      managers.merge!({login =>  sat.channelSoftware.isUserManageable(channel['label'], login)})
    end
    channel.merge!({'managers'=>managers})
  end
  channel
end

Public Instance Methods

create(sat) click to toggle source
# File lib/satops/operator.rb, line 400
def create(sat)
  # Software Channels must created via ISS (satellite-sync)
end
delete(sat) click to toggle source
# File lib/satops/operator.rb, line 404
def delete(sat)
  sat.channelSoftware.delete(@label)
end
update(sat) click to toggle source
# File lib/satops/operator.rb, line 408
def update(sat)
  # Update details for non Red Hat channels
  if @provider_name != REDHAT
    # Non mandatory fields that could be nil need to be empty
    @maintainer_name='' unless @maintainer_name
    @maintainer_email='' unless @maintainer_email
    @maintainer_phone='' unless @maintainer_phone
    # Find target channel id
    id=sat.channelSoftware.getDetails(@label)['id']
    sat.channelSoftware.setDetails(id, {'checksum_label' => @checksum_label, 'name' => @name, 'summary' => @summary, 'description' => @description, 'maintainer_name' => @maintainer_name, 'maintainer_email' => @maintainer_email, 'maintainer_phone' => @maintainer_phone, 'gpg_key_url' => @gpg_key_url, 'gpg_key_id' => @gpg_key_id, 'gpg_key_fp' => @gpg_key_fp})

    # Managers
    if @managers
      @managers.each do |login, value|
        sat.channelSoftware.setUserManageable(@label, login, value)
      end
    end
  end

  # Globally Subscribable
  sat.channelSoftware.setGloballySubscribable(@label, @is_globally_subscribable)

  # Per User subscriptions
  if !@is_globally_subscribable && @subscribers
    @subscribers.each do |login, value|
      sat.channelSoftware.setUserSubscribable(@label, login, value)
    end
  end

  # To Do : Repos
end