Author: mzugec
Date: Tue Nov 3 12:49:42 2009
New Revision: 59270
URL: http://svn.opensuse.org/viewcvs/yast?rev=59270&view=rev
Log:
export credentials for target (fate#301932)
Modified:
trunk/iscsi-server/VERSION
trunk/iscsi-server/package/yast2-iscsi-server.changes
trunk/iscsi-server/src/IscsiServerFunctions.pm
trunk/iscsi-server/src/dialogs.ycp
trunk/iscsi-server/src/helps.ycp
trunk/iscsi-server/src/widgets.ycp
Modified: trunk/iscsi-server/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/VERSION?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/VERSION (original)
+++ trunk/iscsi-server/VERSION Tue Nov 3 12:49:42 2009
@@ -1 +1 @@
-2.18.3
+2.18.4
Modified: trunk/iscsi-server/package/yast2-iscsi-server.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/package/yast2-iscsi-server.changes?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/package/yast2-iscsi-server.changes (original)
+++ trunk/iscsi-server/package/yast2-iscsi-server.changes Tue Nov 3 12:49:42 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Nov 3 12:48:42 CET 2009 - mzugec@suse.cz
+
+- export credentials for target (fate#301932)
+- 2.18.4
+
+-------------------------------------------------------------------
Thu May 21 09:19:51 CEST 2009 - mzugec@suse.cz
- handle correctly when tgt is already installed (bnc#501375)
Modified: trunk/iscsi-server/src/IscsiServerFunctions.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/src/IscsiServerFunctions.pm?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/src/IscsiServerFunctions.pm (original)
+++ trunk/iscsi-server/src/IscsiServerFunctions.pm Tue Nov 3 12:49:42 2009
@@ -5,8 +5,13 @@
package IscsiServerFunctions;
use strict;
+use YaST::YCP qw(:LOGGING);
use Data::Dumper;
use YaPI;
+use Switch;
+
+YaST::YCP::Import ("SCR");
+
our %TYPEINFO;
@@ -392,5 +397,63 @@
return \$ret;
}
+BEGIN { $TYPEINFO{SaveIntoFile} = ["function", "boolean", "string" ]; }
+sub SaveIntoFile {
+ my $self = shift;
+ my $filename = shift;
+ my $file="";
+ my $delimiter = "---------------------\n";
+
+ my $auth = $self->getConfig()->{"auth"};
+ if (defined $auth && scalar(@{$auth})>0){
+ $file = "Discovery authentication:\n" . $delimiter;
+ foreach my $row (@{$auth}){
+ $file = $file . $row->{'KEY'} . ": " . $row->{'VALUE'} . "\n";
+ }
+ $file = $file . "\n";
+ }
+
+# my $isns = $self->getConfig()->{"iSNS"};
+# if (defined $isns && $isns>0){
+# foreach my $row (@{$isns}){
+# y2internal("isns ", Dumper($row));
+# }
+# }
+
+ my %targets = %{$self->getTargets()};
+ if (scalar(keys %targets)>0){
+ $file = $file . "Targets\n" . $delimiter . "\n";
+ }
+ foreach my $target (keys %targets){
+ my $target_name = "";
+ my @auths = ();
+ my @luns = ();
+ foreach my $row (@{$targets{$target}}){
+ switch ($row->{'KEY'}) {
+ case ('Target') {
+ $target_name = $row->{'VALUE'};
+ }
+ case ('Lun') {
+ push(@luns, $row->{'VALUE'});
+ }
+ case ('IncomingUser' || 'OutgoingUser') {
+ push(@auths, $row->{'KEY'} . ": " . $row->{'VALUE'})
+ }
+ }
+ }
+ $file = $file . $target_name . "\n";
+ $file = $file . "Luns: " . join(', ', @luns) . "\n" if (scalar(@luns) > 0);
+ $file = $file . join("\n", @auths) if (scalar(@auths) > 0);
+ $file = $file . "\n";
+ }
+
+ y2milestone("Save report : \n", $file);
+
+ my $result = SCR -> Write (".target.string", $filename, $file);
+ y2milestone("Save result: ", $result);
+ return $result;
+}
+
+
1;
# EOF
Modified: trunk/iscsi-server/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/src/dialogs.ycp?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/src/dialogs.ycp (original)
+++ trunk/iscsi-server/src/dialogs.ycp Tue Nov 3 12:49:42 2009
@@ -49,6 +49,8 @@
"isns",
`VSpacing (2),
"firewall",
+ `VSpacing (2),
+ "save",
`VSpacing (2)
),
`HSpacing (1),
@@ -56,7 +58,7 @@
),
`VStretch()
),
- "widget_names" : [ "auto_start_up", "isns", "firewall" ]
+ "widget_names" : [ "auto_start_up", "isns", "firewall", "save" ]
],
// second tab - global authentication
"global":$[
@@ -102,8 +104,8 @@
"contents" :
`VBox(
`HBox(
- `TextEntry(`id(`target), _("Target"), "iqn.2001-04.com.example"),
- `TextEntry(`id(`identifier), _("Identifier"), "test")
+ `InputField(`id(`target), `opt(`hstretch), _("Target"), "iqn.2001-04.com.example"),
+ `InputField(`id(`identifier), `opt(`hstretch), _("Identifier"), "test")
),
`VBox(
`Table(`id(`lun_table),
@@ -144,7 +146,7 @@
`VSpacing(2),
`Left( `CheckBox(`id(`auth_out),`opt(`notify), _("Outgoing Authentication"), false) ),
`HBox(
- `TextEntry(`id(`user_out), _("Username")), `Password(`id(`pass_out), _("Password"))
+ `InputField(`id(`user_out), `opt(`hstretch), _("Username")), `Password(`id(`pass_out), _("Password"))
)
)
]
@@ -174,13 +176,20 @@
"services" : [ "service:iscsitarget" ],
"display_details" : true,
]),
+ "save" : $[
+ "widget" : `push_button,
+ "label" : Label::SaveButton(),
+ "handle" : saveConfiguration,
+ "opt": [],
+ "help": HELPS["save_configuration"]:""
+ ],
"isns" : $[
"widget" : `custom,
"custom_widget" :
`HBox(
`CheckBoxFrame(`id(`isns_ac), _("iSNS Access Control"), true,
`VBox(
- `TextEntry(`id(`isns_ip), _("iSNS Server"))
+ `InputField(`id(`isns_ip), `opt(`hstretch), _("iSNS Server"))
))
),
"init" : initiSNS,
Modified: trunk/iscsi-server/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/src/helps.ycp?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/src/helps.ycp (original)
+++ trunk/iscsi-server/src/helps.ycp Tue Nov 3 12:49:42 2009
@@ -38,6 +38,10 @@
</p>
"),
+ "save_configuration" : _("<p><b>Save</b> button will export some informations about
+targets into selected file.</p>"),
+
+
/* Summary dialog help 1/3 */
"summary" : _("<p><b><big>iSCSI Target Configuration</big></b><br>
Configure an iSCSI target here.<br></p>
Modified: trunk/iscsi-server/src/widgets.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/iscsi-server/src/widgets.ycp?rev=59270&r1=59269&r2=59270&view=diff
==============================================================================
--- trunk/iscsi-server/src/widgets.ycp (original)
+++ trunk/iscsi-server/src/widgets.ycp Tue Nov 3 12:49:42 2009
@@ -47,22 +47,22 @@
map