Option to enabled debug for the SSH backend, required to diagnose issue #59.

git-svn-id: https://duplicati.googlecode.com/svn/trunk@195 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2009-06-14 15:06:17 +00:00
parent 3e3a6c2550
commit b9cf1bb5e2
5 changed files with 54 additions and 4 deletions
+17
View File
@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreshKeeper", "FreshKeeper\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Datamodel", "Duplicati\GUI\Datamodel\Datamodel.csproj", "{B60D0993-B0C5-457A-90D9-DB6EEB33CE47}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WizardForm", "WizardForm\WizardForm.csproj", "{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}"
EndProject
Global
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
@@ -358,6 +360,21 @@ Global
{B60D0993-B0C5-457A-90D9-DB6EEB33CE47}.Test|Mixed Platforms.ActiveCfg = Release|Any CPU
{B60D0993-B0C5-457A-90D9-DB6EEB33CE47}.Test|Mixed Platforms.Build.0 = Release|Any CPU
{B60D0993-B0C5-457A-90D9-DB6EEB33CE47}.Test|x86.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Debug|x86.ActiveCfg = Debug|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Release|Any CPU.Build.0 = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Release|x86.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Test|Any CPU.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Test|Any CPU.Build.0 = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Test|Mixed Platforms.ActiveCfg = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Test|Mixed Platforms.Build.0 = Release|Any CPU
{F2854848-BF78-4A6D-9A2A-2AE2AFB70DF1}.Test|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+10
View File
@@ -32,6 +32,7 @@ namespace Duplicati.Datamodel.Backends
private const string FOLDER = "Folder";
private const string PASWORDLESS = "Passwordless";
private const string PORT = "Port";
private const string DEBUG_ENABLED = "Debug enabled";
private Task m_owner;
@@ -83,6 +84,12 @@ namespace Duplicati.Datamodel.Backends
set { m_owner.BackendSettingsLookup[PASWORDLESS] = value.ToString(); }
}
public bool DebugEnabled
{
get { return Duplicati.Library.Core.Utility.ParseBool(m_owner.BackendSettingsLookup[DEBUG_ENABLED], false); }
set { m_owner.BackendSettingsLookup[DEBUG_ENABLED] = value.ToString(); }
}
#region IBackend Members
@@ -103,6 +110,9 @@ namespace Duplicati.Datamodel.Backends
options["ssh-options"] += "-P " + this.Port;
options["sftp-command"] = new ApplicationSettings(m_owner.DataParent).SFtpPath;
if (this.DebugEnabled)
options["debug-to-console"] = "";
}
public string FriendlyName { get { return "SSH host"; } }
@@ -39,6 +39,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.UsePassword = new System.Windows.Forms.CheckBox();
this.GenerateDebugOutput = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.Port)).BeginInit();
this.SuspendLayout();
//
@@ -157,10 +158,21 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
this.UsePassword.UseVisualStyleBackColor = true;
this.UsePassword.CheckedChanged += new System.EventHandler(this.UsePassword_CheckedChanged);
//
// GenerateDebugOutput
//
this.GenerateDebugOutput.AutoSize = true;
this.GenerateDebugOutput.Location = new System.Drawing.Point(20, 144);
this.GenerateDebugOutput.Name = "GenerateDebugOutput";
this.GenerateDebugOutput.Size = new System.Drawing.Size(136, 17);
this.GenerateDebugOutput.TabIndex = 23;
this.GenerateDebugOutput.Text = "Generate debug output";
this.GenerateDebugOutput.UseVisualStyleBackColor = true;
//
// SSHOptions
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.GenerateDebugOutput);
this.Controls.Add(this.UsePassword);
this.Controls.Add(this.TestConnection);
this.Controls.Add(this.Port);
@@ -193,5 +205,6 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox UsePassword;
private System.Windows.Forms.CheckBox GenerateDebugOutput;
}
}
@@ -79,6 +79,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
m_wrapper.Server = Servername.Text;
m_wrapper.Path = Path.Text;
m_wrapper.Username = Username.Text;
m_wrapper.DebugEnabled = GenerateDebugOutput.Checked;
if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup)
args.NextPage = new Add_backup.GeneratedFilenameOptions();
@@ -98,6 +99,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
UsePassword.Checked = !m_wrapper.Passwordless;
Password.Text = m_wrapper.Password;
Port.Value = m_wrapper.Port;
GenerateDebugOutput.Checked = m_wrapper.DebugEnabled;
}
if (m_settings.ContainsKey("SSH:HasTested"))
@@ -135,15 +137,13 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
ssh.Passwordless = !UsePassword.Checked;
ssh.Port = (int)Port.Value;
ssh.Username = Username.Text;
ssh.DebugEnabled = true;
string target = ssh.GetDestinationPath();
Dictionary<string, string> options = new Dictionary<string, string>();
ssh.GetOptions(options);
//Make sure that "testing" always produce a log
options.Add("debug-to-console", "");
string[] files = Duplicati.Library.Main.Interface.List(target, options);
MessageBox.Show(this, "Connection succeeded!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -152,6 +152,7 @@ namespace Duplicati.GUI.Wizard_pages
this.SSHSettings.Server = ssh.Host;
this.SSHSettings.Port = ssh.Port;
this.SSHSettings.Passwordless = ssh.Passwordless;
this.SSHSettings.DebugEnabled = ssh.DebugEnabled;
this.Backend = BackendType.SSH;
break;
case "s3":
@@ -247,6 +248,7 @@ namespace Duplicati.GUI.Wizard_pages
ssh.Host = this.SSHSettings.Server;
ssh.Port = this.SSHSettings.Port;
ssh.Passwordless = this.SSHSettings.Passwordless;
ssh.DebugEnabled = this.SSHSettings.DebugEnabled;
ssh.SetService();
break;
case BackendType.S3:
@@ -764,7 +766,6 @@ namespace Duplicati.GUI.Wizard_pages
get { return m_parent.GetItem<int>("WEB:Port", m_defaultPort); }
set { m_parent.SetItem("WEB:Port", value); }
}
}
/// <summary>
@@ -807,6 +808,15 @@ namespace Duplicati.GUI.Wizard_pages
get { return m_parent.GetItem<bool>("SSH:Passwordless", false); }
set { m_parent.SetItem("SSH:Passwordless", value); }
}
/// <summary>
/// A value indicating if debug output will be generated
/// </summary>
public bool DebugEnabled
{
get { return m_parent.GetItem<bool>("SSH:DebugEnabled", false); }
set { m_parent.SetItem("SSH:DebugEnabled", value); }
}
}
/// <summary>