diff --git a/src/vm-repair/HISTORY.rst b/src/vm-repair/HISTORY.rst index 55d7a3ea54b..0ba116274fb 100644 --- a/src/vm-repair/HISTORY.rst +++ b/src/vm-repair/HISTORY.rst @@ -1,6 +1,11 @@ Release History =============== + +0.5.8 +++++++ +Fix az vm repair run --preview parameter to take in fork and branch name of User's repository. + 0.5.7 ++++++ Remove VM-repair SUSE image check diff --git a/src/vm-repair/azext_vm_repair/_help.py b/src/vm-repair/azext_vm_repair/_help.py index ff849376eb6..2786068cf7f 100644 --- a/src/vm-repair/azext_vm_repair/_help.py +++ b/src/vm-repair/azext_vm_repair/_help.py @@ -57,7 +57,7 @@ az vm repair run -g MyResourceGroup -n MySourceWinVM --custom-script-file ./file.ps1 --verbose - name: Run unverified script from your fork of https://github.com/Azure/repair-script-library text: > - az vm repair run -g MyResourceGroup -n MySourceWinVM --preview "https://github.com/haagha/repair-script-library/blob/master/map.json" --run-id test + az vm repair run -g MyResourceGroup -n MySourceWinVM --preview "https://github.com/User/repair-script-library/blob/main/map.json" --run-id test """ helps['vm repair list-scripts'] = """ @@ -75,7 +75,7 @@ az vm repair list-scripts --query "[?contains(description, 'test')]" - name: List unverified script from your fork of https://github.com/Azure/repair-script-library text: > - az vm repair list-scripts --preview "https://github.com/haagha/repair-script-library/blob/master/map.json" + az vm repair list-scripts --preview "https://github.com/User/repair-script-library/blob/main/map.json" """ helps['vm repair reset-nic'] = """ diff --git a/src/vm-repair/azext_vm_repair/custom.py b/src/vm-repair/azext_vm_repair/custom.py index 6391f06a8eb..0c5139f1dce 100644 --- a/src/vm-repair/azext_vm_repair/custom.py +++ b/src/vm-repair/azext_vm_repair/custom.py @@ -430,6 +430,14 @@ def run(cmd, vm_name, resource_group_name, run_id=None, repair_vm_id=None, custo # Fetch run path from GitHub repair_script_path = _fetch_run_script_path(run_id) run_command_params.append('script_path="./{}"'.format(repair_script_path)) + if preview: + parts = preview.split('/') + if len(parts) != 7: + raise Exception('Invalid preview url. Write full URL of map.json file. example https://github.com/Azure/repair-script-library/blob/main/map.json') + fork_name = parts[3] + branch_name = parts[6] + run_command_params.append('repo_fork="{}"'.format(fork_name)) + run_command_params.append('repo_branch="{}"'.format(branch_name)) # Custom script scenario for script testers else: diff --git a/src/vm-repair/azext_vm_repair/scripts/win-run-driver.ps1 b/src/vm-repair/azext_vm_repair/scripts/win-run-driver.ps1 index 1d57e940d9c..41d262d3e32 100644 --- a/src/vm-repair/azext_vm_repair/scripts/win-run-driver.ps1 +++ b/src/vm-repair/azext_vm_repair/scripts/win-run-driver.ps1 @@ -1,4 +1,4 @@ -Param([Parameter(Mandatory=$true)][string]$script_path,[Parameter(Mandatory=$false)][bool]$init=$true,[Parameter(Mandatory=$false)][string]$params='') +Param([Parameter(Mandatory=$true)][string]$script_path,[Parameter(Mandatory=$false)][string]$repo_fork, [Parameter(Mandatory=$false)][string]$repo_branch, [Parameter(Mandatory=$false)][bool]$init=$true,[Parameter(Mandatory=$false)][string]$params='') if ($init) { try { @@ -11,7 +11,9 @@ if ($init) $logFileName = "logs-$curDate.txt" Set-Content -Path "./$logFileName" -Value "[Log-Start $(Get-Date)]" $logFile = (Resolve-Path "./$logFileName").Path - (new-object net.webclient).DownloadFile('https://github.com/Azure/repair-script-library/zipball/master/', (Join-Path $pwd 'repair-script-library.zip')) + + $url = "https://github.com/$repo_fork/repair-script-library/zipball/$repo_branch/" + (new-object net.webclient).DownloadFile($url, (Join-Path $pwd 'repair-script-library.zip')) Expand-Archive -Path 'repair-script-library.zip' -DestinationPath 'repair-script-library' $reponame = dir repair-script-library -n Set-Location (Join-Path 'repair-script-library' $reponame) diff --git a/src/vm-repair/setup.py b/src/vm-repair/setup.py index eee98587a18..3acdb3fff94 100644 --- a/src/vm-repair/setup.py +++ b/src/vm-repair/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.5.7" +VERSION = "0.5.8" CLASSIFIERS = [ 'Development Status :: 4 - Beta',