3. Run-time modules in auto mode

The <module name>_auto.ycp client accepts 2 arguments:

The following functions are needed to make any module work in AutoYaST:

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 */
	}