Author: lslezak Date: Thu Apr 10 11:20:23 2008 New Revision: 46326 URL: http://svn.opensuse.org/viewcvs/yast?rev=46326&view=rev Log: - implemented command line mode support (fate#120045) Modified: trunk/heartbeat/package/yast2-heartbeat.changes trunk/heartbeat/src/commandline.ycp trunk/heartbeat/src/heartbeat.ycp Modified: trunk/heartbeat/package/yast2-heartbeat.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/heartbeat/package/yast2-heartbeat... ============================================================================== --- trunk/heartbeat/package/yast2-heartbeat.changes (original) +++ trunk/heartbeat/package/yast2-heartbeat.changes Thu Apr 10 11:20:23 2008 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Apr 10 11:19:44 CEST 2008 - lslezak@suse.cz + +- implemented command line mode support (fate#120045) + +------------------------------------------------------------------- Mon Mar 17 12:43:32 CET 2008 - jsrain@suse.cz - added 'StartupNotify=true' to the desktop file (bnc #304964) Modified: trunk/heartbeat/src/commandline.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/heartbeat/src/commandline.ycp?rev... ============================================================================== --- trunk/heartbeat/src/commandline.ycp (original) +++ trunk/heartbeat/src/commandline.ycp Thu Apr 10 11:20:23 2008 @@ -289,6 +289,111 @@ return false; } + boolean ListAuth() + { + string method = Heartbeat::authkeys["method"]:""; + string password = Heartbeat::authkeys["password"]:""; + + CommandLine::Print(sformat(_("Authentication method: %1"), method)); + + if (method == "sha1" || method == "md5") + { + CommandLine::Print(sformat(_("Authentication key: %1"), password)); + } + + return false; + } + + boolean SetAuth(string method, string key) + { + if (!contains(["crc", "md5", "sha1"], method)) + { + // invalid method + return false; + } + + string curr_method = Heartbeat::authkeys["method"]:""; + string curr_key = Heartbeat::authkeys["password"]:""; + + if (method != curr_method || key != curr_key) + { + Heartbeat::authkeys["method"] = method; + + if (method == "sha1" || method == "md5") + { + Heartbeat::authkeys["password"] = key; + } + else + { + Heartbeat::authkeys["password"] = ""; + } + + Heartbeat::config["modified"] = true; + + return true; + } + + return false; + } + + boolean AuthHandler(map params) + { + if (haskey(params, "list")) + { + return ListAuth(); + } + + if (haskey(params, "set")) + { + string method = params["method"]:""; + string key = params["key"]:""; + + return SetAuth(method, key); + } + + return false; + } + + boolean StartStatus() + { + // %1 is "enabled" or "disabled" + CommandLine::Print(sformat(_("Start Heartbeat service at boot: %1"), + // Automatic start at boot is either "enableb" or "disabled" + Heartbeat::start_daemon ? _("enabled") : _("disabled"))); + return false; + } + + boolean EnableAutoStart(boolean start) + { + if (start != Heartbeat::start_daemon) + { + Heartbeat::start_daemon_modified = true; + Heartbeat::start_daemon = start; + + return true; + } + + return false; + } + + boolean StartHandler(map params) + { + if (haskey(params, "status")) + { + return StartStatus(); + } + else if (haskey(params, "enable")) + { + return EnableAutoStart(true); + } + else if (haskey(params, "disable")) + { + return EnableAutoStart(false); + } + + return false; + } + boolean DoNotAbort() { return false; Modified: trunk/heartbeat/src/heartbeat.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/heartbeat/src/heartbeat.ycp?rev=4... ============================================================================== --- trunk/heartbeat/src/heartbeat.ycp (original) +++ trunk/heartbeat/src/heartbeat.ycp Thu Apr 10 11:20:23 2008 @@ -21,18 +21,16 @@ y2milestone ("----------------------------------------"); y2milestone ("Heartbeat module started"); -import "Progress"; +import "CommandLine"; import "Report"; -import "Summary"; -import "CommandLine"; include "heartbeat/wizards.ycp"; include "heartbeat/commandline.ycp"; map cmdline_description = $[ "id" : "heartbeat", - /* Command line help text for the Xheartbeat module */ - "help" : _("Configuration of Heartbeat"), + /* Command line help text for the Heartbeat module */ + "help" : _("Configuration of high availability (HA) cluster using Heartbeat service."), "guihandler" : HeartbeatSequence, "initialize" : ReadHandler, "finish" : Heartbeat::Write, @@ -41,82 +39,101 @@ "node" : $[ "handler" : NodeHandler, // translators: command line help text for add action - "help" : _("List configured parameters."), - // options - "options" : [ "non_strict" ], - // help text for unknownd parameters - "non_strict_help" : _("Value of the specific module parameter."), + "help" : _("Configure list of the servers for the cluster"), ], "medium" : $[ "handler" : MediumHandler, // translators: command line help text for add action - "help" : _("List configured parameters."), - // options - "options" : [ "non_strict" ], - // help text for unknownd parameters - "non_strict_help" : _("Value of the specific module parameter."), + "help" : _("Set the communication between the nodes of the cluster."), + ], + "authentication" : $[ + "handler" : AuthHandler, + // translators: command line help text for add action + "help" : _("Configure authentication of the nodes."), + ], + "start" : $[ + "handler" : StartHandler, + // translators: command line help text for add action + "help" : _("Configure automatic start of the service at boot."), ], ], // descriptions of options "options" : $[ "add" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Add a new item to the list."), ], "delete" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Delete an item from the list."), ], "list" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Display the configuration."), ], "name" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Name of the node in the cluster."), "type" : "string" ], "type" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Communication mode, can be 'bcast' for broadcast or 'mcast' for multicat."), "type" : "string" ], "device" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Network device (e.g. eth0) used for communication."), "type" : "string" ], "address" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("IP address of the multicats group (224.0.0.0 - 239.255.255.255)."), "type" : "string" ], "ttl" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("TTL value (1-255, default is 2)."), "type" : "integer" ], "udp" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("UDP port number (default is 694)."), "type" : "integer" ], "method" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("Authentication method, can be 'crc' (no security), 'sha1' or 'md5'."), "type" : "string" ], "key" : $[ // translators: command line help text for the 'play' option - "help" : _("List all configured nodes (including this node)."), + "help" : _("The authentication key."), "type" : "string" ], + "enable" : $[ + // translators: command line help text for the 'play' option + "help" : _("Enable automatic start of the service at boot."), + ], + "disable" : $[ + // translators: command line help text for the 'play' option + "help" : _("Disable automatic start of the service at boot."), + ], + "set" : $[ + // translators: command line help text for the 'play' option + "help" : _("Set the configuration."), + ], + "status" : $[ + // translators: command line help text for the 'play' option + "help" : _("Print status of the automatic start at boot."), + ], ], // map options to commands - "mapping" : $[ + "mappings" : $[ "node" : ["add", "delete", "list", "name"], "medium" : ["add", "delete", "list", "type", "device", "address", "ttl", "set", "udp"], "authentication" : ["set", "list", "method", "key"], + "start" : [ "status", "enable", "disable"], ] ]; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org