The <module name>_auto.ycp client accepts 2 arguments:
Function
Configuration Data
The following functions are needed to make any module work in AutoYaST:
Import:
Import existing data into the module, usually done only once at the beginning.
Summary:
To provide a brief summary of the configuration. Calls >Module<::Summary()
Reset:
Resets the configuration. It returns empty values but it also can return default values, depending on the module.
Change:
This function starts the widget sequence
Write
Write the configuration without displaying any widgets and popups and without restarting any services etc. Calls <Module>::Write (and sets <Module>::write_only true)
Export:
Returns the current configuration Calls <Module>::Export
Packages:
Returns a map with two key/value pairs. First key is install which has a list as the value. the list contains packages that are needed for the service configured by the module to work. This can be a static list of packages or a dynamic list depending on the configuration. The second key is remove which contains packages that should be removed to avoid conflicts with other packages. the packages in remove are normally determined dynamically, depending on the configuration.
The function can either return a map directly or it can call a module function <Module>::AutoPackages().
The following example shows <module name>_auto.ycp with the changes needed for the new behaviour.
Example 1. XXpkgXX_auto.ycp (XXpkgXX = module name)
/** * @param function to execute * @param map/list of XXpkgXX settings * @return map edited settings, * Summary or boolean on success depending on called function * @example map mm = $[ "FAIL_DELAY" : "77" ]; * @example map ret = WFM::CallFunction ("XXpkgXX_auto", [ "Summary", mm ]); */ { textdomain "XXpkgXX"; y2milestone("----------------------------------------"); y2milestone("XXPkgXX auto started"); import "XXPkgXX"; include "XXpkgXX/wizards.ycp"; any ret = nil; string func = ""; map param = $[]; /* Check arguments */ if(size(Args()) > 0 && is(Args(0), string)) { func = WFM::Args(0); if(size(Args()) > 1 && is(Args(1), map)) param = WFM::Args(1); } y2debug("func=%1", func); y2debug("param=%1", param); /* Create a summary*/ if(func == "Summary") { ret = select(XXPkgXX::Summary(), 0, ""); } else if (func == "Import") { ret = XXPkgXX::Import($[]); return ret ; } /* Reset configuration */ else if (func == "Reset") { XXPkgXX::Import($[]); ret = $[]; } /* Change configuration (run AutoSequence) */ else if (func == "Change") { ret = XXPkgXXAutoSequence(); } /* Return required packages */ else if (func == "Packages") { ret = XXPkgXX::AutoPackags(); } /* Return actual state */ else if (func == "Export") { ret = XXPkgXX::Export(); } /* Write given settings */ else if (func == "Write") { import "Progress"; XXPkgXX::write_only = true; Progress::off(); ret = XXPkgXX::Write(); Progress::on(); return ret; } /* Unknown function */ else { y2error("Unknown function: %1", func); ret = false; } y2debug("ret=%1", ret); y2milestone("XXPkgXX auto finished"); y2milestone("----------------------------------------"); return ret; /* EOF */ }