From a2e3f889a4ea76a8b849be828314e30a159f83b9 Mon Sep 17 00:00:00 2001 From: Prince Pereira Date: Tue, 30 Jul 2024 15:56:41 +0530 Subject: [PATCH] Updating debug scripts path. --- scripts/collectlogs/collectlogs.ps1 | 12 ++++----- scripts/collectlogs/downloadScripts.ps1 | 27 +++++++++++++++++++ scripts/helper/dumpVfpPolicies.ps1 | 4 +-- scripts/starthnstrace/starthnstrace.ps1 | 2 +- .../startpacketcapture/startpacketcapture.ps1 | 2 +- 5 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 scripts/collectlogs/downloadScripts.ps1 diff --git a/scripts/collectlogs/collectlogs.ps1 b/scripts/collectlogs/collectlogs.ps1 index 3ab5c84..570f789 100644 --- a/scripts/collectlogs/collectlogs.ps1 +++ b/scripts/collectlogs/collectlogs.ps1 @@ -19,15 +19,15 @@ md $BaseDir -ErrorAction Ignore $helper = "$BaseDir\helper.psm1" if (!(Test-Path $helper)) { - Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/helper.psm1" -OutFile $BaseDir\helper.psm1 + Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/helper.psm1" -OutFile $BaseDir\helper.psm1 } ipmo $helper -Function DownloadFile -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/dumpVfpPolicies.ps1" -Destination $BaseDir\dumpVfpPolicies.ps1 -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/hns.v2.psm1" -Destination $BaseDir\hns.v2.psm1 -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/starthnstrace/starthnstrace.ps1" -Destination $BaseDir\starthnstrace.ps1 -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/startpacketcapture/startpacketcapture.ps1" -Destination $BaseDir\startpacketcapture.ps1 -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/Kubernetes/scripts/portReservationTest/portReservationTest.ps1" -Destination $BaseDir\portReservationTest.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/dumpVfpPolicies.ps1" -Destination $BaseDir\dumpVfpPolicies.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/HNS/hns.v2.psm1" -Destination $BaseDir\hns.v2.psm1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/starthnstrace/starthnstrace.ps1" -Destination $BaseDir\starthnstrace.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/startpacketcapture/startpacketcapture.ps1" -Destination $BaseDir\startpacketcapture.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/portReservationTest/portReservationTest.ps1" -Destination $BaseDir\portReservationTest.ps1 ipmo $BaseDir\hns.v2.psm1 -Force diff --git a/scripts/collectlogs/downloadScripts.ps1 b/scripts/collectlogs/downloadScripts.ps1 new file mode 100644 index 0000000..58abb00 --- /dev/null +++ b/scripts/collectlogs/downloadScripts.ps1 @@ -0,0 +1,27 @@ +Param( + [parameter(Mandatory = $false)] [ValidateSet(1,2)] [int] $HnsSchemaVersion = 2 +) + +$GithubSDNRepository = 'Microsoft/wcnscripts' +if ((Test-Path env:GITHUB_SDN_REPOSITORY) -and ($env:GITHUB_SDN_REPOSITORY -ne '')) +{ + $GithubSDNRepository = $env:GITHUB_SDN_REPOSITORY +} + +$BaseDir = (Get-Location).Path +mkdir $BaseDir -ErrorAction Ignore + +$helper = "$BaseDir\helper.psm1" +if (!(Test-Path $helper)) +{ + Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/helper.psm1" -OutFile $BaseDir\helper.psm1 +} +Import-Module $helper -Function DownloadFile + +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/collectlogs/collectlogs.ps1" -Destination $BaseDir\collectlogs.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/dumpVfpPolicies.ps1" -Destination $BaseDir\dumpVfpPolicies.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/VFP.psm1" -Destination $BaseDir\VFP.psm1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/HNS/hns.v2.psm1" -Destination $BaseDir\hns.v2.psm1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/starthnstrace/starthnstrace.ps1" -Destination $BaseDir\starthnstrace.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/startpacketcapture/startpacketcapture.ps1" -Destination $BaseDir\startpacketcapture.ps1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/portReservationTest/portReservationTest.ps1" -Destination $BaseDir\portReservationTest.ps1 diff --git a/scripts/helper/dumpVfpPolicies.ps1 b/scripts/helper/dumpVfpPolicies.ps1 index fe61a77..253c7ec 100644 --- a/scripts/helper/dumpVfpPolicies.ps1 +++ b/scripts/helper/dumpVfpPolicies.ps1 @@ -15,11 +15,11 @@ md $BaseDir -ErrorAction Ignore $helper = "$BaseDir\helper.psm1" if (!(Test-Path $helper)) { - Start-BitsTransfer "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/helper.psm1" -Destination $BaseDir\helper.psm1 + Start-BitsTransfer "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/helper.psm1" -Destination $BaseDir\helper.psm1 } ipmo $helper -DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/master/scripts/helper/VFP.psm1" -Destination $BaseDir\VFP.psm1 +DownloadFile -Url "https://raw.githubusercontent.com/$GithubSDNRepository/main/scripts/helper/VFP.psm1" -Destination $BaseDir\VFP.psm1 ipmo $BaseDir\VFP.psm1 $ports = Get-VfpPorts -SwitchName $switchName diff --git a/scripts/starthnstrace/starthnstrace.ps1 b/scripts/starthnstrace/starthnstrace.ps1 index d3b8882..e6db432 100644 --- a/scripts/starthnstrace/starthnstrace.ps1 +++ b/scripts/starthnstrace/starthnstrace.ps1 @@ -288,7 +288,7 @@ if (-NOT $NoPrompt.IsPresent) # try to download collectlogs.ps1 try { - $isCLFnd = Get-WebFile -URI 'https://raw.githubusercontent.com/microsoft/wcnscripts/master/scripts/collectlogs/collectlogs.ps1' -savePath "$BaseDir" -fileName 'collectlogs.ps1' + $isCLFnd = Get-WebFile -URI 'https://raw.githubusercontent.com/microsoft/wcnscripts/main/scripts/collectlogs/collectlogs.ps1' -savePath "$BaseDir" -fileName 'collectlogs.ps1' } catch { diff --git a/scripts/startpacketcapture/startpacketcapture.ps1 b/scripts/startpacketcapture/startpacketcapture.ps1 index c7dae78..5dab964 100644 --- a/scripts/startpacketcapture/startpacketcapture.ps1 +++ b/scripts/startpacketcapture/startpacketcapture.ps1 @@ -302,7 +302,7 @@ if (-NOT $NoPrompt.IsPresent) # try to download collectlogs.ps1 try { - $isCLFnd = Get-WebFile -URI 'https://raw.githubusercontent.com/microsoft/wcnscripts/master/scripts/collectlogs/collectlogs.ps1' -savePath "$BaseDir" -fileName 'collectlogs.ps1' + $isCLFnd = Get-WebFile -URI 'https://raw.githubusercontent.com/microsoft/wcnscripts/main/scripts/collectlogs/collectlogs.ps1' -savePath "$BaseDir" -fileName 'collectlogs.ps1' } catch {