Class: Vmit::AutoYaST
- Inherits:
-
Object
- Object
- Vmit::AutoYaST
- Defined in:
- lib/vmit/autoyast.rb
Instance Attribute Summary collapse
-
#packages ⇒ Object
Returns the value of attribute packages.
-
#patterns ⇒ Object
Returns the value of attribute patterns.
Instance Method Summary collapse
-
#initialize ⇒ AutoYaST
constructor
A new instance of AutoYaST.
- #minimal_opensuse! ⇒ Object
- #minimal_sle! ⇒ Object
-
#name_network_device(mac, name) ⇒ Object
Map a network device name and make it persistent.
- #to_xml ⇒ Object
Constructor Details
#initialize ⇒ AutoYaST
Returns a new instance of AutoYaST.
30 31 32 33 34 |
# File 'lib/vmit/autoyast.rb', line 30 def initialize @net_udev = {} @patterns = [] @packages = [] end |
Instance Attribute Details
#packages ⇒ Object
Returns the value of attribute packages.
28 29 30 |
# File 'lib/vmit/autoyast.rb', line 28 def packages @packages end |
#patterns ⇒ Object
Returns the value of attribute patterns.
27 28 29 |
# File 'lib/vmit/autoyast.rb', line 27 def patterns @patterns end |
Instance Method Details
#minimal_opensuse! ⇒ Object
36 37 38 |
# File 'lib/vmit/autoyast.rb', line 36 def minimal_opensuse! @patterns << 'base' end |
#minimal_sle! ⇒ Object
40 41 42 |
# File 'lib/vmit/autoyast.rb', line 40 def minimal_sle! @patterns << 'Minimal' end |
#name_network_device(mac, name) ⇒ Object
Map a network device name and make it persistent
49 50 51 52 53 54 |
# File 'lib/vmit/autoyast.rb', line 49 def name_network_device(mac, name) if @net_udev.has_key?(mac) or @net_udev.has_value?(mac) raise "Device with MAC #{mac} is already assigned to #{@net_udev[name]}" end @net_udev[mac] = name end |
#to_xml ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/vmit/autoyast.rb', line 56 def to_xml builder = Nokogiri::XML::Builder.new do |xml| xml.profile('xmlns' => 'http://www.suse.com/1.0/yast2ns', 'xmlns:config' => 'http://www.suse.com/1.0/configns') { xml.users('config:type' => 'list') { xml.user { xml.username 'root' xml.user_password 'linux' xml.encrypted(false,'config:type' => 'boolean') xml.forename xml.surname } } xml.general { xml.mode { xml.confirm(false, 'config:type' => 'boolean') xml.forceboot('config:type' => 'boolean') xml.final_reboot(true, 'config:type' => 'boolean') xml.second_stage(true, 'config:type' => 'boolean') } } xml.runlevel { xml.default 3 xml.services { xml.service { xml.service_name 'sshd' xml.service_status 'enable' xml.service_start '3 5' xml.service_stop '3 5' } } } xml.software { xml.patterns('config:type' => 'list') { @patterns.each do |pat| xml.pattern pat end } } # SLE 11 can do without this basic partitioning but # SLE 10 is not that smart. xml.partitioning('config:type' => 'list') { xml.drive { xml.use 'all' } } xml.networking { xml.keep_install_network(true, 'config:type' => 'boolean') } } end builder.to_xml end |