Skip to content

Commit

Permalink
Make sure PSBoundParameters is correct
Browse files Browse the repository at this point in the history
Fixes #1177
  • Loading branch information
heaths authored and azure-sdk committed Nov 13, 2020
1 parent e0d9515 commit e7680df
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,18 @@ try {
# Remove spaces, etc. that may be in $UserName
$UserName = $UserName -replace '\W'

# If no base name is specified use current user name
if (!$BaseName) {
# Make sure $BaseName is set.
if ($CI) {
$BaseName = 't' + (New-Guid).ToString('n').Substring(0, 16)
Log "Generated base name '$BaseName' for CI build"
} elseif (!$BaseName) {
$BaseName = "$UserName$ServiceDirectory"

# Make sure pre- and post-scripts are passed formerly required arguments.
$PSBoundParameters['BaseName'] = $BaseName

Log "BaseName was not set. Using default base name: '$BaseName'"
}

# Make sure pre- and post-scripts are passed formerly required arguments.
$PSBoundParameters['BaseName'] = $BaseName

# Try detecting repos that support OutFile and defaulting to it
if (!$CI -and !$PSBoundParameters.ContainsKey('OutFile') -and $IsWindows) {
# TODO: find a better way to detect the language
Expand Down Expand Up @@ -284,11 +286,6 @@ try {
$ServiceDirectory
}

if ($CI) {
$BaseName = 't' + (New-Guid).ToString('n').Substring(0, 16)
Write-Verbose "Generated base name '$BaseName' for CI build"
}

$ResourceGroupName = if ($ResourceGroupName) {
$ResourceGroupName
} elseif ($CI) {
Expand Down

0 comments on commit e7680df

Please sign in to comment.