Skip to content

Commit

Permalink
- Updates program and args in launch.json for cv4pve-diag.dll file
Browse files Browse the repository at this point in the history
- Updates cv4pve-diag tool with new diagnostic features and usage instructions, as well as a new website link
- Refactors code by updating Subscription Status check to use ToLower() method and retrieving ExtensionData values using a LINQ query
- Updates Corsinvest package version to 1.5.8 and adds GenerateDocumentationFile property to csproj file
- Updates package references and target framework in project file to make it compatible with new changes
- Refactors code by adding new options and replacing existing ones, and updates file writing and console output for improved readability and maintainability.
  • Loading branch information
franklupo committed May 5, 2023
1 parent 41751d9 commit 17aae0d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Diagnostic/bin/Debug/net6.0/cv4pve-diag.dll",
"args": [],
"program": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Diagnostic/bin/Debug/net7.0/cv4pve-diag.dll",
"args": ["@Parm1.Parm"],
"cwd": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Diagnostic",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
[![License](https://img.shields.io/github/license/Corsinvest/cv4pve-diag.svg)](LICENSE.md)

```text
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/
Diagnostic for Proxmox VE (Made in Italy)
Usage: cv4pve-diag [options]
Diagnostic for Proxmox VE (Made in Italy)
cv4pve-diag is a part of suite cv4pve.
For more information visit https://www.corsinvest.it/cv4pve
Usage:
cv4pve-diag [command] [options]
Options:
--api-token <api-token> Api token format 'USER@REALM!TOKENID=UUID'. Require Proxmox VE 6.2 or later
Expand All @@ -26,17 +31,10 @@ Options:
-?, -h, --help Show help and usage information
Commands:
app-check-update Check update application
app-upgrade Upgrade application
create-settings Create file settings (settings.json)
create-ignored-issues Create File ignored issues (ignored-issues.json)
export-collect Export collect data collect to data.json
execute Execute diagnostic and print result to console
Run 'cv4pve-diag [command] --help' for more information about a command.
cv4pve-diag is a part of suite cv4pve-tools.
For more information visit https://www.cv4pve-tools.com
```

## Copyright and License
Expand All @@ -46,7 +44,7 @@ For licensing details please visit [LICENSE.md](LICENSE.md)

## Commercial Support

This software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the [site](https://www.cv4pve-tools.com)
This software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the [site](https://www.corsinvest.it/cv4pve)

## Tutorial

Expand Down
4 changes: 2 additions & 2 deletions src/Corsinvest.ProxmoxVE.Diagnostic.Api/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static void CheckNode(InfoHelper.Info info,
#endregion

#region Subscription
if (node.Subscription.Status != "Active")
if (node.Subscription.Status.ToLower() != "active")
{
result.Add(new DiagnosticResult
{
Expand Down Expand Up @@ -793,7 +793,7 @@ private static void CheckQemu(InfoHelper.Info info,
#endregion

#region Cdrom
foreach (var value in vm.Config.ExtensionData.Values.Select(a => a.ToString()))
foreach (var value in vm.Config.ExtensionData.Values.Where(a => a != null).Select(a => a.ToString()))
{
if (value.Contains("media=cdrom") && value != "none,media=cdrom")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<OutputType>Library</OutputType>

<Version>1.5.6</Version>
<Version>1.5.8</Version>
<Company>Corsinvest Srl</Company>
<Authors>Daniele Corsini</Authors>
<Copyright>Corsinvest Srl</Copyright>
<Authors>Corsinvest Srl</Authors>
<Copyright>Corsinvest
Srl</Copyright>
<Product>Corsinvest for Proxmox VE Diagnostic Api</Product>
<AssemblyTitle>Corsinvest for Proxmox VE Diagnostic Api</AssemblyTitle>
<AssemblyTitle>Corsinvest for Proxmox VE
Diagnostic Api</AssemblyTitle>
<Description>Corsinvest for Proxmox VE Diagnostic Api</Description>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>

<PackageProjectUrl>https://github.com/Corsinvest/cv4pve-diag</PackageProjectUrl>
<PackageTags>ProxmoxVE;Api,Client;Rest;Corsinvest;Diagnostic</PackageTags>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PackageOutputPath>..\..\..\.nupkgs\</PackageOutputPath>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<RepositoryUrl>https://github.com/Corsinvest/cv4pve-diag</RepositoryUrl>
<RepositoryType>Github</RepositoryType>
<RepositoryUrl>https://github.com/Corsinvest/cv4pve-diag</RepositoryUrl>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<!-- Include symbol files (*.pdb) in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
Expand All @@ -30,7 +39,9 @@
</ItemGroup>

<ItemGroup>
<!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Extension\Corsinvest.ProxmoxVE.Api.Extension.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Extension" Version="7.3.6" />
<!-- <ProjectReference
Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Extension\Corsinvest.ProxmoxVE.Api.Extension.csproj"
/> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Extension" Version="7.4.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Version>1.4.4</Version>
<TargetFramework>net6.0</TargetFramework>
<Version>1.4.5</Version>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>cv4pve-diag</AssemblyName>
<Company>Corsinvest Srl</Company>
<Authors>Daniele Corsini</Authors>
Expand All @@ -18,14 +18,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="7.4.0" />
<!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Shell\Corsinvest.ProxmoxVE.Api.Shell.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="7.3.6" />

<!-- <ProjectReference Include="..\Corsinvest.ProxmoxVE.Diagnostic.Api\Corsinvest.ProxmoxVE.Diagnostic.Api.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Diagnostic.Api" Version="1.5.5" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
<ProjectReference
Include="..\Corsinvest.ProxmoxVE.Diagnostic.Api\Corsinvest.ProxmoxVE.Diagnostic.Api.csproj" />
<!-- <PackageReference Include="Corsinvest.ProxmoxVE.Diagnostic.Api" Version="1.5.5" /> -->
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions src/Corsinvest.ProxmoxVE.Diagnostic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ static async Task<int> Main(string[] args)

var app = ConsoleHelper.CreateApp("cv4pve-diag", "Diagnostic for Proxmox VE");

var optSettingsFile = app.AddOption("--settings-file", "File settings (generated from create-settings)");
var optSettingsFile = app.AddOption<string>("--settings-file", "File settings (generated from create-settings)");
optSettingsFile.AddValidatorExistFile();

var optIgnoredIssuesFile = app.AddOption("--ignored-issues-file", "File ignored issues (generated from create-ignored-issues)");
var optIgnoredIssuesFile = app.AddOption<string>("--ignored-issues-file", "File ignored issues (generated from create-ignored-issues)");
optSettingsFile.AddValidatorExistFile();

var optShowIgnoredIssues = app.AddOption<bool>("--ignored-issues-show", "Show second table with ignored issue");
Expand Down Expand Up @@ -64,10 +64,10 @@ static async Task<int> Main(string[] args)
var fileExport = "data.json";
var cmdExportCollect = app.AddCommand("export-collect", $"Export collect data collect to {fileExport}");
cmdExportCollect.SetHandler(async () =>
{
File.WriteAllText(fileExport, JsonSerializer.Serialize(await GetInfo(), new JsonSerializerOptions { WriteIndented = true }));
Console.Out.WriteLine($"Exported {fileExport}!");
});
{
File.WriteAllText(fileExport, JsonSerializer.Serialize(await GetInfo(), new JsonSerializerOptions { WriteIndented = true }));
Console.Out.WriteLine($"Exported {fileExport}!");
});

var cmdExamineCollect = app.AddCommand("examine-collect", $"Examine collect data collect from {fileExport}");
cmdExamineCollect.IsHidden = true;
Expand Down

0 comments on commit 17aae0d

Please sign in to comment.