ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/mail-server_auto.ycp

/**
 * File:	clients/mail-server_auto.ycp
 * Package:	Configuration of mail-server
 * Summary:	Client for autoinstallation
 * Authors:	Peter Varkoly <varkoly@suse.de>
 *
 * $Id: mail-server_auto.ycp 19955 2004-10-26 12:28:16Z varkoly $
 *
 * This is a client for autoinstallation. It takes its arguments,
 * goes through the configuration and return the setting.
 * Does not do any changes to the configuration.
 */

/**
 * @param function to execute
 * @param map/list of mail-server 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 ("mail-server_auto", [ "Summary", mm ]);
 */

{

textdomain "mail";

y2milestone("----------------------------------------");
y2milestone("MailServer auto started");

import "MailServer";
include "mail/mail-server_wizards.ycp";

any ret = nil;
string func = "";
map param = $[];

/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
    func = (string)WFM::Args(0);
    if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
	param = (map) WFM::Args(1);
}
y2debug("func=%1", func);
y2debug("param=%1", param);

/* Create a summary*/
if(func == "Summary") {
    ret = select(MailServer::Summary(), 0, "");
}
/* Reset configuration */
else if (func == "Reset") {
    MailServer::Import($[]);
    ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
    ret = MailServerAutoSequence();
}
/* Import configuration */
else if (func == "Import") {
    ret = MailServer::Import(param);
}
/* Return actual state */
else if (func == "Export") {
    ret = MailServer::Export();
}
/* Return needed packages */
else if (func == "Packages") {
    ret = MailServer::AutoPackages();
}
/* Read current state */
else if (func == "Read") {
    import "Progress";
    Progress::off();
    ret = MailServer::Read();
    Progress::on();
}
/* Write givven settings */
else if (func == "Write") {
    import "Progress";
    Progress::off();
    MailServer::write_only = true;
    ret = MailServer::Write();
    Progress::on();
}
/* Unknown function */
else {
    y2error("Unknown function: %1", func);
    ret = false;
}

y2debug("ret=%1", ret);
y2milestone("MailServer auto finished");
y2milestone("----------------------------------------");

return ret;

/* EOF */
}

ACC SHELL 2018