Class: Yast::ProductControlClass
- Inherits:
-
Module
- Object
- Module
- Yast::ProductControlClass
- Includes:
- Logger
- Defined in:
- library/control/src/modules/ProductControl.rb
Constant Summary collapse
- SYSTEM_ROLES_KEY =
Product control system roles key
"system_roles".freeze
Instance Method Summary collapse
-
#add_system_roles(new_roles) ⇒ Object
Add new system roles.
-
#AddWizardSteps(stagemode) ⇒ void
Add Wizard Steps.
- #Check(allowed, current) ⇒ Object
-
#CheckAdditionalParams(check_workflow) ⇒ Object
Checks all params set by SetAdditionalWorkflowParams() whether they match the workfow got as parameter.
-
#checkArch(mod, def_) ⇒ Boolean
Check if valid architecture.
-
#checkDisabled(mod) ⇒ Boolean
Check if a module is disabled.
- #checkHeading(mod) ⇒ Object
- #CurrentStep ⇒ Object
- #DisableAllModulesAndProposals(mode, stage) ⇒ Object
-
#DisableModule(modname) ⇒ Object
Disable given module in installation workflow.
-
#DisableProposal(disable_proposal) ⇒ Object
Disable given proposal in installation workflow.
- #DisableSubProposal(unique_id, disable_subproposal) ⇒ Object
-
#EnableModule(modname) ⇒ Object
Enable given disabled module.
-
#EnableProposal(enable_proposal) ⇒ Object
Enable given disabled proposal.
- #EnableSubProposal(unique_id, enable_subproposal) ⇒ Object
-
#FindMatchingWorkflow(stage, mode) ⇒ Hash
Returns workflow matching the selected stage and mode and additiona parameters if set by SetAdditionalWorkflowParams().
-
#getClientName(name, execute) ⇒ Object
Returns name of the script to call.
-
#getClientTerm(step, def_, former_result) ⇒ Yast::Term
Return term to be used to run module with CallFunction.
-
#getCompleteWorkflow(stage, mode) ⇒ Hash
Get Workflow.
-
#GetDisabledModules ⇒ Array<String>
Returns list of modules disabled in workflow.
-
#GetDisabledProposals ⇒ Array<String>
Returns list of proposals disabled in workflow.
- #GetDisabledSubProposals ⇒ Object
- #getMatchingProposal(stage, mode, proptype) ⇒ Object
-
#getModeDefaults(stage, mode) ⇒ Hash
Get workflow defaults.
-
#getModules(stage, mode, which) ⇒ Array<Hash>
Get modules of current Workflow.
-
#getProposalProperties(stage, mode, proptype) ⇒ Hash
One "proposal" element of control.rnc where /label is not translated yet but //proposal_tab/label are.
-
#getProposals(stage, mode, proptype) ⇒ Array<Array(String,Integer)>
Get modules of current Workflow.
-
#getProposalTextDomain ⇒ Object
Return text domain.
- #GetTranslatedText(key) ⇒ Object
-
#getWorkflowLabel(stage, mode, wz_td) ⇒ String
Get Workflow Label.
-
#Init ⇒ Boolean
Initialize Product Control.
- #main ⇒ Object
-
#PrepareScripts(workflow) ⇒ void
Prepare Workflow Scripts.
-
#ProductControl ⇒ void
ProductControl Constructor.
-
#ReadControlFile(controlfile) ⇒ Boolean
Read XML Control File.
-
#ResetAdditionalWorkflowParams ⇒ Object
Resets all additional params for selecting the workflow.
-
#RestartingStep ⇒ Object
Return step which restarted YaST (or rebooted the system).
-
#retranslateWizardDialog ⇒ Object
Re-translate static part of wizard dialog and other predefined messages after language change.
-
#RetranslateWizardSteps ⇒ Object
Retranslate Wizard Steps.
-
#Run ⇒ Object
Run Workflow.
- #RunFrom(from, allow_back) ⇒ Object
-
#RunRequired(stage, mode) ⇒ Boolean
Returns whether is is required to run YaST in the defined stage and mode.
-
#SetAdditionalWorkflowParams(params) ⇒ Object
Sets additional params for selecting the workflow.
-
#setClientPrefix(prefix) ⇒ Object
Set Client Prefix.
-
#SkippedSteps ⇒ Object
List steps which were skipped since last restart of YaST.
- #UnDisableAllModulesAndProposals(mode, stage) ⇒ Object
-
#UpdateWizardSteps(stagemode) ⇒ Object
Update Steps.
Instance Method Details
#add_system_roles(new_roles) ⇒ Object
Add new system roles
For the time being, new roles are appended to the list of roles.
1575 1576 1577 1578 |
# File 'library/control/src/modules/ProductControl.rb', line 1575 def add_system_roles(new_roles) log.info "Adding roles to product control: #{new_roles.inspect}" system_roles.concat(new_roles) end |
#AddWizardSteps(stagemode) ⇒ void
This method returns an undefined value.
Add Wizard Steps
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 795 796 797 798 799 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 |
# File 'library/control/src/modules/ProductControl.rb', line 764 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(wizard_textdomain, last_label) else label = Builtins.dgettext(last_domain, last_label) id = Ops.get_string(m, "id", "") end id = Ops.get_string(m, "id", "") end end UI.WizardCommand(term(:AddStepHeading, heading)) if !heading.nil? && heading != "" 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 |
#Check(allowed, current) ⇒ Object
348 349 350 351 352 353 354 355 356 357 |
# File 'library/control/src/modules/ProductControl.rb', line 348 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) Builtins.size(allowedlist) == 0 || Builtins.contains(allowedlist, current) end |
#CheckAdditionalParams(check_workflow) ⇒ Object
Checks all params set by SetAdditionalWorkflowParams() whether they match the workfow got as parameter.
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 479 |
# File 'library/control/src/modules/ProductControl.rb', line 454 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 |
#checkArch(mod, def_) ⇒ Boolean
Check if valid architecture
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'library/control/src/modules/ProductControl.rb', line 363 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 |
#checkDisabled(mod) ⇒ Boolean
Check if a module is disabled
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'library/control/src/modules/ProductControl.rb', line 258 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", "") != "" return true if Builtins.contains(@DisabledModules, Ops.get_string(mod, "name", "")) end false end |
#checkHeading(mod) ⇒ Object
283 284 285 286 |
# File 'library/control/src/modules/ProductControl.rb', line 283 def checkHeading(mod) mod = deep_copy(mod) Builtins.haskey(mod, "heading") end |
#CurrentStep ⇒ Object
141 142 143 |
# File 'library/control/src/modules/ProductControl.rb', line 141 def CurrentStep @current_step end |
#DisableAllModulesAndProposals(mode, stage) ⇒ Object
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'library/control/src/modules/ProductControl.rb', line 658 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 |
#DisableModule(modname) ⇒ Object
Disable given module in installation workflow
163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'library/control/src/modules/ProductControl.rb', line 163 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 |
#DisableProposal(disable_proposal) ⇒ Object
Disable given proposal in installation workflow
196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'library/control/src/modules/ProductControl.rb', line 196 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 |
#DisableSubProposal(unique_id, disable_subproposal) ⇒ Object
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'library/control/src/modules/ProductControl.rb', line 230 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 |
#EnableModule(modname) ⇒ Object
Enable given disabled module
153 154 155 156 157 158 159 |
# File 'library/control/src/modules/ProductControl.rb', line 153 def EnableModule(modname) @DisabledModules = Builtins.filter(@DisabledModules) do |mod| mod != modname end deep_copy(@DisabledModules) end |
#EnableProposal(enable_proposal) ⇒ Object
Enable given disabled proposal
186 187 188 189 190 191 192 |
# File 'library/control/src/modules/ProductControl.rb', line 186 def EnableProposal(enable_proposal) @DisabledProposals = Builtins.filter(@DisabledProposals) do |one_proposal| one_proposal != enable_proposal end deep_copy(@DisabledProposals) end |
#EnableSubProposal(unique_id, enable_subproposal) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'library/control/src/modules/ProductControl.rb', line 217 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 |
#FindMatchingWorkflow(stage, mode) ⇒ Hash
Returns workflow matching the selected stage and mode and additiona parameters if set by SetAdditionalWorkflowParams()
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'library/control/src/modules/ProductControl.rb', line 487 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 |
#getClientName(name, execute) ⇒ Object
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.
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'library/control/src/modules/ProductControl.rb', line 387 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 return name if @custom_control_file != "" # All standard clients start with "inst_" Builtins.issubstring(name, @_client_prefix) ? name : Ops.add(@_client_prefix, name) end |
#getClientTerm(step, def_, former_result) ⇒ Yast::Term
Return term to be used to run module with CallFunction
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 447 |
# File 'library/control/src/modules/ProductControl.rb', line 408 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 Ops.set(arguments, "proposal", Ops.get_string(step, "proposal", "")) if Builtins.haskey(step, "proposal") 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 Ops.set(arguments, "going_back", true) if Ops.is_symbol?(former_result) && former_result == :back 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 |
#getCompleteWorkflow(stage, mode) ⇒ Hash
Get Workflow
564 565 566 |
# File 'library/control/src/modules/ProductControl.rb', line 564 def getCompleteWorkflow(stage, mode) FindMatchingWorkflow(stage, mode) end |
#GetDisabledModules ⇒ Array<String>
Returns list of modules disabled in workflow
180 181 182 |
# File 'library/control/src/modules/ProductControl.rb', line 180 def GetDisabledModules deep_copy(@DisabledModules) end |
#GetDisabledProposals ⇒ Array<String>
Returns list of proposals disabled in workflow
213 214 215 |
# File 'library/control/src/modules/ProductControl.rb', line 213 def GetDisabledProposals deep_copy(@DisabledProposals) end |
#GetDisabledSubProposals ⇒ Object
251 252 253 |
# File 'library/control/src/modules/ProductControl.rb', line 251 def GetDisabledSubProposals deep_copy(@DisabledSubProposals) end |
#getMatchingProposal(stage, mode, proptype) ⇒ Object
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 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 |
# File 'library/control/src/modules/ProductControl.rb', line 934 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 |
#getModeDefaults(stage, mode) ⇒ Hash
Get workflow defaults
508 509 510 511 |
# File 'library/control/src/modules/ProductControl.rb', line 508 def getModeDefaults(stage, mode) workflow = FindMatchingWorkflow(stage, mode) Ops.get_map(workflow, "defaults", {}) end |
#getModules(stage, mode, which) ⇒ Array<Hash>
Get modules of current Workflow
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'library/control/src/modules/ProductControl.rb', line 573 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 if which == :enabled modules = Builtins.filter(modules) do |m| Ops.get_boolean(m, "enabled", true) && !checkDisabled(m) end end 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 |
#getProposalProperties(stage, mode, proptype) ⇒ Hash
Returns one "proposal" element of control.rnc where /label is not translated yet but //proposal_tab/label are.
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 |
# File 'library/control/src/modules/ProductControl.rb', line 1091 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 |
#getProposals(stage, mode, proptype) ⇒ Array<Array(String,Integer)>
Get modules of current Workflow
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 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
# File 'library/control/src/modules/ProductControl.rb', line 1015 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 Builtins.y2milestone( "Proposal module %1 found among disabled subproposals", proposal_name ) else final_proposals = if Builtins.issubstring(proposal_name, "_proposal") Builtins.add( final_proposals, [proposal_name, order_value] ) else Builtins.add( final_proposals, [Ops.add(proposal_name, "_proposal"), order_value] ) end end end Builtins.y2debug("final proposals: %1", final_proposals) deep_copy(final_proposals) end |
#getProposalTextDomain ⇒ Object
Return text domain
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File 'library/control/src/modules/ProductControl.rb', line 1072 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 |
#GetTranslatedText(key) ⇒ Object
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 |
# File 'library/control/src/modules/ProductControl.rb', line 1115 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 |
#getWorkflowLabel(stage, mode, wz_td) ⇒ String
Get Workflow Label
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
# File 'library/control/src/modules/ProductControl.rb', line 642 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 ) end Builtins.dgettext(wz_td, label) end |
#Init ⇒ Boolean
Initialize Product Control
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 |
# File 'library/control/src/modules/ProductControl.rb', line 1145 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 |
#main ⇒ Object
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 134 135 136 137 138 139 |
# File 'library/control/src/modules/ProductControl.rb', line 42 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 "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 = [] # roles @system_roles = [] # 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_" @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 |
#PrepareScripts(workflow) ⇒ void
This method returns an undefined value.
Prepare Workflow Scripts
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 558 |
# File 'library/control/src/modules/ProductControl.rb', line 516 def PrepareScripts(workflow) workflow = deep_copy(workflow) tmp_dir = Convert.to_string(WFM.Read(path(".local.tmpdir"), [])) if Builtins.haskey(workflow, "prescript") interpreter = Ops.get_string(workflow, ["prescript", "interpreter"], "shell") source = Ops.get_string(workflow, ["prescript", "source"], "") type = (interpreter == "shell") ? "sh" : "pl" f = Builtins.sformat( "%1/%2_pre.%3", tmp_dir, Ops.get_string(workflow, "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(workflow, "name", ""), type) ) ) end if Builtins.haskey(workflow, "postscript") interpreter = Ops.get_string(workflow, ["postscript", "interpreter"], "shell") source = Ops.get_string(workflow, ["postscript", "source"], "") type = (interpreter == "shell") ? "sh" : "pl" f = Builtins.sformat( "%1/%2_post.%3", tmp_dir, Ops.get_string(workflow, "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(workflow, "name", ""), type) ) ) end nil end |
#ProductControl ⇒ void
This method returns an undefined value.
ProductControl Constructor
1535 1536 1537 1538 |
# File 'library/control/src/modules/ProductControl.rb', line 1535 def ProductControl Builtins.y2error("control file missing") if !Init() nil end |
#ReadControlFile(controlfile) ⇒ Boolean
Read XML Control File
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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'library/control/src/modules/ProductControl.rb', line 291 def ReadControlFile(controlfile) begin @productControl = XML.XMLToYCPFile(controlfile) rescue RuntimeError => e log.error "Failed to read control file: #{e.inspect}" return false end # log the read control.xml control_log_dir_rotator = Yast2::ControlLogDirRotator.new control_log_dir_rotator.prepare control_log_dir_rotator.copy(controlfile, "control.xml") control_log_dir_rotator.write("README", "The first number in the filename is the merge "\ "counter, the second number\nis the add-on counter.\n") @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", []) @system_roles = @productControl.fetch(SYSTEM_ROLES_KEY, []) Builtins.foreach( ["software", "globals", "network", "partitioning", "texts", "configuration_management"] ) 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 |
#ResetAdditionalWorkflowParams ⇒ Object
Resets all additional params for selecting the workflow
1559 1560 1561 1562 1563 |
# File 'library/control/src/modules/ProductControl.rb', line 1559 def ResetAdditionalWorkflowParams @_additional_workflow_params = {} nil end |
#RestartingStep ⇒ Object
Return step which restarted YaST (or rebooted the system)
1526 1527 1528 1529 1530 1531 |
# File 'library/control/src/modules/ProductControl.rb', line 1526 def RestartingStep return nil if @restarting_step.nil? modules = getModules(Stage.stage, Mode.mode, :enabled) Ops.get(modules, @restarting_step, {}) end |
#retranslateWizardDialog ⇒ Object
Re-translate static part of wizard dialog and other predefined messages after language change
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 |
# File 'library/control/src/modules/ProductControl.rb', line 1176 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 |
#RetranslateWizardSteps ⇒ Object
Retranslate Wizard Steps
924 925 926 927 928 929 930 931 932 |
# File 'library/control/src/modules/ProductControl.rb', line 924 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 |
#Run ⇒ Object
Run Workflow
1500 1501 1502 1503 1504 |
# File 'library/control/src/modules/ProductControl.rb', line 1500 def Run ret = RunFrom(0, false) Builtins.y2milestone("Run() returning %1", ret) ret end |
#RunFrom(from, allow_back) ⇒ Object
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 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 |
# File 'library/control/src/modules/ProductControl.rb', line 1190 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, {}) 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) && !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 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 minimum_step = Ops.add(minimum_step, 1) if Ops.less_or_equal(@current_step, minimum_step) && !allow_back @current_step = Ops.add(@current_step, 1) else @current_step = Ops.subtract(@current_step, 1) end end # Continue in 'while' means 'next step' if do_continue log.info "Skipping step #{step.inspect}" next end argterm = getClientTerm(step, defaults, former_result) result = nil log.group("#{step["label"]} #{step["name"].inspect}") do Builtins.y2milestone("Running module: %1 (%2)", argterm, @current_step) Builtins.y2milestone("Calling %1", argterm) 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 && !SCR.Write( path(".target.string"), Installation.current_step, step_id ) Builtins.y2error("Error writing step identifier") end client_name = getClientName(step_name, step_execute) # Check if client exist before continuing if WFM.ClientExists(client_name) Hooks.run("before_#{step_name}") result = WFM.CallFunction(client_name, 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}") else # Client not found. Ask the user if want to continue (related to bsc#1180954) log.error("Client '#{client_name}' not found") text = format( # TRANSLATORS: Message warning the user that a client is missing where %{client} is # replaced by the client name (e.g. "registration", "user") _( "Something went wrong and the expected '%{client}' dialog was not found.\n\n" \ "Would you like to skip the dialog and continue anyway?" ), client: client_name ) = { yes: Label.ContinueButton, no: Label.AbortButton } continue = Yast2::Popup.show(text, buttons: ) == :yes if continue log.warn("Continuing after skipping the '#{client_name}' missing client") # If user decided to continue, uses the former_result (:next or :back) result = former_result else # :abort because user decided to not continue result = :abort end end Builtins.y2milestone("Calling %1 returned %2", argterm, result) # bnc #369846 if [:access, :ok].include?(result) 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 && !Convert.to_boolean( SCR.Execute(path(".target.remove"), Installation.current_step) ) Builtins.y2error("Error removing step identifier") end if retranslate Builtins.y2milestone("retranslate") retranslateWizardDialog retranslate = false end result 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 case result when :next @current_step = Ops.add(@current_step, 1) when :back @current_step = Ops.subtract(@current_step, 1) when :cancel, :finish break when :abort # handling when user aborts the workflow (FATE #300422, bnc #406401, bnc #247552) final_result = result Hooks.run("installation_aborted") break when :again next # Show same dialog again # BNC #475650: Adding `reboot_same_step when :restart_yast, :restart_same_step, :reboot, :reboot_same_step final_result = result break when :auto if !former_result.nil? case former_result when :next # if the first client just returns `auto, the back button # of the next client must be disabled minimum_step = Ops.add(minimum_step, 1) if Ops.less_or_equal(@current_step, minimum_step) && !allow_back @current_step = Ops.add(@current_step, 1) when :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 |
#RunRequired(stage, mode) ⇒ Boolean
Returns whether is is required to run YaST in the defined stage and mode
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 'library/control/src/modules/ProductControl.rb', line 613 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| name = one_module["name"] proposal = one_module["proposal"] next true if name && !name.empty? next true if proposal && !proposal.empty? # the rest false end # for debugging purposes Builtins.y2milestone("Enabled: (%1) %2", Builtins.size(modules), modules) Ops.greater_than(Builtins.size(modules), 0) end |
#SetAdditionalWorkflowParams(params) ⇒ Object
Sets additional params for selecting the workflow
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 |
# File 'library/control/src/modules/ProductControl.rb', line 1545 def SetAdditionalWorkflowParams(params) params = deep_copy(params) Builtins.y2milestone( "Adjusting new additional workflow params: %1", params ) @_additional_workflow_params = deep_copy(params) nil end |
#setClientPrefix(prefix) ⇒ Object
Set Client Prefix
146 147 148 149 |
# File 'library/control/src/modules/ProductControl.rb', line 146 def setClientPrefix(prefix) @_client_prefix = prefix nil end |
#SkippedSteps ⇒ Object
List steps which were skipped since last restart of YaST
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 |
# File 'library/control/src/modules/ProductControl.rb', line 1510 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 |
#UnDisableAllModulesAndProposals(mode, stage) ⇒ Object
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 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
# File 'library/control/src/modules/ProductControl.rb', line 709 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 |
#UpdateWizardSteps(stagemode) ⇒ Object
Update Steps
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 |
# File 'library/control/src/modules/ProductControl.rb', line 901 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 |