YaST2 Developers Documentation: yast2

yast2

modules/WorkflowManager.ycp
Provides API for configuring workflows
  • Lukas Ocilka
  • Provides API for managing and configuring installation and
  • configuration workflow.
  • Module was created as a solution for
  • FATE #129: Framework for pattern based Installation/Deployment
  • Module unifies Add-Ons and Patterns modifying the workflow.

This module has an unstable interface.

Imports

  • Directory
  • FileUtils
  • Label
  • ProductControl
  • ProductFeatures
  • Report
  • Stage
  • String
  • Wizard
  • XML

Structures

Global Variables

Global Functions

Local Variables

Local Functions

global additional_finish_steps_before_chroot -> list <string>

Additional inst_finish settings defined by additional control files. They are always empty at the begining.

global GetAdditionalFinishSteps (string which_steps) -> list <string>

Returns list of additional inst_finish steps requested by additional workflows.

Parameters:
which_steps
Return value:
steps to be called ...see which_steps parameter
global SetBaseWorkflow (boolean force) -> void

Stores the current ProductControl settings as the initial settings. These settings are: workflows, proposals, inst_finish, and clone_modules.

Parameters:
force
local system_proposals_prepared -> boolean

Have system proposals already been prepared for merging?

local system_workflows_prepared -> boolean

Have system workflows already been prepared for merging?

global PrepareProposals (list <map> proposals) -> list <map>

Check all proposals, split those ones which have multiple modes or architectures or stages into multiple proposals.

Structure

	Input: [
		$["label":"Example", "name":"example","proposal_modules":["one","two"],"stage":"initial,firstboot"]
	]
	Output: [
		$["label":"Example", "name":"example","proposal_modules":["one","two"],"stage":"initial"]
		$["label":"Example", "name":"example","proposal_modules":["one","two"],"stage":"firstboot"]
	]
Parameters:
proposals
Return value:
updated proposals
global PrepareSystemProposals () -> void

Check all proposals, split those ones which have multiple modes or architectures or stages into multiple proposals. Works with base product proposals.

global PrepareWorkflows (list <map> workflows) -> list <map>

Check all workflows, split those ones which have multiple modes or architectures or stages into multiple workflows

Parameters:
workflows
Return value:
updated workflows
global PrepareSystemWorkflows () -> void

Check all workflows, split those ones which have multiple modes or architectures or stages into multiple worlflows. Works with base product workflows.

local FillUpInitialWorkflowSettings () -> void

Fills the workflow with initial settings to start merging from scratch. Used workflows mustn't be cleared automatically, merging would fail!

global ResetWorkflow () -> void

Resets the Workflow (and proposals) to use the base workflow. It must be stored. Clears also all additional workflows.

local GetWorkflowDirectory () -> string

Returns the current (default) directory where workflows are stored in.

local GenerateAdditionalControlFilePath (integer src_id, string ident) -> string

Creates path to a control file from parameters. For add-on products, the 'ident' parameter is empty.

Parameters:
src_id
ident
Return value:
path to a control file based on src_id and ident params
local StoreWorkflowFile (string file_from, string file_to) -> string

Stores the workflow file to a cache

Parameters:
file_from
file_to
Return value:
final filename
global GetCachedWorkflowFilename (symbol type, integer src_id, string name) -> string

Returns requested control filename. Parameter 'name' is ignored for Add-Ons.

Parameters:
type `addon or `pattern
src_id with Source ID
name
Return value:
path to already cached workflow file, control file is downloaded if not yet chached
global AddWorkflow (symbol type, integer src_id, string name) -> boolean

Stores new workflow (if such workflow exists) into the Worflow Store.

Parameters:
type
src_id
name with unique identification name of the object ("" for `addon, pattern name for `pattern)
Return value:
whether successful (true also in case of no workflow file)
Example

	AddWorkflow (`addon, 4, "");
global RemoveWorkflow (symbol type, integer src_id, string name) -> boolean

Removes workflow (if such workflow exists) from the Worflow Store. Alose removes the cached file but in the installation.

Parameters:
type
src_id
name with unique identification name of the object
Return value:
whether successful (true also in case of no workflow file)
Example

	RemoveWorkflow (`addon, 4, "");
global CleanWorkflowsDirectory () -> void

Removes all xml and ycp files from directory where

local ReplaceProposalModule (map proposal, string old, list<string> new) -> map

Replace a module in a proposal with a set of other modules

Parameters:
proposal a map describing the proposal
old string the old item to be replaced
new a list of items to be put into instead of the old one
Return value:
a map with the updated proposal
local MergeProposal (map base, map additional_control, string prod_name, string domain) -> map

Merge add-on proposal to a base proposal

Parameters:
base
additional_control with additional control file settings
prod_name a name of the add-on product
domain
Return value:
merged proposals
local UpdateProposals (list<map> proposals, string prod_name, string domain) -> boolean

Update system proposals according to proposal update metadata

Parameters:
proposals a list of update proposals
prod_name string the product name (used in case of tabs)
domain string the text domain (for translations)
Return value:
true on success
local ReplaceWorkflowModule (map workflow, string old, list<map> new, string domain, boolean keep) -> map

Replace a module in a workflow with a set of other modules

Parameters:
workflow a map describing the workflow
old string the old item to be replaced
new a list of items to be put into instead of the old one
domain string a text domain
keep boolean true to keep original one (and just insert before)
Return value:
a map with the updated workflow
local MergeWorkflow (map base, map addon, string prod_name, string domain) -> map

Merge add-on workflow to a base workflow

Parameters:
base map the base product workflow
addon map the workflow of the addon product
prod_name a name of the add-on product
domain
Return value:
merged workflows
local UpdateWorkflows (list <map> workflows, string prod_name, string domain) -> boolean

Update system workflows according to workflow update metadata

Parameters:
workflows a list of update workflows
prod_name string the product name (used in case of tabs)
domain string the text domain (for translations)
Return value:
true on success
local UpdateInstFinish (map <string, list <string> > additional_steps) -> boolean

Add specified steps to inst_finish. Just modifies internal variables, inst_finish grabs them itself

Parameters:
additional_steps a map specifying the steps to be added
Return value:
true on success
local UpdateInstallation (map update_file, string name, string domain) -> boolean

Adapts the current workflow according to specified XML file content

Parameters:
update_file a map containing the additional product control file
name string the name of the additional product
domain string the text domain for the additional control file
Return value:
true on success
local AddNewProposals (list <map> proposals) -> boolean

Add new defined proposal to the list of system proposals

Parameters:
proposals a list of proposals to be added
Return value:
true on success
local Replaceworkflows (list <map> workflows) -> boolean

Replace workflows for 2nd stage of installation

Parameters:
workflows a list of the workflows
Return value:
true on success
global WorkflowsRequiringRegistration () -> list <string>

Returns list of workflows requiring registration

See
FATE #305578: Add-On Product Requiring Registration
global WorkflowRequiresRegistration (integer src_id) -> boolean

Returns whether a repository workflow requires registration

Parameters:
src_id
Return value:
if registration is required
local UpdateProductInfo (map update_file, string filename) -> boolean

Update product options such as global settings, software, partitioning or network.

Parameters:
update_file a map containing update control file
filename
Return value:
true on success
local controlfile_texts -> map <string, any>

Structure $[

   "congratulate" : $[
     "label" : "some text",
   ],
   "congratulate2" : $[
     "label" : "some other text",
     "textdomain" : "control-2", // (optionally)
   ],
 ];
global RedrawWizardSteps () -> boolean

Redraws workflow steps. Function must be called when steps (or help for steps) are active. It doesn't work in case of active another dialog.

local IntegrateWorkflow (string filename) -> boolean

Integrate the changes in the workflow

Parameters:
filename string filename of the control file (local filename)
Return value:
true on success
local GenerateWorkflowIdent (string workflow_filename) -> string

Returns file unique identification in format ${file_MD5sum}-${file_size} Returns 'nil' if file doesn't exist, it is not a 'file', etc.

Parameters:
workflow_filename
Return value:
file_ident
global MergeWorkflows () -> boolean

Function uses the Base Workflow as the initial one and merges all added workflow into that workflow.

Return value:
if successful
global SomeWorkflowsWereChanged () -> boolean

Returns whether some additional control files were added or removed from the last time MergeWorkflows() was called.

Return value:
boolen see description
global GetAllUsedControlFiles () -> list <string>

Returns list of control-file names currently used

Return value:
files
global SetAllUsedControlFiles (list <string> new_list) -> void

Sets list of control-file names to be used. ATTENTION: this is dangerous and should be used in rare cases only!

Parameters:
new_list
Example

	SetAllUsedControlFiles (["/tmp/new_addon_control.xml", "/root/special_addon.xml"]);
See
GetAllUsedControlFiles()
global HaveAdditionalWorkflows () -> boolean

Returns whether some additional control files are currently in use.

Return value:
some additional control files are in use.
global DumpCurrentSettings () -> map <string, any>

Returns the current settings used by WorkflowManager. This function is just for debugging purpose.

Structure [

		"workflows" : ...
		"proposals" : ...
		"inst_finish" : ...
		"clone_modules" : ...
		"unmerged_changes" : ...
	];
Return value:
of current settings