Skip to content

Commit

Permalink
[az vm repair] Win-run-driver script fix (#7061)
Browse files Browse the repository at this point in the history
  • Loading branch information
haagha authored Dec 8, 2023
1 parent a34fbe5 commit 3877c87
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/vm-repair/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============

0.5.9
++++++
Adding default values in win-run-driver.ps1 script for repo_fork and branch_name.

0.5.8
++++++
Fix az vm repair run --preview parameter to take in fork and branch name of User's repository.
Expand Down
7 changes: 4 additions & 3 deletions src/vm-repair/azext_vm_repair/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ def run(cmd, vm_name, resource_group_name, run_id=None, repair_vm_id=None, custo
run_command_params.append('script_path="./{}"'.format(repair_script_path))
if preview:
parts = preview.split('/')
if len(parts) != 7:
if len(parts) < 7 or parts.index('map.json') == -1:
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]
last_index = parts.index('map.json')
fork_name = parts[last_index - 4]
branch_name = parts[last_index - 1]
run_command_params.append('repo_fork="{}"'.format(fork_name))
run_command_params.append('repo_branch="{}"'.format(branch_name))

Expand Down
9 changes: 8 additions & 1 deletion src/vm-repair/azext_vm_repair/scripts/win-run-driver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ if ($init)
$logFileName = "logs-$curDate.txt"
Set-Content -Path "./$logFileName" -Value "[Log-Start $(Get-Date)]"
$logFile = (Resolve-Path "./$logFileName").Path

if($repo_fork -eq $null)
{
$repo_fork = 'Azure/repair-script-library'
}
if($repo_branch -eq $null)
{
$repo_branch = 'master'
}
$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'
Expand Down
2 changes: 1 addition & 1 deletion src/vm-repair/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.5.8"
VERSION = "0.5.9"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 3877c87

Please sign in to comment.