Fix: Agent-Rollout downloadete immer globale AGENT_VERSION statt Gruppen-Ziel (v2.5.0)

- downloadSetup() nutzte process.env.AGENT_VERSION statt der Patch-Gruppen-
  Zielversion → Staged Rollout (Test/Pilot/Produktion) hatte nie funktioniert,
  jeder Agent bekam beim Auto-Update immer dieselbe globale Version
- Fix: downloadSetup() löst jetzt per ?hostname=X die Gruppen-Zielversion auf,
  exakt wie checkin() es bereits tat
- ApiService.DownloadSetupAsync() schickt jetzt den Hostnamen mit
- Version: 2.4.0 → 2.5.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 09:35:01 +02:00
parent 7449b64398
commit e2521f405d
7 changed files with 28 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ namespace ITNexusAgent;
public class AgentWorker
{
private const string Version = "2.4.0";
private const string Version = "2.5.0";
private const string DataDir = @"C:\ProgramData\IT Nexus Agent";
private const string ConfigPath = @"C:\ProgramData\IT Nexus Agent\config.json";
private const string StatusPath = @"C:\ProgramData\IT Nexus Agent\status.json";

View File

@@ -7,8 +7,8 @@
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>IT-Nexus-Agent</AssemblyName>
<RootNamespace>ITNexusAgent</RootNamespace>
<Version>2.3.0</Version>
<AssemblyVersion>2.3.0.0</AssemblyVersion>
<Version>2.5.0</Version>
<AssemblyVersion>2.5.0.0</AssemblyVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>

View File

@@ -65,9 +65,9 @@ public class ApiService(string serverUrl, string agentKey)
return await resp.Content.ReadAsByteArrayAsync();
}
public async Task<byte[]> DownloadSetupAsync()
public async Task<byte[]> DownloadSetupAsync(string hostname)
{
var req = BuildRequest(HttpMethod.Get, "/api/monitoring/agent-setup");
var req = BuildRequest(HttpMethod.Get, $"/api/monitoring/agent-setup?hostname={Uri.EscapeDataString(hostname)}");
var resp = await _http.SendAsync(req);
resp.EnsureSuccessStatusCode();
return await resp.Content.ReadAsByteArrayAsync();

View File

@@ -125,7 +125,7 @@ public class CommandExecutor(ApiService api, string hostname, string dataDir, st
private async Task<string> UpdateAgent()
{
var bytes = await _api.DownloadSetupAsync();
var bytes = await _api.DownloadSetupAsync(_hostname);
if (bytes.Length < 512 * 1024) return "Download fehlgeschlagen - Installer zu klein";
var setupPath = Path.Combine(_dataDir, "IT-Nexus-Agent-Setup-Update.exe");

View File

@@ -1,5 +1,5 @@
#define MyAppName "IT Nexus Agent"
#define MyAppVersion "2.4.0"
#define MyAppVersion "2.5.0"
#define MyAppPublisher "Cereda Systems GmbH"
#define MyAppURL "https://it-nexus.cereda-systems.de"
#define MyAppExeName "IT-Nexus-Agent.exe"