Class: Yast::AutoinstCloneClass
- Inherits:
-
Module
- Object
- Module
- Yast::AutoinstCloneClass
- Defined in:
- ../../src/modules/AutoinstClone.rb
Instance Method Summary (collapse)
-
- (Array) CommonClone(resource, resourceMap)
Clone a Resource.
-
- (Array) createClonableList
Create a list of clonable resources.
-
- (void) Export
Export profile, Used only from within autoyast2.
-
- (Hash) General
General options.
- - (Object) main
-
- (Boolean) multipath_in_use?
Detects whether the current system uses multipath.
-
- (void) Process
Build the profile.
-
- (Boolean) Write(outputFile)
Write the profile to a defined path.
Instance Method Details
- (Array) CommonClone(resource, resourceMap)
Clone a Resource
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File '../../src/modules/AutoinstClone.rb', line 86 def CommonClone(resource, resourceMap) resourceMap = deep_copy(resourceMap) data_type = Ops.get_string( resourceMap, "X-SuSE-YaST-AutoInstDataType", "map" ) auto = Ops.get_string(resourceMap, "X-SuSE-YaST-AutoInstClient", "") resource = Ops.get_string( resourceMap, "X-SuSE-YaST-AutoInstResource", resource ) Call.Function(auto, ["Read"]) Call.Function(auto, ["SetModified"]) true end |
- (Array) createClonableList
Create a list of clonable resources
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File '../../src/modules/AutoinstClone.rb', line 110 def createClonableList items = [] Builtins.foreach(Y2ModuleConfig.ModuleMap) do |def_resource, resourceMap| Builtins.y2debug( "r: %1 => %2", def_resource, Ops.get_string(resourceMap, "X-SuSE-YaST-AutoInstClonable", "false") ) clonable = Ops.get_string( resourceMap, "X-SuSE-YaST-AutoInstClonable", "false" ) == "true" if clonable || "partitioning" == def_resource || "software" == def_resource || # has no desktop file "bootloader" == def_resource # has no desktop file desktop_file = Builtins.substring( Ops.get_string(resourceMap, "X-SuSE-DocTeamID", ""), 4 ) name = Builtins.dpgettext( "desktop_translations", "/usr/share/locale/", Ops.add( Ops.add(Ops.add("Name(", desktop_file), ".desktop): "), Ops.get_string(resourceMap, "Name", "") ) ) if name == Ops.add( Ops.add(Ops.add("Name(", desktop_file), ".desktop): "), Ops.get_string(resourceMap, "Name", "") ) name = Ops.get_string(resourceMap, "Name", "") end # Set resource name, if not using default value resource = Ops.get_string( resourceMap, "X-SuSE-YaST-AutoInstResource", "" ) resource = def_resource if resource == "" if resource != "" items = Builtins.add(items, Item(Id(resource), name)) else items = Builtins.add(items, Item(Id(def_resource), name)) end end end # sort items for nicer display items = Builtins.sort( Convert.convert(items, :from => "list", :to => "list <term>") ) do |x, y| Ops.less_than(Ops.get_string(x, 1, "x"), Ops.get_string(y, 1, "y")) end deep_copy(items) end |
- (void) Export
This method returns an undefined value.
Export profile, Used only from within autoyast2
212 213 214 215 216 217 |
# File '../../src/modules/AutoinstClone.rb', line 212 def Export Yast.import "Profile" Profile.Reset Process() nil end |
- (Hash) General
General options
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File '../../src/modules/AutoinstClone.rb', line 55 def General Yast.import "Mode" Mode.SetMode("normal") general = {} general["mode"] = { "confirm" => false } general["signature-handling"] = { "accept_unsigned_file" => true, "accept_file_without_checksum" => true, "accept_unknown_gpg_key" => true, "accept_verification_failed" => false, "import_gpg_key" => true, "accept_non_trusted_gpg_key" => true } general["storage"] = { "start_multipath" => multipath_in_use?, "partition_alignment" => Storage.GetPartitionAlignment, } Mode.SetMode("autoinst_config") general end |
- (Object) main
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File '../../src/modules/AutoinstClone.rb', line 22 def main Yast.import "Mode" Yast.import "XML" Yast.import "Call" Yast.import "Profile" Yast.import "Y2ModuleConfig" Yast.import "Misc" Yast.import "Storage" Yast.import "AutoinstConfig" Yast.import "Report" Yast.include self, "autoinstall/xml.rb" @Profile = {} @bytes_per_unit = 0 # spceial treatment for base resources @base = [] # aditional configuration resources o be cloned @additional = [] end |
- (Boolean) multipath_in_use?
Detects whether the current system uses multipath
49 50 51 |
# File '../../src/modules/AutoinstClone.rb', line 49 def multipath_in_use? Storage.GetTargetMap.detect{|k,e| e.fetch("type",:X)==:CT_DMMULTIPATH} ? true:false end |
- (void) Process
This method returns an undefined value.
Build the profile
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File '../../src/modules/AutoinstClone.rb', line 170 def Process Builtins.y2debug("Additional resources: %1 %2", @base, @additional) Profile.Reset Profile.prepare = true Mode.SetMode("autoinst_config") Builtins.foreach(Y2ModuleConfig.ModuleMap) do |def_resource, resourceMap| # Set resource name, if not using default value resource = Ops.get_string( resourceMap, "X-SuSE-YaST-AutoInstResource", "" ) resource = def_resource if resource == "" Builtins.y2debug("current resource: %1", resource) if Builtins.contains(@additional, resource) ret = CommonClone(def_resource, resourceMap) end end Call.Function("general_auto", ["Import", General()]) Call.Function("general_auto", ["SetModified"]) Call.Function("report_auto", ["Import", Report.Export]) Call.Function("report_auto", ["SetModified"]) Profile.Prepare nil end |
- (Boolean) Write(outputFile)
Write the profile to a defined path
203 204 205 206 207 |
# File '../../src/modules/AutoinstClone.rb', line 203 def Write(outputFile) Process() ret = Profile.Save(outputFile) ret end |