Author: juhliarik
Date: Tue Sep 9 10:00:17 2008
New Revision: 50836
URL: http://svn.opensuse.org/viewcvs/yast?rev=50836&view=rev
Log:
added notification via email (SMTP settings)
Modified:
trunk/kdump/config/kdump.rnc
trunk/kdump/src/Kdump.ycp
trunk/kdump/src/dialogs.ycp
trunk/kdump/src/helps.ycp
trunk/kdump/src/kdump.ycp
trunk/kdump/src/uifunctions.ycp
Modified: trunk/kdump/config/kdump.rnc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/config/kdump.rnc?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/config/kdump.rnc (original)
+++ trunk/kdump/config/kdump.rnc Tue Sep 9 10:00:17 2008
@@ -28,5 +28,10 @@
element KDUMP_DUMPDEV { text }? &
element KDUMP_VERBOSE { text }? &
element KDUMP_DUMPLEVEL { text }? &
- element KDUMP_DUMPFORMAT { text }?
+ element KDUMP_DUMPFORMAT { text }? &
+ element KDUMP_SMTP_SERVER { text }? &
+ element KDUMP_SMTP_USER { text }? &
+ element KDUMP_SMTP_PASSWORD { text }? &
+ element KDUMP_NOTIFICATION_TO { text }? &
+ element KDUMP_NOTIFICATION_CC { text }?
}
Modified: trunk/kdump/src/Kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Kdump.ycp?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Tue Sep 9 10:00:17 2008
@@ -211,6 +211,11 @@
"KDUMP_VERBOSE" : "3",
"KDUMP_DUMPLEVEL" : "0",
"KDUMP_DUMPFORMAT" : "ELF", //or "compressed"
+ "KDUMP_SMTP_SERVER" : "",
+ "KDUMP_SMTP_USER" : "",
+ "KDUMP_SMTP_PASSWORD" : "",
+ "KDUMP_NOTIFICATION_TO" : "",
+ "KDUMP_NOTIFICATION_CC" : "",
];
/**
@@ -725,9 +730,10 @@
map debug_KDUMP_SETTINGS = KDUMP_SETTINGS;
// delete KDUMP_SAVEDIR - it can include password
- debug_KDUMP_SETTINGS["KDUMP_SAVEDIR"] = "";
+ debug_KDUMP_SETTINGS["KDUMP_SAVEDIR"] = "********";
+ debug_KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"] = "********";
y2milestone("-------------KDUMP_SETTINGS-------------------");
- y2milestone("kdump configuration has been read without value \"KDUMP_SAVEDIR\": %1", debug_KDUMP_SETTINGS);
+ y2milestone("kdump configuration has been read without value \"KDUMP_SAVEDIR\" and \"KDUMP_SMTP_PASSWORD\": %1", debug_KDUMP_SETTINGS);
y2milestone("---------------------------------------------");
return true;
@@ -743,9 +749,10 @@
boolean WriteKdumpSettings () {
map debug_KDUMP_SETTINGS = KDUMP_SETTINGS;
// delete KDUMP_SAVEDIR - it can include password
- debug_KDUMP_SETTINGS["KDUMP_SAVEDIR"] = "";
+ debug_KDUMP_SETTINGS["KDUMP_SAVEDIR"] = "********";
+ debug_KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"] = "********";
y2milestone("-------------KDUMP_SETTINGS-------------------");
- y2milestone("Writing kdump configuration without value \"KDUMP_SAVEDIR\": %1", debug_KDUMP_SETTINGS);
+ y2milestone("kdump configuration has been read without value \"KDUMP_SAVEDIR\" and \"KDUMP_SMTP_PASSWORD\": %1", debug_KDUMP_SETTINGS);
y2milestone("---------------------------------------------");
foreach (string option_key, string option_val, KDUMP_SETTINGS, {
Modified: trunk/kdump/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/dialogs.ycp?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/src/dialogs.ycp (original)
+++ trunk/kdump/src/dialogs.ycp Tue Sep 9 10:00:17 2008
@@ -184,6 +184,62 @@
"help" : HelpKdump("RawPartitions"),
],
+
+/*---------============ Email Notification screen=============------------*/
+
+ "SMTPServer" : $[
+ //TRANSLATORS: TextEntry Label
+ "label" : _("SMTP Server"),
+ "widget" : `textentry,
+ "init" : InitSMTPServer,
+ //"handle" :
+ "store" : StoreSMTPServer,
+ "help" : HelpKdump("SMTPServer"),
+ ],
+
+
+ "SMTPUser" : $[
+ //TRANSLATORS: TextEntry Label
+ "label" : _("User Name"),
+ "widget" : `textentry,
+ "init" : InitSMTPUser,
+ //"handle" :
+ "store" : StoreSMTPUser,
+ "help" : HelpKdump("SMTPUser"),
+ ],
+
+ "SMTPPassword" : $[
+ //TRANSLATORS: TextEntry Label
+ "label" : _("Password"),
+ "widget" : `password,
+ "init" : InitSMTPPassword,
+ //"handle" :
+ "store" : StoreSMTPPassword,
+ "help" : HelpKdump("SMTPPassword"),
+ ],
+
+ "NotificationTo" : $[
+ //TRANSLATORS: TextEntry Label
+ "label" : _("Notification To"),
+ "widget" : `textentry,
+ "init" : InitNotificationTo,
+ "validate_type" : `function,
+ "validate_function": ValidEmail,
+ "store" : StoreNotificationTo,
+ "help" : HelpKdump("NotificationTo"),
+ ],
+
+ "NotificationCC" : $[
+ //TRANSLATORS: TextEntry Label
+ "label" : _("Notification CC"),
+ "widget" : `textentry,
+ "init" : InitNotificationCC,
+ "validate_type" : `function,
+ "validate_function": ValidEmail,
+ "store" : StoreNotificationCC,
+ "help" : HelpKdump("NotificationCC"),
+ ],
+
/*---------============ Expert Settings screen=============------------*/
"InitrdKernel" : $[
@@ -308,10 +364,10 @@
"dump_target" : $[
- "contents" : `VBox(
+ "contents" : `VBox(
"TargetKdump",
`VSpacing(1),
- "RawPartitions",
+ "RawPartitions",
`VStretch ()
),
"caption" : _("Dump Target"),
@@ -321,6 +377,33 @@
]
],
+
+ "email_notification" : $[
+ "contents" : `VBox(
+ `Frame ( _("SMTP Server"),`HBox(`HSpacing(1),`VBox(
+ `Left("SMTPServer"),
+ `HBox(
+ "SMTPUser",
+ `HSpacing(1),
+ "SMTPPassword",
+ `HStretch ()
+ )
+ ))),
+
+ `Frame ( _("Notification Email addresses"),`HBox(`HSpacing(1),`VBox(
+ `Left("NotificationTo"),
+ `Left("NotificationCC")
+ ))),
+
+ `VStretch ()
+ ),
+ "caption" : _("Email Notification"),
+ "tree_item_label" : _("Email Notification"),
+ "widget_names" : [
+ "DisBackButton", "SMTPServer", "SMTPUser", "SMTPPassword", "NotificationTo", "NotificationCC"
+ ]
+ ],
+
"exp_settings" : $[
"contents" : `VBox(
`Frame ( _("Custom Kernel for Kdump"),`HBox(`HSpacing(1),`VBox(
@@ -360,14 +443,14 @@
"DisBackButton", "KdumpCommandLine",
"KdumpCommandLineAppend", "RunLevel",
"EnableDeleteImages", "NumberDumps",
- "InitrdKernel", "SelectKernel", "EnableReboot"
+ "InitrdKernel", "SelectKernel", "EnableReboot", "email_notification",
]
],
];
symbol RunKdumpDialogs() {
- list<string> sim_dialogs = [ "start_up", "dump_filtering", "dump_target" ,"exp_settings"];
+ list<string> sim_dialogs = [ "start_up", "dump_filtering", "dump_target", "email_notification", "exp_settings"];
return DialogTree::ShowAndRun ($[
//return CWMTab::CreateWidget($[
Modified: trunk/kdump/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/helps.ycp?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/src/helps.ycp (original)
+++ trunk/kdump/src/helps.ycp Tue Sep 9 10:00:17 2008
@@ -136,6 +136,20 @@
"NumberDumps" : _("<p><b>Number of Old Dumps</b> -
Specifies how many old dumps are kept.<br></p>"),
+ /* SMTP Server*/
+ "SMTPServer" : _("<p><b>SMTP Server</b>...</p>"),
+
+ /*SMTP User Name */
+ "SMTPUser" : _("<p><b>User Name</b>...</p>"),
+
+ /*SMTP Password */
+ "SMTPPassword": _("<p><b>Password</b>...</p>"),
+
+ /* Notification To (email addresses) */
+ "NotificationTo": _("<p><b>Notification To</b>...</p>"),
+
+ /* Notification CC (email addresses) */
+ "NotificationCC": _("<p><b>Notification CC</b>...</p>"),
/* Read dialog help 1/2 */
"read" : _("<p><b><big>Initializing Kdump Configuration</big></b><br>
Modified: trunk/kdump/src/kdump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/kdump.ycp?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/src/kdump.ycp (original)
+++ trunk/kdump/src/kdump.ycp Tue Sep 9 10:00:17 2008
@@ -210,6 +210,37 @@
//TRANSLATORS: CommandLine printed text
CommandLine::Print(sformat(_("Numbers of old dumps: %1"),Kdump::KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"]:nil));
}
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_SMTP_SERVER"]:"" != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump SMTP Server: %1"), Kdump::KDUMP_SETTINGS["KDUMP_SMTP_SERVER"]:nil));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_SMTP_USER"]:"" != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump SMTP User: %1"), Kdump::KDUMP_SETTINGS["KDUMP_SMTP_USER"]:nil));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"]:"" != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(_("Kdump SMTP Password: ********"));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_TO"]:"" != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump Sending Notification To: %1"), Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_TO"]:""));
+ }
+
+ if (Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_CC"]:"" != "") {
+ CommandLine::Print("");
+ //TRANSLATORS: CommandLine printed text
+ CommandLine::Print(sformat(_("Kdump Sending Copy of Notification To: %1"), Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_CC"]:""));
+ }
+
CommandLine::Print("");
@@ -555,7 +586,7 @@
return false;
}
- } else {
+ } else {
// TRANSLATORS: CommandLine error message
CommandLine::Error(_("Wrong options were used."));
return false;
@@ -576,7 +607,7 @@
return false;
}
- } else {
+ } else {
// TRANSLATORS: CommandLine error message
CommandLine::Error(_("Wrong options were used."));
return false;
@@ -584,6 +615,105 @@
}
+boolean cmdKdumpSMTPServer (map options)
+{
+ if (options["server"]:nil!=nil) {
+ string server = tostring(options["server"]:nil);
+
+ if ((server != "") && (server != nil)){
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_SERVER"]= server;
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"server\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options were used."));
+ return false;
+ }
+}
+
+boolean cmdKdumpSMTPUser (map options)
+{
+ if (options["user"]:nil!=nil) {
+ string user = tostring(options["user"]:nil);
+
+ if ((user != "") && (user != nil)){
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_USER"]= user;
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"user\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options were used."));
+ return false;
+ }
+}
+
+
+boolean cmdKdumpSMTPPass (map options)
+{
+ if (options["pass"]:nil!=nil) {
+ string password = cmdParsePassPath(tostring(options["pass"]:nil));
+ if ((password == nil) || (password == ""))
+ return false;
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"] = password;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options were used."));
+ return false;
+ }
+}
+
+
+boolean cmdKdumpSMTPNotifTo (map options)
+{
+ if (options["email"]:nil!=nil) {
+ string email = tostring(options["email"]:nil);
+
+ if ((email != "") && (email != nil)){
+ Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_TO"]= email;
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"email\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options were used."));
+ return false;
+ }
+}
+
+boolean cmdKdumpSMTPNotifCC (map options)
+{
+ if (options["email"]:nil!=nil) {
+ string email = tostring(options["email"]:nil);
+
+ if ((email != "") && (email != nil)){
+ Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_CC"]= email;
+ return true;
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong value of options \"email\"."));
+ return false;
+ }
+
+ } else {
+ // TRANSLATORS: CommandLine error message
+ CommandLine::Error(_("Wrong options were used."));
+ return false;
+ }
+}
map cmdline_description = $[
"id" : "kdump",
@@ -710,6 +840,54 @@
],
],
+ "smtpserver": $[
+ "handler" : cmdKdumpSMTPServer,
+ // TRANSLATORS: CommandLine help
+ "help" : _("SMTP Server for sending notification messages."),
+ "example" : [
+ "smtpserver server=smtp.server.com",
+ ],
+ ],
+
+ "smtpuser": $[
+ "handler" : cmdKdumpSMTPUser,
+ // TRANSLATORS: CommandLine help
+ "help" : _("SMTP Username for sending notification messages."),
+ "example" : [
+ "smtpuser user=foo_user",
+ ],
+ ],
+
+ "smtppass": $[
+ "handler" : cmdKdumpSMTPPass,
+ // TRANSLATORS: CommandLine help
+ "help" : _("SMTP Password for sending notification messages. Path of file which includes password (plain text file)"),
+ "example" : [
+ "smtppass pass=/path/to/file",
+ ],
+ ],
+
+ "notificationto": $[
+ "handler" : cmdKdumpSMTPNotifTo,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Email address for sending notification messages"),
+ "example" : [
+ "notificationto email=foo@bar.com",
+ "notificationto email=\"foo1@bar.com foo2@bar.com\"",
+ ],
+ ],
+
+ "notificationcc": $[
+ "handler" : cmdKdumpSMTPNotifCC,
+ // TRANSLATORS: CommandLine help
+ "help" : _("Email address for sending copy of notification messages"),
+ "example" : [
+ "notificationcc email=foo@bar.com",
+ "notificationcc email=\"foo1@bar.com foo2@bar.com\"",
+ ],
+ ],
+
+
],
"options" : $[
"enable": $[
@@ -812,6 +990,13 @@
// TRANSLATORS: CommandLine help
"help" : _("Number of dumps. 0 means keep all."),
],
+
+ "email": $[
+ "type" : "string",
+ // TRANSLATORS: CommandLine help
+ "help" : _("Email address"),
+ ],
+
],
"mappings" : $[
@@ -862,6 +1047,27 @@
"no",
],
+ "smtpserver": [
+ "server",
+ ],
+
+ "smtpuser": [
+ "user",
+ ],
+
+ "smtppass": [
+ "pass",
+ ],
+
+ "notificationto": [
+ "email",
+ ],
+
+ "notificationcc": [
+ "email",
+ ],
+
+
]
];
Modified: trunk/kdump/src/uifunctions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/uifunctions.ycp?rev=50836&r1=50835&r2=50836&view=diff
==============================================================================
--- trunk/kdump/src/uifunctions.ycp (original)
+++ trunk/kdump/src/uifunctions.ycp Tue Sep 9 10:00:17 2008
@@ -271,7 +271,7 @@
}
map debug_KDUMP_SAVE_TARGET = KDUMP_SAVE_TARGET;
- if (debug_KDUMP_SAVE_TARGET["password"]:nil != "")
+ if (debug_KDUMP_SAVE_TARGET["password"]:"" != "")
debug_KDUMP_SAVE_TARGET["password"] = "**********";
y2milestone("--------------KDUMP_SAVE_TARGET---------------");
@@ -1394,7 +1394,100 @@
if (!value) {
Kdump::KDUMP_SETTINGS["KDUMP_KEEP_OLD_DUMPS"] = "0";
}
+}
+
+
+/**
+ * Function initializes option
+ * "SMTP Server"
+ */
+void InitSMTPServer (string key) {
+ UI::ChangeWidget(`id("SMTPServer"), `Value, Kdump::KDUMP_SETTINGS["KDUMP_SMTP_SERVER"]:"");
+}
+
+/**
+ * Function stores option
+ * "SMTP Server"
+ */
+void StoreSMTPServer (string key, map event) {
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_SERVER"] = tostring(UI::QueryWidget(`id("SMTPServer"), `Value));
+}
+
+/**
+ * Function initializes option
+ * "User Name" (SMTP Settings)
+ */
+void InitSMTPUser (string key) {
+ UI::ChangeWidget(`id("SMTPUser"), `Value, Kdump::KDUMP_SETTINGS["KDUMP_SMTP_USER"]:"");
+}
+
+/**
+ * Function stores option
+ * "User Name" (SMTP Settings)
+ */
+void StoreSMTPUser (string key, map event) {
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_USER"] = tostring(UI::QueryWidget(`id("SMTPUser"), `Value));
+}
+
+/**
+ * Function initializes option
+ * "Password" (SMTP Settings)
+ */
+void InitSMTPPassword (string key) {
+ UI::ChangeWidget(`id("SMTPPassword"), `Value, Kdump::KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"]:"");
+}
+
+/**
+ * Function stores option
+ * "Password" (SMTP Settings)
+ */
+void StoreSMTPPassword (string key, map event) {
+ Kdump::KDUMP_SETTINGS["KDUMP_SMTP_PASSWORD"] = tostring(UI::QueryWidget(`id("SMTPPassword"), `Value));
+}
+
+/**
+ * Function initializes option
+ * "Notification To"
+ */
+void InitNotificationTo (string key) {
+ UI::ChangeWidget(`id("NotificationTo"), `Value, Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_TO"]:"");
+}
+
+/**
+ * Function stores option
+ * "Notification To"
+ */
+void StoreNotificationTo (string key, map event) {
+ Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_TO"] = tostring(UI::QueryWidget(`id("NotificationTo"), `Value));
+}
+
+/**
+ * Function initializes option
+ * "Notification CC"
+ */
+void InitNotificationCC (string key) {
+ UI::ChangeWidget(`id("NotificationCC"), `Value, Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_CC"]:"");
+}
+
+/**
+ * Function stores option
+ * "Notification CC"
+ */
+void StoreNotificationCC (string key, map event) {
+ Kdump::KDUMP_SETTINGS["KDUMP_NOTIFICATION_CC"] = tostring(UI::QueryWidget(`id("NotificationCC"), `Value));
+}
+
+
+/**
+ * Function validates options in
+ * "Dump Format"
+ * install makedumpfile if KDUMP_DUMPFORMAT == "compressed"
+ */
+
+boolean ValidEmail (string key, map event) {
+ Popup::Message(key);
+ return true;
}
/* EOF */
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org