From b9cf1bb5e24a08ea47abcd977f2ea2456f8e87c0 Mon Sep 17 00:00:00 2001 From: "kenneth.skovhede@gmail.com" Date: Sun, 14 Jun 2009 15:06:17 +0000 Subject: [PATCH] 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 --- Duplicati.sln | 17 +++++++++++++++++ Duplicati/GUI/Datamodel/Backends/SSH.cs | 10 ++++++++++ .../Backends/SSH/SSHOptions.Designer.cs | 13 +++++++++++++ .../GUI/Wizard pages/Backends/SSH/SSHOptions.cs | 6 +++--- .../GUI/Wizard pages/WizardSettingsWrapper.cs | 12 +++++++++++- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Duplicati.sln b/Duplicati.sln index 830c386da..e6741eb96 100644 --- a/Duplicati.sln +++ b/Duplicati.sln @@ -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 diff --git a/Duplicati/GUI/Datamodel/Backends/SSH.cs b/Duplicati/GUI/Datamodel/Backends/SSH.cs index aee94a341..13e4f3878 100644 --- a/Duplicati/GUI/Datamodel/Backends/SSH.cs +++ b/Duplicati/GUI/Datamodel/Backends/SSH.cs @@ -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"; } } diff --git a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.Designer.cs b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.Designer.cs index 6b6278c73..c346e10c7 100644 --- a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.Designer.cs +++ b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.Designer.cs @@ -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; } } diff --git a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs index 4a8302dc2..4bcf813f8 100644 --- a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs +++ b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs @@ -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 options = new Dictionary(); 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); diff --git a/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs b/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs index 0c1613399..4bc68ed86 100644 --- a/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs +++ b/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs @@ -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("WEB:Port", m_defaultPort); } set { m_parent.SetItem("WEB:Port", value); } } - } /// @@ -807,6 +808,15 @@ namespace Duplicati.GUI.Wizard_pages get { return m_parent.GetItem("SSH:Passwordless", false); } set { m_parent.SetItem("SSH:Passwordless", value); } } + + /// + /// A value indicating if debug output will be generated + /// + public bool DebugEnabled + { + get { return m_parent.GetItem("SSH:DebugEnabled", false); } + set { m_parent.SetItem("SSH:DebugEnabled", value); } + } } ///