Class: Kickstart

Inherits:
Object
  • Object
show all
Defined in:
lib/satops/operator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kickstart) ⇒ Kickstart

Returns a new instance of Kickstart.



574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# 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

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



550
551
552
# File 'lib/satops/operator.rb', line 550

def label
  @label
end

Class Method Details

.reader(sat, ks) ⇒ Object



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# 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

Instance Method Details

#create(sat) ⇒ Object



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# 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) ⇒ Object



638
639
640
# File 'lib/satops/operator.rb', line 638

def delete(sat)
  sat.kickstart.deleteProfile(@label)
end

#update(sat) ⇒ Object



642
643
644
645
646
647
648
649
# 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