class Kickstart

Attributes

label[R]

Public Class Methods

new(kickstart) click to toggle source
# File lib/satops/operator.rb, line 574
def initialize(kickstart)
  @label=kickstart['label']
  @tree_label=kickstart['tree_label']
  @name=kickstart['name']
  @advanced_mode=kickstart['advanced_mode']
  @org_default=kickstart['org_default']
  @active=kickstart['active']
  @advanced_options=kickstart['advanced_options']
  @child_channels=kickstart['child_channels']
  @custom_options=kickstart['custom_options']
  @variables=kickstart['variables']
  @config_management=kickstart['config_management']
  @remote_commands=kickstart['remote_commands']
  @locale=kickstart['locale']
  @selinux=kickstart['selinux']
  @partitioning_scheme=kickstart['partitioning_scheme']
  @registration_type=kickstart['registration_type']
  @software_list=kickstart['software_list']
  @keys=kickstart['keys']
  @file_preservations=kickstart['file_preservations']
  @scripts=kickstart['scripts']
end
reader(sat, ks) click to toggle source
# File lib/satops/operator.rb, line 552
def self.reader(sat, ks)
  label=ks['label']
  kickstart=ks
  kickstart.merge!({'advanced_options'=>sat.kickstartProfile.getAdvancedOptions(label)})
  kickstart.merge!({'child_channels'=>sat.kickstartProfile.getChildChannels(label)})
  kickstart.merge!({'custom_options'=>sat.kickstartProfile.getCustomOptions(label)})
  kickstart.merge!({'variables'=>sat.kickstartProfile.getVariables(label)})

  kickstart.merge!({'config_management'=>sat.kickstartProfileSystem.checkConfigManagement(label)})
  kickstart.merge!({'remote_commands'=>sat.kickstartProfileSystem.checkRemoteCommands(label)})
  kickstart.merge!({'locale'=>sat.kickstartProfileSystem.getLocale(label)})
  kickstart.merge!({'selinux'=>sat.kickstartProfileSystem.getSELinux(label)})
  kickstart.merge!({'partitioning_scheme'=>sat.kickstartProfileSystem.getPartitioningScheme(label)})
  kickstart.merge!({'registration_type'=>sat.kickstartProfileSystem.getRegistrationType(label)})
  kickstart.merge!({'software_list'=>sat.kickstartProfileSoftware.getSoftwareList(label)})

  kickstart.merge!({'keys'=>Helpers.filter(sat.kickstartProfileSystem.listKeys(label), 'description')})
  kickstart.merge!({'file_preservations'=>Helpers.filter(sat.kickstartProfileSystem.listFilePreservations(label), 'name')})
  kickstart.merge!({'scripts'=>sat.kickstartProfile.listScripts(label)})
  kickstart
end

Public Instance Methods

create(sat) click to toggle source
# File lib/satops/operator.rb, line 597
def create(sat)
  sat.kickstart.createProfile(@label, 'none', @tree_label, 'default', '')
  sat.kickstart.disableProfile(@label, !@active)

  sat.kickstartProfile.setAdvancedOptions(@label, @advanced_options)

  custom_options=[]
  @custom_options.each do |val|
    custom_options << val['arguments']
  end
  sat.kickstartProfile.setCustomOptions(@label, custom_options)
  sat.kickstartProfile.setVariables(@label, @variables)
  sat.kickstartProfile.setChildChannels(@label, @child_channels)
  sat.kickstartProfile.setKickstartTree(@label, @tree_label)
  # No API to get logging options - let's activate them by default
  sat.kickstartProfile.setLogging(@label, true, true)
  sat.kickstartProfileSystem.setLocale(@label, @locale['locale'], @locale['useUtc'])
  sat.kickstartProfileSystem.setSELinux(@label, @selinux)
  sat.kickstartProfileSystem.setPartitioningScheme(@label, @partitioning_scheme)
  sat.kickstartProfileSystem.setRegistrationType(@label, @registration_type)
  sat.kickstartProfileSystem.addKeys(@label, @keys)
  sat.kickstartProfileSystem.addFilePreservations(@label, @file_preservations)
  sat.kickstartProfileSoftware.setSoftwareList(@label, @software_list)

  if @config_management
    sat.kickstartProfileSystem.enableConfigManagement(@label)
  else
    sat.kickstartProfileSystem.disableConfigManagement(@label)
  end

  if @remote_commands
    sat.kickstartProfileSystem.enableRemoteCommands(@label)
  else
    sat.kickstartProfileSystem.disableRemoteCommands(@label)
  end

  @scripts.each do |script|
    sat.kickstartProfile.addScript(@label, script['contents'], script['interpreter'], script['script_type'], script['chroot'], script['template'])
  end
end
delete(sat) click to toggle source
# File lib/satops/operator.rb, line 638
def delete(sat)
  sat.kickstart.deleteProfile(@label)
end
update(sat) click to toggle source
# File lib/satops/operator.rb, line 642
def update(sat)
  # Remove scripts first because there is no RHN API call for updating them
  Helpers.filter(sat.kickstartProfile.listScripts(@label), 'id').each do |id|
    sat.kickstartProfile.removeScript(@label, id)
  end
  # No API for updating KS profile so we overide
  self.create(sat)
end