X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=agent%2Fwindows-setup-agent%2FSetupWizard.cs;h=018b2ababd02e3050d748a43ddf3cc341f2716b6;hb=051b3ba9b7e465e0dc29231792be89a37a27c3e3;hp=3b3b32b03ff6ca4c2d64c3ef61d4fd21bd7f36a8;hpb=f3cc265135407973f216b51b8870edc9ff7d9be7;p=icinga2 diff --git a/agent/windows-setup-agent/SetupWizard.cs b/agent/windows-setup-agent/SetupWizard.cs index 3b3b32b03..018b2abab 100644 --- a/agent/windows-setup-agent/SetupWizard.cs +++ b/agent/windows-setup-agent/SetupWizard.cs @@ -54,8 +54,8 @@ namespace Icinga { foreach (ListViewItem lvi in lvwEndpoints.Items) { if (lvi.SubItems.Count > 1) { - host = lvi.SubItems[1].Text; - port = lvi.SubItems[2].Text; + host = lvi.SubItems[1].Text.Trim(); + port = lvi.SubItems[2].Text.Trim(); return true; } } @@ -176,9 +176,12 @@ namespace Icinga } SetRetrievalStatus(100); - - X509Certificate2 cert = new X509Certificate2(_TrustedFile); - Invoke((MethodInvoker)delegate { ShowCertificatePrompt(cert); }); + try { + X509Certificate2 cert = new X509Certificate2(_TrustedFile); + Invoke((MethodInvoker)delegate { ShowCertificatePrompt(cert); }); + } catch (Exception e) { + ShowErrorText("Failed to receive certificate: " + e.Message); + } } private void ConfigureService() @@ -194,16 +197,13 @@ namespace Icinga string master_host, master_port; GetMasterHostPort(out master_host, out master_port); - args += " --master_host " + master_host.Trim() - + "," + master_port.Trim(); + args += " --master_host " + master_host + "," + master_port; foreach (ListViewItem lvi in lvwEndpoints.Items) { args += " --endpoint " + lvi.SubItems[0].Text.Trim(); - if (lvi.SubItems.Count > 1) { - args += "," + lvi.SubItems[1].Text.Trim() - + "," + lvi.SubItems[2].Text.Trim(); - } + if (lvi.SubItems.Count > 1) + args += "," + lvi.SubItems[1].Text.Trim() + "," + lvi.SubItems[2].Text.Trim(); } }); @@ -225,6 +225,13 @@ namespace Icinga args += " --cn \"" + txtInstanceName.Text.Trim() + "\""; args += " --zone \"" + txtInstanceName.Text.Trim() + "\""; + foreach (ListViewItem lvi in lvwGlobalZones.Items) { + args += " --global_zones " + lvi.SubItems[0].Text.Trim(); + } + + if (chkDisableConf.Checked) + args += " --disable-confd"; + if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "node setup" + args, out output)) { @@ -519,6 +526,62 @@ namespace Icinga lvwEndpoints.Items.Add(lvi2); } + + private void btnAddGlobalZone_Click(object sender, EventArgs e) + { + GlobalZonesInputBox gzib = new GlobalZonesInputBox(lvwGlobalZones.Items); + + if (gzib.ShowDialog(this) == DialogResult.Cancel) + return; + + ListViewItem lvi = new ListViewItem(); + lvi.Text = gzib.txtGlobalZoneName.Text; + + lvwGlobalZones.Items.Add(lvi); + } + + private void btnRemoveGlobalZone_Click(object sender, EventArgs e) + { + while (lvwGlobalZones.SelectedItems.Count > 0) { + lvwGlobalZones.Items.Remove(lvwGlobalZones.SelectedItems[0]); + } + } + + private void lvwGlobalZones_SelectedIndexChanged(object sender, EventArgs e) + { + btnEditGlobalZone.Enabled = lvwGlobalZones.SelectedItems.Count > 0; + btnRemoveGlobalZone.Enabled = lvwGlobalZones.SelectedItems.Count > 0; + } + + private void btnEditGlobalZone_Click(object sender, EventArgs e) + { + ListViewItem lvi = lvwGlobalZones.SelectedItems[0]; + GlobalZonesInputBox gzib = new GlobalZonesInputBox(lvwGlobalZones.Items); + + gzib.Text = "Edit Global Zone"; + gzib.txtGlobalZoneName.Text = lvi.SubItems[0].Text; + + if (gzib.ShowDialog(this) == DialogResult.Cancel) + return; + + lvwGlobalZones.Items.Remove(lvi); + + ListViewItem lvi2 = new ListViewItem(); + lvi2.Text = gzib.txtGlobalZoneName.Text; + + lvwGlobalZones.Items.Add(lvi2); + } + + private void checkBox1_CheckedChanged(object sender, EventArgs e) + { + + } + + private void SetupWizard_Load(object sender, EventArgs e) + { + this.MinimumSize = this.Size; + this.MaximumSize = this.Size; + } } }