Class: Yast::ProductControlClass
- Inherits:
-
Module
- Object
- Module
- Yast::ProductControlClass
- Defined in:
- ../../src/modules/ProductControl.rb
Instance Method Summary (collapse)
- - (Object) addToStack(name)
-
- (void) AddWizardSteps(stagemode)
Add Wizard Steps.
- - (Object) Check(allowed, current)
-
- (Object) CheckAdditionalParams(check_workflow)
Checks all params set by SetAdditionalWorkflowParams() whether they match the workfow got as parameter.
-
- (Boolean) checkArch(mod, def_)
Check if valid architecture.
-
- (Boolean) checkDisabled(mod)
Check if a module is disabled.
- - (Object) checkHeading(mod)
- - (Object) CurrentStep
- - (Object) DisableAllModulesAndProposals(mode, stage)
-
- (Object) DisableModule(modname)
Disable given module in installation workflow.
-
- (Object) DisableProposal(disable_proposal)
Disable given proposal in installation workflow.
- - (Object) DisableSubProposal(unique_id, disable_subproposal)
-
- (Object) EnableModule(modname)
Enable given disabled module.
-
- (Object) EnableProposal(enable_proposal)
Enable given disabled proposal.
- - (Object) EnableSubProposal(unique_id, enable_subproposal)
-
- (Hash) FindMatchingWorkflow(stage, mode)
Returns workflow matching the selected stage and mode and additiona parameters if set by SetAdditionalWorkflowParams().
-
- (Object) getClientName(name, execute)
Returns name of the script to call.
-
- (Yast::Term) getClientTerm(step, def_, former_result)
Return term to be used to run module with CallFunction.
-
- (Hash) getCompleteWorkflow(stage, mode)
Get Workflow.
-
- (Array<String>) GetDisabledModules
Returns list of modules disabled in workflow.
-
- (Array<String>) GetDisabledProposals
Returns list of proposals disabled in workflow.
- - (Object) GetDisabledSubProposals
- - (Object) getMatchingProposal(stage, mode, proptype)
-
- (Hash) getModeDefaults(stage, mode)
Get workflow defaults.
-
- (Array<Hash>) getModules(stage, mode, which)
Get modules of current Workflow.
-
- (Hash) getProposalProperties(stage, mode, proptype)
One “proposal” element of control.rnc where /label is not translated yet but //proposal_tab/label are.
-
- (Array<Array(String,Integer)>) getProposals(stage, mode, proptype)
Get modules of current Workflow.
-
- (Object) getProposalTextDomain
Return text domain.
- - (Object) GetTranslatedText(key)
-
- (String) getWorkflowLabel(stage, mode, wz_td)
Get Workflow Label.
-
- (Boolean) Init
Initialize Product Control.
- - (Object) main
-
- (void) PrepareScripts(m)
Prepare Workflow Scripts.
-
- (void) ProductControl
ProductControl Constructor.
-
- (Boolean) ReadControlFile(controlfile)
Read XML Control File.
-
- (Array<String>) RequiredFiles(stage, mode)
Get list of required files for the workflow.
-
- (Object) ResetAdditionalWorkflowParams
Resets all additional params for selecting the workflow.
-
- (Object) RestartingStep
Return step which restarted YaST (or rebooted the system).
-
- (Object) retranslateWizardDialog
Re-translate static part of wizard dialog and other predefined messages after language change.
-
- (Object) RetranslateWizardSteps
Retranslate Wizard Steps.
-
- (Object) Run
Run Workflow.
- - (Object) RunFrom(from, allow_back)
-
- (Boolean) RunRequired(stage, mode)
Returns whether is is required to run YaST in the defined stage and mode.
-
- (Object) SetAdditionalWorkflowParams(params)
Sets additional params for selecting the workflow.
-
- (Object) setClientPrefix(prefix)
Set Client Prefix.
-
- (Object) SkippedSteps
List steps which were skipped since last restart of YaST.
- - (Object) UnDisableAllModulesAndProposals(mode, stage)
-
- (Object) UpdateWizardSteps(stagemode)
Update Steps.
- - (Object) wasRun(name)
Instance Method Details
- (Object) addToStack(name)
1228 1229 1230 1231 |
# File '../../src/modules/ProductControl.rb', line 1228 def addToStack(name) @stack = Builtins.add(@stack, name) nil end |
- (void) AddWizardSteps(stagemode)
This method returns an undefined value.
Add Wizard Steps
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
# File '../../src/modules/ProductControl.rb', line 800 def AddWizardSteps(stagemode) stagemode = deep_copy(stagemode) debug_workflow = ProductFeatures.GetBooleanFeature( "globals", "debug_workflow" ) @last_stage_mode = deep_copy(stagemode) # UI::WizardCommand() can safely be called even if the respective UI # doesn't support the wizard widget, but for optimization it makes sense # to do expensive operations only when it is available. # if ( ! UI::HasSpecialWidget(`Wizard ) ) # return; wizard_textdomain = Ops.get_string( @productControl, "textdomain", "control" ) Builtins.y2debug( "Using textdomain '%1' for wizard steps", wizard_textdomain ) first_id = "" # UI::WizardCommand(`SetVerboseCommands( true ) ); Builtins.foreach(stagemode) do |sm| Builtins.y2debug("Adding wizard steps for %1", sm) # only for debugging Builtins.y2milestone("Adding wizard steps for %1", sm) slabel = getWorkflowLabel( Ops.get_string(sm, "stage", ""), Ops.get_string(sm, "mode", ""), wizard_textdomain ) UI.WizardCommand(term(:AddStepHeading, slabel)) if slabel != "" # just to check whether there are some steps to display enabled_modules = getModules( Ops.get_string(sm, "stage", ""), Ops.get_string(sm, "mode", ""), :enabled ) enabled_modules = Builtins.filter(enabled_modules) do |m| Ops.get_string(m, "heading", "") == "" end if Builtins.size(enabled_modules) == 0 Builtins.y2milestone( "There are no (more) steps for %1, section will be disabled", sm ) next end last_label = "" last_domain = "" Builtins.foreach( getModules( Ops.get_string(sm, "stage", ""), Ops.get_string(sm, "mode", ""), :enabled ) ) do |m| # only for debugging Builtins.y2debug("Adding wizard step: %1", m) heading = "" label = "" id = "" # Heading if Builtins.haskey(m, "heading") && Ops.get_string(m, "label", "") != "" heading = if Builtins.haskey(m, "textdomain") Builtins.dgettext( Ops.get_string(m, "textdomain", ""), Ops.get_string(m, "label", "") ) else Builtins.dgettext( wizard_textdomain, Ops.get_string(m, "label", "") ) end # Label elsif Ops.get_string(m, "label", "") != "" first_id = Ops.get_string(m, "id", "") if first_id == "" label = if Builtins.haskey(m, "textdomain") Builtins.dgettext( Ops.get_string(m, "textdomain", ""), Ops.get_string(m, "label", "") ) else Builtins.dgettext( wizard_textdomain, Ops.get_string(m, "label", "") ) end id = Ops.get_string(m, "id", "") last_label = Ops.get_string(m, "label", "") last_domain = Ops.get_string(m, "textdomain", "") # The rest else first_id = Ops.get_string(m, "id", "") if first_id == "" if last_label != "" if last_domain != "" label = Builtins.dgettext(last_domain, last_label) id = Ops.get_string(m, "id", "") else label = Builtins.dgettext(wizard_textdomain, last_label) end id = Ops.get_string(m, "id", "") end end if !heading.nil? && heading != "" UI.WizardCommand(term(:AddStepHeading, heading)) end if !label.nil? && label != "" if debug_workflow == true label = Ops.add( label, Builtins.sformat(" [%1]", Ops.get_string(m, "name", "")) ) end Builtins.y2debug("AddStep: %1/%2", label, id) UI.WizardCommand(term(:AddStep, label, id)) end end end UI.WizardCommand(term(:SetCurrentStep, @CurrentWizardStep)) nil end |
- (Object) Check(allowed, current)
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File '../../src/modules/ProductControl.rb', line 331 def Check(allowed, current) # create allowed list allowedlist = Builtins.filter( Builtins.splitstring(Builtins.deletechars(allowed, " "), ",") ) { |s| s != "" } Builtins.y2debug("allowedlist: %1", allowedlist) Builtins.y2debug("current: %1", current) if Builtins.size(allowedlist) == 0 return true elsif Builtins.contains(allowedlist, current) return true else return false end end |
- (Object) CheckAdditionalParams(check_workflow)
Checks all params set by SetAdditionalWorkflowParams() whether they match the workfow got as parameter.
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File '../../src/modules/ProductControl.rb', line 453 def CheckAdditionalParams(check_workflow) if @_additional_workflow_params.nil? || @_additional_workflow_params == {} return true end ret = true Builtins.foreach(@_additional_workflow_params) do |key_to_check, value_to_check| # exception # If 'add_on_mode' key is not set in the workflow at all # it is considered to be matching that parameter if key_to_check == "add_on_mode" && !Builtins.haskey(check_workflow.value, key_to_check) Builtins.y2debug( "No 'add_on_mode' defined, matching %1", value_to_check ) elsif Ops.get(check_workflow.value, key_to_check) != value_to_check ret = false raise Break end end ret end |
- (Boolean) checkArch(mod, def_)
Check if valid architecture
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File '../../src/modules/ProductControl.rb', line 351 def checkArch(mod, def_) mod = deep_copy(mod) def_ = deep_copy(def_) Builtins.y2debug("Checking architecture: %1", mod) archs = Ops.get_string(mod, "archs", "") archs = Ops.get_string(def_, "archs", "all") if archs == "" return true if archs == "all" Builtins.y2milestone("short arch desc: %1", Arch.arch_short) Builtins.y2milestone("supported archs: %1", archs) return true if Builtins.issubstring(archs, Arch.arch_short) false end |
- (Boolean) checkDisabled(mod)
Check if a module is disabled
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File '../../src/modules/ProductControl.rb', line 252 def checkDisabled(mod) mod = deep_copy(mod) if mod.nil? Builtins.y2error("Unknown module %1", mod) return nil end # Proposal if !Ops.get_string(mod, "proposal", "").nil? && Ops.get_string(mod, "proposal", "") != "" if Builtins.contains( @DisabledProposals, Ops.get_string(mod, "proposal", "") ) return true end # Normal step elsif !Ops.get_string(mod, "name", "").nil? && Ops.get_string(mod, "name", "") != "" if Builtins.contains(@DisabledModules, Ops.get_string(mod, "name", "")) return true end end false end |
- (Object) checkHeading(mod)
279 280 281 282 |
# File '../../src/modules/ProductControl.rb', line 279 def checkHeading(mod) mod = deep_copy(mod) Builtins.haskey(mod, "heading") end |
- (Object) CurrentStep
135 136 137 |
# File '../../src/modules/ProductControl.rb', line 135 def CurrentStep @current_step end |
- (Object) DisableAllModulesAndProposals(mode, stage)
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
# File '../../src/modules/ProductControl.rb', line 694 def DisableAllModulesAndProposals(mode, stage) this_workflow = { "mode" => mode, "stage" => stage } if Builtins.contains(@already_disabled_workflows, this_workflow) Builtins.y2milestone("Workflow %1 already disabled", this_workflow) return end # stores modules and proposals disabled before # this 'general' disabling @localDisabledProposals = deep_copy(@DisabledProposals) @localDisabledModules = deep_copy(@DisabledModules) Builtins.y2milestone( "localDisabledProposals: %1", @localDisabledProposals ) Builtins.y2milestone("localDisabledModules: %1", @localDisabledModules) Builtins.foreach(getModules(stage, mode, :all)) do |m| if !Ops.get_string(m, "proposal").nil? && Ops.get_string(m, "proposal", "") != "" Builtins.y2milestone("Disabling proposal: %1", m) @DisabledProposals = Convert.convert( Builtins.union( @DisabledProposals, [Ops.get_string(m, "proposal", "")] ), from: "list", to: "list <string>" ) elsif !Ops.get_string(m, "name").nil? && Ops.get_string(m, "name", "") != "" Builtins.y2milestone("Disabling module: %1", m) @DisabledModules = Convert.convert( Builtins.union(@DisabledModules, [Ops.get_string(m, "name", "")]), from: "list", to: "list <string>" ) end end @already_disabled_workflows = Convert.convert( Builtins.union(@already_disabled_workflows, [this_workflow]), from: "list", to: "list <map>" ) nil end |
- (Object) DisableModule(modname)
Disable given module in installation workflow
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File '../../src/modules/ProductControl.rb', line 157 def DisableModule(modname) if modname.nil? || modname == "" Builtins.y2error("Module to disable is '%1'", modname) else @DisabledModules = Convert.convert( Builtins.union(@DisabledModules, [modname]), from: "list", to: "list <string>" ) end deep_copy(@DisabledModules) end |
- (Object) DisableProposal(disable_proposal)
Disable given proposal in installation workflow
190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File '../../src/modules/ProductControl.rb', line 190 def DisableProposal(disable_proposal) if disable_proposal.nil? || disable_proposal == "" Builtins.y2error("Module to disable is '%1'", disable_proposal) else @DisabledProposals = Convert.convert( Builtins.union(@DisabledProposals, [disable_proposal]), from: "list", to: "list <string>" ) end deep_copy(@DisabledProposals) end |
- (Object) DisableSubProposal(unique_id, disable_subproposal)
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File '../../src/modules/ProductControl.rb', line 224 def DisableSubProposal(unique_id, disable_subproposal) if Builtins.haskey(@DisabledSubProposals, unique_id) Ops.set( @DisabledSubProposals, unique_id, Convert.convert( Builtins.union( Ops.get(@DisabledSubProposals, unique_id, []), [disable_subproposal] ), from: "list", to: "list <string>" ) ) else Ops.set(@DisabledSubProposals, unique_id, [disable_subproposal]) end deep_copy(@DisabledSubProposals) end |
- (Object) EnableModule(modname)
Enable given disabled module
147 148 149 150 151 152 153 |
# File '../../src/modules/ProductControl.rb', line 147 def EnableModule(modname) @DisabledModules = Builtins.filter(@DisabledModules) do |mod| mod != modname end deep_copy(@DisabledModules) end |
- (Object) EnableProposal(enable_proposal)
Enable given disabled proposal
180 181 182 183 184 185 186 |
# File '../../src/modules/ProductControl.rb', line 180 def EnableProposal(enable_proposal) @DisabledProposals = Builtins.filter(@DisabledProposals) do |one_proposal| one_proposal != enable_proposal end deep_copy(@DisabledProposals) end |
- (Object) EnableSubProposal(unique_id, enable_subproposal)
211 212 213 214 215 216 217 218 219 220 221 222 |
# File '../../src/modules/ProductControl.rb', line 211 def EnableSubProposal(unique_id, enable_subproposal) if Builtins.haskey(@DisabledSubProposals, unique_id) Ops.set( @DisabledSubProposals, unique_id, Builtins.filter(Ops.get(@DisabledSubProposals, unique_id, [])) do |one_subproposal| one_subproposal != enable_subproposal end ) end deep_copy(@DisabledSubProposals) end |
- (Hash) FindMatchingWorkflow(stage, mode)
Returns workflow matching the selected stage and mode and additiona parameters if set by SetAdditionalWorkflowParams()
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File '../../src/modules/ProductControl.rb', line 486 def FindMatchingWorkflow(stage, mode) Builtins.y2debug("workflows: %1", @workflows) tmp = Builtins.filter(@workflows) do |wf| Check(Ops.get_string(wf, "stage", ""), stage) && Check(Ops.get_string(wf, "mode", ""), mode) && ( wf_ref = arg_ref(wf) CheckAdditionalParams(wf_ref) ) end Builtins.y2debug("Workflow: %1", Ops.get(tmp, 0, {})) Ops.get(tmp, 0, {}) end |
- (Object) getClientName(name, execute)
Returns name of the script to call. If 'execute' is defined, the client name is taken from there. Then, if a custom control file is defined, client name is defined as 'name'. Then, inst'name' or just 'name' is returned if it does not match the 'inst' regexp.
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File '../../src/modules/ProductControl.rb', line 375 def getClientName(name, execute) return "inst_test_workflow" if Mode.test # BNC #401319 # 'execute; is defined and thus returned if !execute.nil? && execute != "" Builtins.y2milestone("Step name '%1' executes '%2'", name, execute) return execute end # Defined custom control file if @custom_control_file != "" return name # All standard clients start with "inst_" else if Builtins.issubstring(name, @_client_prefix) return name else return Ops.add(@_client_prefix, name) end end end |
- (Yast::Term) getClientTerm(step, def_, former_result)
Return term to be used to run module with CallFunction
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File '../../src/modules/ProductControl.rb', line 403 def getClientTerm(step, def_, former_result) step = deep_copy(step) def_ = deep_copy(def_) former_result = deep_copy(former_result) client = getClientName( Ops.get_string(step, "name", "dummy"), Ops.get_string(step, "execute", "") ) result = Builtins.toterm(client) arguments = {} Builtins.foreach(["enable_back", "enable_next"]) do || default_setting = Ops.get_string(def_, , "yes") Ops.set( arguments, , Ops.get_string(step, , default_setting) == "yes" ) end if Builtins.haskey(step, "proposal") Ops.set(arguments, "proposal", Ops.get_string(step, "proposal", "")) end other_args = Ops.get_map(step, "arguments", {}) if Ops.greater_than(Builtins.size(other_args), 0) arguments = Convert.convert( Builtins.union(arguments, other_args), from: "map", to: "map <string, any>" ) end if Ops.is_symbol?(former_result) && former_result == :back Ops.set(arguments, "going_back", true) end if Mode.test Ops.set(arguments, "step_name", Ops.get_string(step, "name", "")) Ops.set(arguments, "step_id", Ops.get_string(step, "id", "")) end result = Builtins.add(result, arguments) deep_copy(result) end |
- (Hash) getCompleteWorkflow(stage, mode)
Get Workflow
600 601 602 |
# File '../../src/modules/ProductControl.rb', line 600 def getCompleteWorkflow(stage, mode) FindMatchingWorkflow(stage, mode) end |
- (Array<String>) GetDisabledModules
Returns list of modules disabled in workflow
174 175 176 |
# File '../../src/modules/ProductControl.rb', line 174 def GetDisabledModules deep_copy(@DisabledModules) end |
- (Array<String>) GetDisabledProposals
Returns list of proposals disabled in workflow
207 208 209 |
# File '../../src/modules/ProductControl.rb', line 207 def GetDisabledProposals deep_copy(@DisabledProposals) end |
- (Object) GetDisabledSubProposals
245 246 247 |
# File '../../src/modules/ProductControl.rb', line 245 def GetDisabledSubProposals deep_copy(@DisabledSubProposals) end |
- (Object) getMatchingProposal(stage, mode, proptype)
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
# File '../../src/modules/ProductControl.rb', line 972 def getMatchingProposal(stage, mode, proptype) Builtins.y2milestone( "Stage: %1 Mode: %2, Type: %3", stage, mode, proptype ) # First we search for proposals for current stage if there are # any. props = Builtins.filter(@proposals) do |p| Check(Ops.get_string(p, "stage", ""), stage) end Builtins.y2debug("1. proposals: %1", props) # Then we check for mode: installation or update props = Builtins.filter(props) do |p| Check(Ops.get_string(p, "mode", ""), mode) end Builtins.y2debug("2. proposals: %1", props) # Now we check for architecture Builtins.y2debug( "Architecture: %1, Proposals: %2", Arch.architecture, props ) arch_proposals = Builtins.filter(props) do |p| Ops.get_string(p, "name", "") == proptype && Builtins.issubstring( Ops.get_string(p, "archs", "dummy"), Arch.arch_short ) end Builtins.y2debug("3. arch proposals: %1", arch_proposals) props = Builtins.filter(props) do |p| Ops.get_string(p, "archs", "") == "" || Ops.get_string(p, "archs", "") == "all" end Builtins.y2debug("4. other proposals: %1", props) # If architecture specific proposals are available, we continue with those # and check for proposal type, else we continue with pre arch proposal # list if Ops.greater_than(Builtins.size(arch_proposals), 0) props = Builtins.filter(arch_proposals) do |p| Ops.get_string(p, "name", "") == proptype end Builtins.y2debug("5. arch proposals: %1", props) else props = Builtins.filter(props) do |p| Ops.get_string(p, "name", "") == proptype end Builtins.y2debug("5. other proposals: %1", props) end if Ops.greater_than(Builtins.size(props), 1) Builtins.y2error( "Something Wrong happened, more than one proposal after filter:\n %1", props ) end # old style proposal Builtins.y2milestone( "Proposal modules: %1", Ops.get(props, [0, "proposal_modules"]) ) deep_copy(props) end |
- (Hash) getModeDefaults(stage, mode)
Get workflow defaults
507 508 509 510 |
# File '../../src/modules/ProductControl.rb', line 507 def getModeDefaults(stage, mode) workflow = FindMatchingWorkflow(stage, mode) Ops.get_map(workflow, "defaults", {}) end |
- (Array<Hash>) getModules(stage, mode, which)
Get modules of current Workflow
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 637 638 639 |
# File '../../src/modules/ProductControl.rb', line 609 def getModules(stage, mode, which) workflow = FindMatchingWorkflow(stage, mode) modules = Ops.get_list(workflow, "modules", []) Builtins.y2debug("M1: %1", modules) # Unique IDs have to always keep the same because some steps # can be disabled while YaST is running # @see BNC #575092 id = 1 modules = Builtins.maplist(modules) do |m| Ops.set(m, "id", Builtins.sformat("%1_%2", stage, id)) id = Ops.add(id, 1) deep_copy(m) end modules = Builtins.filter(modules) do |m| Ops.get_boolean(m, "enabled", true) && !checkDisabled(m) end if which == :enabled Builtins.y2debug("M2: %1", modules) modules = Builtins.maplist(modules) do |m| PrepareScripts(m) deep_copy(m) end Builtins.y2debug("M3: %1", modules) Builtins.y2debug("Log files: %1", @logfiles) deep_copy(modules) end |
- (Hash) getProposalProperties(stage, mode, proptype)
Returns one “proposal” element of control.rnc where /label is not translated yet but //proposal_tab/label are.
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
# File '../../src/modules/ProductControl.rb', line 1129 def getProposalProperties(stage, mode, proptype) got_proposals = getMatchingProposal(stage, mode, proptype) proposal = Ops.get(got_proposals, 0, {}) if Builtins.haskey(proposal, "proposal_tabs") text_domain = Ops.get_string(@productControl, "textdomain", "control") Ops.set( proposal, "proposal_tabs", Builtins.maplist(Ops.get_list(proposal, "proposal_tabs", [])) do |tab| domain = Ops.get_string(tab, "textdomain", text_domain) Ops.set( tab, "label", Builtins.dgettext(domain, Ops.get_string(tab, "label", "")) ) deep_copy(tab) end ) end deep_copy(proposal) end |
- (Array<Array(String,Integer)>) getProposals(stage, mode, proptype)
Get modules of current Workflow
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File '../../src/modules/ProductControl.rb', line 1053 def getProposals(stage, mode, proptype) props = getMatchingProposal(stage, mode, proptype) unique_id = Ops.get_string(props, [0, "unique_id"], "") disabled_subprops = GetDisabledSubProposals() final_proposals = [] Builtins.foreach(Ops.get_list(props, [0, "proposal_modules"], [])) do |p| proposal_name = "" order_value = 50 if Ops.is_string?(p) proposal_name = Convert.to_string(p) else pm = Convert.convert(p, from: "any", to: "map <string, string>") proposal_name = Ops.get(pm, "name", "") proposal_order = Ops.get(pm, "presentation_order", "50") order_value = Builtins.tointeger(proposal_order) if order_value.nil? Builtins.y2error( "Unable to use '%1' as proposal order, using %2 instead", proposal_order, 50 ) order_value = 50 end end is_disabled = Builtins.haskey(disabled_subprops, unique_id) && Builtins.contains( Ops.get(disabled_subprops, unique_id, []), proposal_name ) # All proposal file names end with _proposal if !is_disabled if !Builtins.issubstring(proposal_name, "_proposal") final_proposals = Builtins.add( final_proposals, [Ops.add(proposal_name, "_proposal"), order_value] ) else final_proposals = Builtins.add( final_proposals, [proposal_name, order_value] ) end else Builtins.y2milestone( "Proposal module %1 found among disabled subproposals", proposal_name ) end end Builtins.y2debug("final proposals: %1", final_proposals) deep_copy(final_proposals) end |
- (Object) getProposalTextDomain
Return text domain
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 |
# File '../../src/modules/ProductControl.rb', line 1110 def getProposalTextDomain current_proposal_textdomain = Ops.get_string( @productControl, "textdomain", "control" ) Builtins.y2debug( "Using textdomain '%1' for proposals", current_proposal_textdomain ) current_proposal_textdomain end |
- (Object) GetTranslatedText(key)
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File '../../src/modules/ProductControl.rb', line 1153 def GetTranslatedText(key) controlfile_texts = ProductFeatures.GetSection("texts") if !Builtins.haskey(controlfile_texts, key) Builtins.y2error("No such text %1", key) return "" end text = Ops.get_map(controlfile_texts, key, {}) label = Ops.get(text, "label", "") # an empty string doesn't need to be translated return "" if label == "" domain = Ops.get( text, "textdomain", Ops.get_string(@productControl, "textdomain", "control") ) if domain == "" Builtins.y2warning("The text domain for label %1 not set", key) return label end Builtins.dgettext(domain, label) end |
- (String) getWorkflowLabel(stage, mode, wz_td)
Get Workflow Label
679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File '../../src/modules/ProductControl.rb', line 679 def getWorkflowLabel(stage, mode, wz_td) workflow = FindMatchingWorkflow(stage, mode) label = Ops.get_string(workflow, "label", "") return "" if label == "" if Builtins.haskey(workflow, "textdomain") return Builtins.dgettext( Ops.get_string(workflow, "textdomain", ""), label ) else return Builtins.dgettext(wz_td, label) end end |
- (Boolean) Init
Initialize Product Control
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 |
# File '../../src/modules/ProductControl.rb', line 1183 def Init # Ordered list control_file_candidates = [ @y2update_control_file, # /y2update/control.xml @installation_control_file, # /control.xml @saved_control_file, # /etc/YaST2/control.xml ] if @custom_control_file.nil? Bultins.y2error("Incorrectly set custom control file: #{@custom_control_file}") return false end control_file_candidates.unshift(@custom_control_file) if !@custom_control_file.empty? Builtins.y2milestone("Candidates: #{control_file_candidates.inspect}") @current_control_file = control_file_candidates.find { |f| FileUtils.Exists(f) } if @current_control_file.nil? Builtins.y2error("No control file found within #{control_file_candidates.inspect}") return false end Builtins.y2milestone("Reading control file: #{@current_control_file}") ReadControlFile(@current_control_file) true end |
- (Object) main
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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 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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File '../../src/modules/ProductControl.rb', line 36 def main Yast.import "UI" textdomain "base" Yast.import "XML" Yast.import "ProductFeatures" Yast.import "Mode" Yast.import "Arch" Yast.import "Stage" Yast.import "Directory" Yast.import "Label" Yast.import "Wizard" Yast.import "Report" Yast.import "DebugHooks" Yast.import "Popup" Yast.import "FileUtils" Yast.import "Installation" Yast.import "Hooks" # The complete parsed control file @productControl = {} # all workflows @workflows = [] # all proposals @proposals = [] # inst_finish steps @inst_finish = [] # modules to be offered to clone configuration at the end of installation @clone_modules = [] # additional workflow parameters # workflow doesn't only match mode and stage but also these params # bnc #427002 @_additional_workflow_params = {} # Location of a custom control file @custom_control_file = "" # Control file in service packs @y2update_control_file = "/y2update/control.xml" # The custom control file location, usually copied from # the root of the CD to the installation directory by linuxrc @installation_control_file = "/control.xml" # The file above get saved into the installed system for later # processing @saved_control_file = Ops.add(Directory.etcdir, "/control.xml") # The control file we are using for this session. @current_control_file = nil # Current Wizard Step @CurrentWizardStep = "" # Last recently used stage_mode for RetranslateWizardSteps @last_stage_mode = [] # List of module to disable in the current run @DisabledModules = [] # List of proposals to disable in the current run @DisabledProposals = [] @DisabledSubProposals = {} # Log files for hooks @logfiles = [] @first_step = nil @restarting_step = nil @_client_prefix = "inst_" @stack = [] @first_id = "" @current_step = 0 @localDisabledProposals = [] @localDisabledModules = [] @already_disabled_workflows = [] # Forces UpdateWizardSteps to redraw steps even if nothing seem to be changed @force_UpdateWizardSteps = false @lastDisabledModules = deep_copy(@DisabledModules) ProductControl() end |
- (void) PrepareScripts(m)
This method returns an undefined value.
Prepare Workflow Scripts
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
# File '../../src/modules/ProductControl.rb', line 515 def PrepareScripts(m) m = deep_copy(m) tmp_dir = Convert.to_string(WFM.Read(path(".local.tmpdir"), [])) if Builtins.haskey(m, "prescript") interpreter = Ops.get_string(m, ["prescript", "interpreter"], "shell") source = Ops.get_string(m, ["prescript", "source"], "") type = interpreter == "shell" ? "sh" : "pl" f = Builtins.sformat( "%1/%2_pre.%3", tmp_dir, Ops.get_string(m, "name", ""), type ) WFM.Write(path(".local.string"), f, source) @logfiles = Builtins.add( @logfiles, Builtins.sformat( "%1.log", Builtins.sformat("%1_pre.%2", Ops.get_string(m, "name", ""), type) ) ) end if Builtins.haskey(m, "postscript") interpreter = Ops.get_string(m, ["postscript", "interpreter"], "shell") source = Ops.get_string(m, ["postscript", "source"], "") type = interpreter == "shell" ? "sh" : "pl" f = Builtins.sformat( "%1/%2_post.%3", tmp_dir, Ops.get_string(m, "name", ""), type ) WFM.Write(path(".local.string"), f, source) @logfiles = Builtins.add( @logfiles, Builtins.sformat( "%1.log", Builtins.sformat("%1_post.%2", Ops.get_string(m, "name", ""), type) ) ) end nil end |
- (void) ProductControl
This method returns an undefined value.
ProductControl Constructor
1579 1580 1581 1582 |
# File '../../src/modules/ProductControl.rb', line 1579 def ProductControl Builtins.y2error("control file missing") if !Init() nil end |
- (Boolean) ReadControlFile(controlfile)
Read XML Control File
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File '../../src/modules/ProductControl.rb', line 287 def ReadControlFile(controlfile) @productControl = XML.XMLToYCPFile(controlfile) return false if @productControl.nil? @workflows = Ops.get_list(@productControl, "workflows", []) @proposals = Ops.get_list(@productControl, "proposals", []) @inst_finish = Ops.get_list(@productControl, "inst_finish_stages", []) @clone_modules = Ops.get_list(@productControl, "clone_modules", []) Builtins.foreach( ["software", "globals", "network", "partitioning", "texts"] ) do |section| if Builtins.haskey(@productControl, section) ProductFeatures.SetSection( section, Ops.get_map(@productControl, section, {}) ) end end # FIXME: would be nice if it could be done generic way if Ops.greater_than( Builtins.size( Ops.get_list(@productControl, ["partitioning", "partitions"], []) ), 0 ) partitioning = Ops.get_map(@productControl, "partitioning", {}) ProductFeatures.SetBooleanFeature( "partitioning", "flexible_partitioning", true ) ProductFeatures.SetFeature( "partitioning", "FlexiblePartitioning", partitioning ) end true end |
- (Array<String>) RequiredFiles(stage, mode)
Get list of required files for the workflow. FIXME: this function seems to be unused, remove it?
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
# File '../../src/modules/ProductControl.rb', line 562 def RequiredFiles(stage, mode) # Files needed during installation. needed_client_files = [] workflow = FindMatchingWorkflow(stage, mode) modules = Ops.get_list(workflow, "modules", []) modules = Builtins.filter(modules) do |m| Ops.get_boolean(m, "enabled", true) end Builtins.foreach(modules) do |m| client = "" if Stage.firstboot client = Ops.get_string(m, "name", "dummy") else if Builtins.issubstring(Ops.get_string(m, "name", "dummy"), "inst_") client = Ops.get_string(m, "name", "dummy") else client = Ops.add("inst_", Ops.get_string(m, "name", "dummy")) end end # FIXME: what about the ruby files? client = Ops.add( Ops.add(Ops.add(Directory.clientdir, "/"), client), ".ycp" ) needed_client_files = Builtins.add(needed_client_files, client) end needed_client_files = Builtins.toset(needed_client_files) deep_copy(needed_client_files) end |
- (Object) ResetAdditionalWorkflowParams
Resets all additional params for selecting the workflow
1603 1604 1605 1606 1607 |
# File '../../src/modules/ProductControl.rb', line 1603 def ResetAdditionalWorkflowParams @_additional_workflow_params = {} nil end |
- (Object) RestartingStep
Return step which restarted YaST (or rebooted the system)
1571 1572 1573 1574 1575 |
# File '../../src/modules/ProductControl.rb', line 1571 def RestartingStep return nil if @restarting_step.nil? modules = getModules(Stage.stage, Mode.mode, :enabled) Ops.get(modules, @restarting_step, {}) end |
- (Object) retranslateWizardDialog
Re-translate static part of wizard dialog and other predefined messages after language change
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 |
# File '../../src/modules/ProductControl.rb', line 1214 def retranslateWizardDialog Builtins.y2milestone("Retranslating messages, redrawing wizard steps") # Make sure the labels for default function keys are retranslated, too. # Using Label::DefaultFunctionKeyMap() from Label module. UI.SetFunctionKeys(Label.DefaultFunctionKeyMap) # Activate language changes on static part of wizard dialog RetranslateWizardSteps() Wizard.RetranslateButtons Wizard.SetFocusToNextButton nil end |
- (Object) RetranslateWizardSteps
Retranslate Wizard Steps
962 963 964 965 966 967 968 969 970 |
# File '../../src/modules/ProductControl.rb', line 962 def RetranslateWizardSteps if Ops.greater_than(Builtins.size(@last_stage_mode), 0) Builtins.y2debug("Retranslating wizard steps") @force_UpdateWizardSteps = true UpdateWizardSteps(@last_stage_mode) end nil end |
- (Object) Run
Run Workflow
1546 1547 1548 1549 1550 |
# File '../../src/modules/ProductControl.rb', line 1546 def Run ret = RunFrom(0, false) Builtins.y2milestone("Run() returning %1", ret) ret end |
- (Object) RunFrom(from, allow_back)
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 |
# File '../../src/modules/ProductControl.rb', line 1237 def RunFrom(from, allow_back) former_result = :next final_result = nil @current_step = from # current module Wizard.SetFocusToNextButton Builtins.y2debug( "Starting Workflow with \"%1\" \"%2\"", Stage.stage, Mode.mode ) modules = getModules(Stage.stage, Mode.mode, :enabled) defaults = getModeDefaults(Stage.stage, Mode.mode) Builtins.y2debug("modules: %1", modules) if Builtins.size(modules) == 0 Builtins.y2error("No workflow found: %1", modules) # error report Report.Error(_("No workflow defined for this installation mode.")) return :abort end minimum_step = allow_back ? 0 : from if Ops.less_than(minimum_step, from) Builtins.y2warning( "Minimum step set to: %1 even if running from %2, fixing", minimum_step, from ) minimum_step = from end while Ops.greater_or_equal(@current_step, 0) && Ops.less_than(@current_step, Builtins.size(modules)) step = Ops.get(modules, @current_step, {}) Builtins.y2milestone("Current step: %1", step) step_name = Ops.get_string(step, "name", "") # BNC #401319 # if "execute" is defined, it's called without modifications step_execute = Ops.get_string(step, "execute", "") step_id = Ops.get_string(step, "id", "") run_in_update_mode = Ops.get_boolean(step, "update", true) # default is true retranslate = Ops.get_boolean(step, "retranslate", false) # The very first dialog has back button disabled if Ops.less_or_equal(@current_step, minimum_step) # Don't mark back button disabled when back button status # is forced in the control file if !Builtins.haskey(step, "enable_back") Ops.set(step, "enable_back", "no") Builtins.y2milestone( "Disabling back: %1 %2 %3", @current_step, minimum_step, Ops.get(step, "enable_back") ) end end do_continue = false do_continue = true if !checkArch(step, defaults) do_continue = true if checkDisabled(step) do_continue = true if checkHeading(step) do_continue = true if !run_in_update_mode && Mode.update if do_continue if former_result == :next if Ops.less_or_equal(@current_step, minimum_step) && !allow_back minimum_step = Ops.add(minimum_step, 1) end @current_step = Ops.add(@current_step, 1) else @current_step = Ops.subtract(@current_step, 1) end end # Continue in 'while' means 'next step' next if do_continue argterm = getClientTerm(step, defaults, former_result) Builtins.y2milestone("Running module: %1 (%2)", argterm, @current_step) module_name = Builtins.symbolof(argterm) Builtins.y2milestone("Calling %1", argterm) if !wasRun(step_name) DebugHooks.Checkpoint(Builtins.sformat("%1", module_name), true) DebugHooks.Run(step_name, true) end args = [] i = 0 while Ops.less_than(i, Builtins.size(argterm)) Ops.set(args, i, Ops.get(argterm, i)) i = Ops.add(i, 1) end UI.WizardCommand(term(:SetCurrentStep, step_id)) @CurrentWizardStep = step_id # Register what step we are going to run if !Stage.initial if !SCR.Write( path(".target.string"), Installation.current_step, step_id ) Builtins.y2error("Error writing step identifier") end end Hooks.run("before_#{step_name}") result = WFM.CallFunction(getClientName(step_name, step_execute), args) # this code will be triggered before the red pop window appears on the user's screen Hooks.run("installation_failure") if result == false result = Convert.to_symbol(result) Hooks.run("after_#{step_name}") Builtins.y2milestone("Calling %1 returned %2", argterm, result) # bnc #369846 if result == :accept || result == :ok Builtins.y2milestone("Evaluating %1 as it was `next", result) result = :next end # Clients can break the installation/workflow Wizard.RestoreNextButton Wizard.RestoreAbortButton Wizard.RestoreBackButton # Remove file if step was run and returned (without a crash); if Ops.less_than(@current_step, Ops.subtract(Builtins.size(modules), 1)) && !Stage.initial if !Convert.to_boolean( SCR.Execute(path(".target.remove"), Installation.current_step) ) Builtins.y2error("Error removing step identifier") end end # Dont call debug hook scripts after installation is done. (#36831) if Ops.less_than(@current_step, Ops.subtract(Builtins.size(modules), 1)) && !wasRun(step_name) DebugHooks.Run(step_name, false) else Builtins.y2milestone( "Not running debug hooks at the end of the installation" ) end # This should be safe (#36831) DebugHooks.Checkpoint(step_name, false) # exit hook addToStack(step_name) if retranslate Builtins.y2milestone("retranslate") retranslateWizardDialog retranslate = false end # If the module return nil, something basic went wrong. # We show a stub dialog instead. if result.nil? # If workflow module is marked as optional, skip if it returns nil, # For example, if it is not installed. if Ops.get_boolean(step, "optional", false) Builtins.y2milestone( "Skipping optional %1", Builtins.symbolof(argterm) ) @current_step = Ops.add(@current_step, 1) next end r = nil r = Popup.ModuleError( Builtins.sformat( # TRANSLATORS: an error message # this should not happen, but life is cruel... # %1 - (failed) module name # %2 - logfile, possibly with errors # %3 - link to our bugzilla # %4 - directory where YaST logs are stored # %5 - link to the Yast Bug Reporting HOWTO Web page "Calling the YaST module %1 has failed.\n" \ "More information can be found near the end of the '%2' file.\n" \ "\n" \ "This is worth reporting a bug at %3.\n" \ "Please, attach also all YaST logs stored in the '%4' directory.\n" \ "See %5 for more information about YaST logs.", Builtins.symbolof(argterm), "/var/log/YaST2/y2log", "http://bugzilla.suse.com/", "/var/log/YaST2/", # link to the Yast Bug Reporting HOWTO # for translators: use the localized page for your language if it exists, # check the combo box "In other laguages" on top of the page _("http://en.opensuse.org/Bugs/YaST") ) ) if r == :next @current_step = Ops.add(@current_step, 1) elsif r == :back @current_step = Ops.subtract(@current_step, 1) elsif r != :again UI.CloseDialog return nil end next end # BNC #468677 # The very first dialog must not exit with `back # or `auto if @current_step == 0 && (result == :back || result == :auto && former_result == :back) Builtins.y2warning( "Returned %1, Current step %2 (%3). The current step will be called again...", result, @current_step, step_name ) former_result = :next result = :again end if result == :next @current_step = Ops.add(@current_step, 1) elsif result == :back @current_step = Ops.subtract(@current_step, 1) elsif result == :cancel break elsif result == :abort # handling when user aborts the workflow (FATE #300422, bnc #406401, bnc #247552) final_result = result Hooks.run("installation_aborted") break elsif result == :finish break elsif result == :again next # Show same dialog again # BNC #475650: Adding `reboot_same_step elsif result == :restart_yast || result == :restart_same_step || result == :reboot || result == :reboot_same_step final_result = result break elsif result == :auto if !former_result.nil? if former_result == :next # if the first client just returns `auto, the back button # of the next client must be disabled if Ops.less_or_equal(@current_step, minimum_step) && !allow_back minimum_step = Ops.add(minimum_step, 1) end @current_step = Ops.add(@current_step, 1) elsif former_result == :back @current_step = Ops.subtract(@current_step, 1) end end next end former_result = result end final_result = :abort if former_result == :abort Builtins.y2milestone( "Former result: %1, Final result: %2", former_result, final_result ) if !final_result.nil? Builtins.y2milestone("Final result already set.") elsif Ops.less_or_equal(@current_step, -1) final_result = :back else final_result = :next end Builtins.y2milestone( "Current step: %1, Returning: %2", @current_step, final_result ) final_result end |
- (Boolean) RunRequired(stage, mode)
Returns whether is is required to run YaST in the defined stage and mode
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 |
# File '../../src/modules/ProductControl.rb', line 647 def RunRequired(stage, mode) modules = getModules(stage, mode, :enabled) if modules.nil? Builtins.y2error("Undefined %1/%2", stage, mode) return nil end modules = Builtins.filter(modules) do |one_module| # modules if !Ops.get_string(one_module, "name").nil? && Ops.get_string(one_module, "name", "") != "" next true # proposals elsif !Ops.get_string(one_module, "proposal").nil? && Ops.get_string(one_module, "proposal", "") != "" next true end # the rest false end # for debugging purposes Builtins.y2milestone("Enabled: (%1) %2", Builtins.size(modules), modules) Ops.greater_than(Builtins.size(modules), 0) end |
- (Object) SetAdditionalWorkflowParams(params)
Sets additional params for selecting the workflow
1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 |
# File '../../src/modules/ProductControl.rb', line 1589 def SetAdditionalWorkflowParams(params) params = deep_copy(params) Builtins.y2milestone( "Adjusting new additional workflow params: %1", params ) @_additional_workflow_params = deep_copy(params) nil end |
- (Object) setClientPrefix(prefix)
Set Client Prefix
140 141 142 143 |
# File '../../src/modules/ProductControl.rb', line 140 def setClientPrefix(prefix) @_client_prefix = prefix nil end |
- (Object) SkippedSteps
List steps which were skipped since last restart of YaST
1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 |
# File '../../src/modules/ProductControl.rb', line 1556 def SkippedSteps modules = getModules(Stage.stage, Mode.mode, :enabled) return nil if @first_step.nil? return nil if Ops.greater_or_equal(@first_step, Builtins.size(modules)) index = 0 ret = [] while Ops.less_than(index, @first_step) ret = Builtins.add(ret, Ops.get(modules, index, {})) index = Ops.add(index, 1) end deep_copy(ret) end |
- (Object) UnDisableAllModulesAndProposals(mode, stage)
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File '../../src/modules/ProductControl.rb', line 745 def UnDisableAllModulesAndProposals(mode, stage) this_workflow = { "mode" => mode, "stage" => stage } # Such mode/stage not disabled if !Builtins.contains(@already_disabled_workflows, this_workflow) Builtins.y2milestone( "Not yet disabled, not un-disabling: %1", this_workflow ) return end Builtins.y2milestone("Un-Disabling workflow %1", this_workflow) @already_disabled_workflows = Builtins.filter(@already_disabled_workflows) do |one_workflow| one_workflow != this_workflow end # Note: This might be done by a simple reverting with 'X = localX' # but some of these modules don't need to be in a defined mode and stage Builtins.foreach(getModules(stage, mode, :all)) do |m| # A proposal # Enable it only if it was enabled before if !Ops.get_string(m, "proposal").nil? && Ops.get_string(m, "proposal", "") != "" && !Builtins.contains( @localDisabledProposals, Ops.get_string(m, "proposal", "") ) Builtins.y2milestone("Enabling proposal: %1", m) @DisabledProposals = Builtins.filter(@DisabledProposals) do |one_proposal| Ops.get_string(m, "proposal", "") != one_proposal end # A module # Enable it only if it was enabled before elsif !Ops.get_string(m, "name").nil? && Ops.get_string(m, "name", "") != "" && !Builtins.contains( @localDisabledModules, Ops.get_string(m, "name", "") ) Builtins.y2milestone("Enabling module: %1", m) @DisabledModules = Builtins.filter(@DisabledModules) do |one_module| Ops.get_string(m, "name", "") != one_module end end end nil end |
- (Object) UpdateWizardSteps(stagemode)
Update Steps
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
# File '../../src/modules/ProductControl.rb', line 939 def UpdateWizardSteps(stagemode) stagemode = deep_copy(stagemode) if @force_UpdateWizardSteps == true Builtins.y2milestone("UpdateWizardSteps forced") @force_UpdateWizardSteps = false elsif @DisabledModules != @lastDisabledModules Builtins.y2milestone("Disabled modules were changed") elsif @last_stage_mode == stagemode Builtins.y2milestone("No changes in Wizard steps") return end @last_stage_mode = deep_copy(stagemode) @lastDisabledModules = deep_copy(@DisabledModules) UI.WizardCommand(term(:DeleteSteps)) # Also redraws the wizard and sets the current step AddWizardSteps(stagemode) nil end |
- (Object) wasRun(name)
1233 1234 1235 |
# File '../../src/modules/ProductControl.rb', line 1233 def wasRun(name) Builtins.contains(@stack, name) end |