Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/Functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ directive:
```

``` yaml
branch: powershell-function
branch: main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Francisco-Gamino There are 2000+ generated files get updated because of this PR (see #18209). Does it make sense to you? Is swagger of main branch that different from powershell-function branch?

Another thing, I'm going to put "Fixed an issue that New-AzFunctionApp cmdlet should write a warning message when setting default values for parameters that are not provided." into changelog. Let me you if you want to add anything else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @isra-fel -- No, that does not make sense. Switching from one branch to another should not generate these many files. What I think it could be happening here is that more Swagger definitions have been added to the API version 2019-08-01 that I am using, so I will need to remove the extra cmdlets that get generated. The Swagger files from the powershell-function branch are at least two years old and have not been updated.

Should we revert back to the powershell-function? After this release I can work on removing the extra generated cmdlets to move to the main branch. Please advice. Thank you.

/cc @wyunchi-ms

require:
- $(this-folder)/../readme.azure.noprofile.md
input-file:
Expand Down
4 changes: 3 additions & 1 deletion src/Functions/custom/HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ $constants["FunctionsNoV2Version"] = @(
"USSec East"
)

$constants["SetDefaultValueParameterWarningMessage"] = "This default value is subject to change over time. Please set this value explicitly to ensure the behavior is not accidentally impacted by future changes."

foreach ($variableName in $constants.Keys)
{
if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))
Expand Down Expand Up @@ -1018,7 +1020,7 @@ function GetRuntimeJsonDefinition
$RuntimeVersion = $latestVersion.ToString()
}

Write-Verbose "RuntimeVersion not specified. Setting default runtime version for '$Runtime' to '$RuntimeVersion'." -Verbose
Write-Warning "RuntimeVersion not specified. Setting default value to '$RuntimeVersion'. $SetDefaultValueParameterWarningMessage"
}

# Get the RuntimeJsonDefinition
Expand Down
4 changes: 2 additions & 2 deletions src/Functions/custom/New-AzFunctionApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function New-AzFunctionApp {
}

$FunctionsVersion = $DefaultFunctionsVersion
Write-Verbose "FunctionsVersion not specified. Setting default FunctionsVersion to '$FunctionsVersion'." -Verbose
Write-Warning "FunctionsVersion not specified. Setting default value to '$FunctionsVersion'. $SetDefaultValueParameterWarningMessage"
}

ValidateFunctionsVersion -FunctionsVersion $FunctionsVersion
Expand All @@ -284,7 +284,7 @@ function New-AzFunctionApp {
if (-not $OSType)
{
$OSType = GetDefaultOSType -Runtime $Runtime
Write-Verbose "OSType for $Runtime is '$OSType'." -Verbose
Write-Warning "OSType not specified. Setting default value to '$OSType'. $SetDefaultValueParameterWarningMessage"
}

$runtimeJsonDefintion = GetRuntimeJsonDefinition -FunctionsVersion $FunctionsVersion -Runtime $Runtime -RuntimeVersion $RuntimeVersion -OSType $OSType
Expand Down
10 changes: 5 additions & 5 deletions src/Functions/test/New-AzFunctionApp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ Describe 'New-AzFunctionApp' {
-FunctionsVersion $functionsVersion `
-WhatIf

} 4>&1 2>&1 > $filePath
} 3>&1 2>&1 > $filePath

$logFileContent = Get-Content -Path $filePath -Raw
$expectectedRuntimeVersion = $expectedDefaultRuntimeVersion[$OSType][$functionsVersion][$runtime]
$expectedMessage = "RuntimeVersion not specified. Setting default runtime version for '$runtime' to '$expectectedRuntimeVersion'."
$expectedMessage = "RuntimeVersion not specified. Setting default value to '$expectectedRuntimeVersion'."
$logFileContent | Should Match $expectedMessage
}
finally
Expand Down Expand Up @@ -234,12 +234,12 @@ Describe 'New-AzFunctionApp' {
-RuntimeVersion $runtimeVersion `
-WhatIf

} 4>&1 2>&1 > $filePath
} 3>&1 2>&1 > $filePath

$logFileContent = Get-Content -Path $filePath -Raw

$expectectedFunctionsVersionWarning = "FunctionsVersion not specified. Setting default FunctionsVersion to '$expectedFunctionsVersion'."
$expectectedOSTypeWarning = "OSType for $runtime is '$expectedOSType'."
$expectectedFunctionsVersionWarning = "FunctionsVersion not specified. Setting default value to '$expectedFunctionsVersion'."
$expectectedOSTypeWarning = "OSType not specified. Setting default value to '$expectedOSType'."

$logFileContent | Should Match $expectectedFunctionsVersionWarning
$logFileContent | Should Match $expectectedOSTypeWarning
Expand Down