ACC SHELL

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

/**
 * File:	clients/samba-server_auto.ycp
 * Package:	Configuration of samba-server
 * Summary:	Client for autoinstallation
 * Authors:	Stanislav Visnovsky <visnov@suse.cz>
 *
 * $Id: samba-server_auto.ycp 20927 2005-01-25 08:15:13Z mlazar $
 *
 * 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 samba-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 ("samba-server_auto", [ "Summary", mm ]);
 */

{

textdomain "samba-server";

y2milestone("----------------------------------------");
y2milestone("Samba-server auto started");

import "SambaServer";
include "samba-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 = SambaServer::Summary();
}
/* Reset configuration */
else if (func == "Reset") {
    SambaServer::Import($[]);
    ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
    ret = SambaServerAutoSequence();
}
/* Import configuration */
else if (func == "Import") {
    ret = SambaServer::Import(param);
}
/* Return required packages */
else if (func == "Packages") {
    ret = SambaServer::AutoPackages();
}
/* Return actual state */
else if (func == "Export") {
    ret = SambaServer::Export();
}
/* Read current state */
else if (func == "Read") {
    import "Progress";
    boolean po = Progress::set(false);
    ret = SambaServer::Read();
    Progress::set(po);
}
/* Write givven settings */
else if (func == "Write") {
    import "Progress";
    boolean po = Progress::set(false);
    ret = SambaServer::Write(true);
    Progress::set(po);
}

/**
 * Return if configuration  was changed
 * return boolean
 */
else if (func == "GetModified") {
    ret = SambaServer::GetModified();
}

/**
 * Set modified flag
 * return boolean
 */
else if (func == "SetModified") {
    SambaServer::SetModified();
    ret = true;
}

/* Unknown function */
else {
    y2error("Unknown function: %1", func);
    ret = false;
}

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

return ret;

/* EOF */
}

ACC SHELL 2018