PureStorage-OpenConnect / powershell-toolkit-3

PowerShell Toolkit 3.x
Apache License 2.0
6 stars 1 forks source link

Reporting module should be migrated to FlashArray and WindowsAdmin modules #70

Closed mikenelson-io closed 1 year ago

mikenelson-io commented 1 year ago

For discussion - The New-Pfa2ExcelReport does not require the CimSession cmdlet and therefor can be run on a non-Windows OS such as MacOS as long as it have Excel installed. It should be part of the FlashArray module as it only pertains to FA but will run on multiple OSs. The New-Pfa2HypervClusterVolumeReport does require the CimSession module and since it is only for a Windows based OS, it should be part of the WindowsAdmin module. The Reporting module should then be removed.

aguzev commented 1 year ago

New-Pfa2ExcelReportrequires ImportExcel which is too heavy to be a requirement for other FlashArray cmdlets. New-Pfa2ExcelReport needs to be rewritten without ImportExcel before moving to FA.

Same for New-Pfa2HypervClusterVolumeReport, it produces Excel reports.

aguzev commented 1 year ago

A classic solution is extraction of Excel support from those cmdlets:

PS> New-Pfa2Report | Export-Excel
PS> New-Pfa2Report | Export-Csv
barkz commented 1 year ago

@mikenelson-io good points on the Reporting. @aguzev when will you handle the migration of Reporting cmdlets into their newly identified modules?

aguzev commented 1 year ago

@barkz , @mikenelson-io ,do you agree to drop the dependency on ImportExcel?

aguzev commented 1 year ago

By the way, ImportExcel is based on EPPlus which is distributed under Polyform Noncommercial License 1.0.0. I don't know if this might be a concern.

EPPlus License FAQ

mikenelson-io commented 1 year ago

@barkz Legal?

barkz commented 1 year ago

Will follow-up with Pure legal, 4/20/2023.

barkz commented 1 year ago

@aguzev follow-up with work estimate.

barkz commented 1 year ago

I still this issue. Based on comments on #76 ImportExcel dependency was removed. When I look at Reporting module I see: #Requires -Modules @{ ModuleName='ImportExcel'; ModuleVersion='7.8.4' }

`PS /Users/barkz/Desktop/github-purestorage/powershell-toolkit-3> New-Pfa2ExcelReport -Endpoint 10.21.219.60 -Credential (Get-Credential) -Outpath /users/barkz/Desktop/

PowerShell credential request Enter your credentials. User: pureuser Password for user pureuser: **

Starting to read from array 10.21.219.60 ... Read complete. Disconnecting and continuing... Writing data to Excel workbook... WARNING: Auto-fitting columns is not available with this OS configuration. WARNING: Auto-fitting columns is not available with this OS configuration. No vVol Volume exist on Array. Skipping. WARNING: Auto-fitting columns is not available with this OS configuration. WARNING: Auto-fitting columns is not available with this OS configuration. No Host Groups exist on Array. Skipping. WARNING: Auto-fitting columns is not available with this OS configuration. WARNING: Auto-fitting columns is not available with this OS configuration. No Pods exist on Array. Skipping. Complete. Files located in /users/barkz/Desktop/ `

aguzev commented 1 year ago

There should be no reporting module at all. Let me check.

barkz commented 1 year ago

Just pulled image

barkz commented 1 year ago

macOS retest after latest PR and pull I get Exchange cim module error. I see in code we require. Can you implement error handling for macOS and Linux?

RequiredModules = @( 'CimCmdlets', 'Storage') https://learn.microsoft.com/en-us/powershell/scripting/whats-new/unix-support?view=powershell-7.3 The following Windows-specific modules aren't included in PowerShell for Linux or macOS.

Error PS /Users/barkz/Desktop/github-purestorage/powershell-toolkit-3> ./Import-PureStoragePowerShellToolkit.ps1 Import PureStoragePowerShellToolkit.FlashArray Import PureStoragePowerShellToolkit.DatabaseTools Import PureStoragePowerShellToolkit.WindowsAdministration Import PureStoragePowerShellToolkit.Exchange Import-Module: /Users/barkz/Desktop/github-purestorage/powershell-toolkit-3/Import-PureStoragePowerShellToolkit.Core.ps1:46 Line | 46 | Import-Module ".\$ModuleName" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The required module 'CimCmdlets' is not loaded. Load the module or remove the module from 'RequiredModules' in the | file | '/Users/barkz/Desktop/github-purestorage/powershell-toolkit-3/PureStoragePowerShellToolkit.Exchange/PureStoragePowerShellToolkit.Exchange.psd1'.

barkz commented 1 year ago

The output for New-Pfa2ExcelReport has tab order wacky on macOS and Windows.

Windows image

macOS image

aguzev commented 1 year ago

macOS retest after latest PR and pull I get Exchange cim module error. I see in code we require. Can you implement error handling for macOS and Linux?

Exchange module was not designed to be used on MacOS or Linux. It can be used on a Windows Server with Exchange installed.

Exchange module design should be discussed out of this issue.

aguzev commented 1 year ago

The output for New-Pfa2ExcelReport has tab order wacky on macOS and Windows.

Yes, currently the order is random.

aguzev commented 1 year ago

Import-PureStoragePowerShellToolkit.ps1 imports all toolkit cmdlets including those not running on Unix machines. For Unix users the toolkit provides Import-PureStoragePowerShelltoolkit.Core.ps1, which imports the cross-platform subset.

aguzev commented 1 year ago

Added a fix for tab order: #80

barkz commented 1 year ago

Tab orders fixed for macOS and Windows 11.