Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed LiteralPath Issue During Cohesity Window Agent Installation #57

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Ansible Lint
on: [push, pull_request]
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ansible:
- stable-2.16
- stable-2.17
- stable-2.18
steps:
- uses: actions/checkout@v2
# this Action should follow steps to set up Python build environment
Expand All @@ -14,5 +20,5 @@ jobs:
- name: Perform sanity testing with ansible-test
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: stable-2.16
ansible-core-version: ${{ matrix.ansible }}
testing-type: sanity
12 changes: 8 additions & 4 deletions plugins/modules/cohesity_win_agent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#Requires -Module Ansible.ModuleUtils.Legacy

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSCustomUseLiteralPath', '',
Justification = 'This module has supported wildcard comparison since it was created')]
param()

Function Set-CohesityValidation {
try {

Expand Down Expand Up @@ -114,7 +118,7 @@ Function New-CohesityToken {
}

Function Get-CohesityAgent {
Get-ItemProperty -LiteralPath HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -like "Cohesity Agent *" }
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -like "Cohesity Agent *" }
}

Function Find-CohesityAgent {
Expand Down Expand Up @@ -203,7 +207,7 @@ Function Invoke-AgentDownload {
uri = $url
filename = $filename
}
Remove-Item -LiteralPath $tmpdir -Confirm:$False -Force -Recurse
Remove-Item $tmpdir -Confirm:$False -Force -Recurse
Fail-Json $errors $_.Exception.Message
}

Expand All @@ -219,7 +223,7 @@ Function Install-CohesityAgent {
)

process {
$tmpdir = (Get-Item -LiteralPath $self.filename).DirectoryName
$tmpdir = (Get-Item $self.filename).DirectoryName

$arguments = "/verysilent /norestart /suppressmsgboxes /type=" + $self.args.install_type

Expand Down Expand Up @@ -249,7 +253,7 @@ Function Install-CohesityAgent {
}
finally {
# => Remove the downloaded file and temporary directory.
Remove-Item -LiteralPath $tmpdir -Confirm:$False -Force -Recurse
Remove-Item $tmpdir -Confirm:$False -Force -Recurse
}
$agent = Get-CohesityAgent

Expand Down
Loading