Skip to content

Commit e43edb1

Browse files
committed
Apply powershell best practices
1 parent f3fe77f commit e43edb1

File tree

160 files changed

+1044
-805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1044
-805
lines changed
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: PSScriptAnalyzer
22
on: [push, pull_request]
33
jobs:
4-
lint:
5-
name: Run PSScriptAnalyzer
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v5
9-
- name: lint
10-
uses: devblackops/github-action-psscriptanalyzer@master
11-
with:
12-
sendComment: true
13-
failOnErrors: true
14-
failOnWarnings: false
15-
failOnInfos: false
16-
repoToken: ${{ secrets.GITHUB_TOKEN }}
17-
settingsPath: .github/workflows/PSScriptAnalyzerSettings.psd1
4+
lint:
5+
name: Run PSScriptAnalyzer
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v5
9+
- name: lint
10+
uses: devblackops/github-action-psscriptanalyzer@master
11+
with:
12+
sendComment: true
13+
failOnErrors: true
14+
failOnWarnings: false
15+
failOnInfos: false
16+
repoToken: ${{ secrets.GITHUB_TOKEN }}
17+
settingsPath: .github/workflows/PSScriptAnalyzerSettings.psd1

.github/workflows/Release.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
name: Publish PowerShell Module
22

33
on:
4-
release:
5-
types: [published]
4+
release:
5+
types: [published]
66

77
jobs:
8-
publish-to-gallery:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v5
12-
- name: Set PSRepository to Trusted for PowerShell Gallery
13-
shell: pwsh
14-
run: |
15-
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
16-
- name: Install AsBuiltReport.Core module
17-
shell: pwsh
18-
run: |
19-
Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force
20-
- name: Install NetApp.ONTAP module
21-
shell: pwsh
22-
run: |
23-
Install-Module -Name NetApp.ONTAP -Repository PSGallery -Force
24-
- name: Install Diagrammer.Core module
25-
shell: pwsh
26-
run: |
27-
Install-Module -Name Diagrammer.Core -Repository PSGallery -Force
28-
- name: Test Module Manifest
29-
shell: pwsh
30-
run: |
31-
Test-ModuleManifest .\AsBuiltReport.NetApp.ONTAP.psd1
32-
- name: Publish module to PowerShell Gallery
33-
shell: pwsh
34-
run: |
35-
Publish-Module -Path ./ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose
36-
tweet:
37-
needs: publish-to-gallery
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: Eomm/why-don-t-you-tweet@v2
41-
# We don't want to tweet if the repository is not a public one
42-
if: ${{ !github.event.repository.private }}
43-
with:
44-
# GitHub event payload
45-
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
46-
tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Netapp #AsBuiltReport #PowerShell #Ontap #NetAppATeam"
47-
env:
48-
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
49-
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
50-
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
51-
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
52-
bsky-post:
53-
needs: publish-to-gallery
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: zentered/[email protected]
57-
with:
58-
post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Netapp #AsBuiltReport #PowerShell #Ontap #NetAppATeam"
59-
env:
60-
BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }}
61-
BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }}
8+
publish-to-gallery:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
- name: Set PSRepository to Trusted for PowerShell Gallery
13+
shell: pwsh
14+
run: |
15+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
16+
- name: Install AsBuiltReport.Core module
17+
shell: pwsh
18+
run: |
19+
Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force
20+
- name: Install NetApp.ONTAP module
21+
shell: pwsh
22+
run: |
23+
Install-Module -Name NetApp.ONTAP -Repository PSGallery -Force
24+
- name: Install Diagrammer.Core module
25+
shell: pwsh
26+
run: |
27+
Install-Module -Name Diagrammer.Core -Repository PSGallery -Force
28+
- name: Test Module Manifest
29+
shell: pwsh
30+
run: |
31+
Test-ModuleManifest .\AsBuiltReport.NetApp.ONTAP.psd1
32+
- name: Publish module to PowerShell Gallery
33+
shell: pwsh
34+
run: |
35+
Publish-Module -Path ./ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose
36+
tweet:
37+
needs: publish-to-gallery
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: Eomm/why-don-t-you-tweet@v2
41+
# We don't want to tweet if the repository is not a public one
42+
if: ${{ !github.event.repository.private }}
43+
with:
44+
# GitHub event payload
45+
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
46+
tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Netapp #AsBuiltReport #PowerShell #Ontap #NetAppATeam"
47+
env:
48+
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
49+
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
50+
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
51+
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
52+
bsky-post:
53+
needs: publish-to-gallery
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: zentered/[email protected]
57+
with:
58+
post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Netapp #AsBuiltReport #PowerShell #Ontap #NetAppATeam"
59+
env:
60+
BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }}
61+
BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }}

.github/workflows/codeql.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@
1010
name: CodeQL
1111

1212
on:
13-
push:
14-
branches: [ "dev" ]
15-
pull_request:
16-
branches: [ "dev" ]
17-
schedule:
18-
- cron: '20 14 * * 1'
13+
push:
14+
branches: ["dev"]
15+
pull_request:
16+
branches: ["dev"]
17+
schedule:
18+
- cron: "20 14 * * 1"
1919

2020
permissions:
21-
contents: read
21+
contents: read
2222

2323
jobs:
24-
build:
25-
permissions:
26-
contents: read # for actions/checkout to fetch code
27-
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29-
name: PSScriptAnalyzer
30-
runs-on: ubuntu-latest
31-
steps:
32-
- uses: actions/checkout@v5
24+
build:
25+
permissions:
26+
contents: read # for actions/checkout to fetch code
27+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29+
name: PSScriptAnalyzer
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v5
3333

34-
- name: Run PSScriptAnalyzer
35-
uses: microsoft/[email protected]
36-
with:
37-
# Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options.
38-
# The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules.
39-
path: .\
40-
recurse: true
41-
# Include your own basic security rules. Removing this option will run all the rules
42-
excludeRule: '"PSAvoidUsingPlainTextForPassword", "PSAvoidUsingUsernameAndPasswordParams", "PSAvoidUsingConvertToSecureStringWithPlainText"'
43-
output: results.sarif
34+
- name: Run PSScriptAnalyzer
35+
uses: microsoft/[email protected]
36+
with:
37+
# Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options.
38+
# The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules.
39+
path: .\
40+
recurse: true
41+
# Include your own basic security rules. Removing this option will run all the rules
42+
excludeRule: '"PSAvoidUsingPlainTextForPassword", "PSAvoidUsingUsernameAndPasswordParams", "PSAvoidUsingConvertToSecureStringWithPlainText"'
43+
output: results.sarif
4444

45-
# Upload the SARIF file generated in the previous step
46-
- name: Upload SARIF results file
47-
uses: github/codeql-action/upload-sarif@v3
48-
with:
49-
sarif_file: results.sarif
45+
# Upload the SARIF file generated in the previous step
46+
- name: Upload SARIF results file
47+
uses: github/codeql-action/upload-sarif@v3
48+
with:
49+
sarif_file: results.sarif

AsBuiltReport.NetApp.ONTAP.Style.ps1

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

AsBuiltReport.NetApp.ONTAP.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
RequiredModules = @(
5555
@{
5656
ModuleName = 'AsBuiltReport.Core';
57-
ModuleVersion = '1.5.0'
57+
ModuleVersion = '1.5.1'
5858
},
5959
@{
6060
ModuleName = 'NetApp.ONTAP';

AsBuiltReport.NetApp.ONTAP.psm1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# Get assemblies files and import them
2+
$assemblyName = switch ($PSVersionTable.PSEdition) {
3+
'Core' {
4+
if ($IsMacOS) {
5+
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}osx-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
6+
} elseif ($IsLinux) {
7+
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}linux-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
8+
} elseif ($IsWindows) {
9+
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}win-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
10+
}
11+
}
12+
'Desktop' {
13+
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net48{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
14+
}
15+
default {
16+
Write-Verbose -Message 'Unable to find compatible assemblies.'
17+
}
18+
}
19+
20+
foreach ($Assembly in $assemblyName) {
21+
try {
22+
Write-Verbose -Message "Loading assembly '$($Assembly.Name)'."
23+
Add-Type -Path $Assembly.FullName -Verbose
24+
} catch {
25+
Write-Error -Message "Failed to add assembly $($Assembly.FullName): $_"
26+
}
27+
}
28+
129
# Get public and private function definition files and dot source them
230
$Public = @(Get-ChildItem -Path $PSScriptRoot\Src\Public\*.ps1 -ErrorAction SilentlyContinue)
331
$Private = @(Get-ChildItem -Path $PSScriptRoot\Src\Private\*.ps1 -ErrorAction SilentlyContinue)

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Add Health Check best practices for Network Broadcast Domains
1313
- Add Health Check best practices for NTP configuration
1414
- Recommend multiple NTP servers for redundancy
15+
- Add Per Volume export policy information
16+
- Add `Node Name` to FCP Interfaces section in FCP Vserver configuration
17+
- Apply powershell best practices
1518

16-
### Fixed
19+
### Changed
1720

18-
- Fix snapshot reserve space health check to use correct calculation method
1921
- Bump Diagrammer.Core module requirement to v0.2.36
2022
- Bump module version to v0.6.12
23+
24+
### Fixed
25+
26+
- Fix snapshot reserve space health check to use correct calculation method
2127
- Enhance Get-AbrOntapNodesSP function with detailed service-processor information
28+
- Fix model property assignment in Get-AbrOntapStorageAggrDiagram function
29+
- Fix Volume SnapShot Configuration section showing healthcheck for non violated item
2230

2331
## [0.6.11] - 2025-11-07
2432

4 KB
Binary file not shown.
120 KB
Binary file not shown.
1.14 MB
Binary file not shown.

0 commit comments

Comments
 (0)