Skip to content

Commit

Permalink
review changes pt1
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Jan 6, 2023
1 parent 51689c0 commit b382598
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ func BackupSchema() *pluginsdk.Schema {
Optional: true,
Computed: true,
Description: "When the schedule should start working in RFC-3339 format.",
// DiffSuppressFunc: suppress.RFC3339Time,
// ValidateFunc: validation.IsRFC3339Time,
},

"last_execution_time": {
Expand Down Expand Up @@ -1115,7 +1113,7 @@ func FlattenLogsConfig(logsConfig web.SiteLogsConfig) []LogsConfig {
blobStorage.RetentionInDays = int(*httpLogs.AzureBlobStorage.RetentionInDays)
}

if blobStorage.RetentionInDays != 0 && blobStorage.SasUrl != "" {
if blobStorage.RetentionInDays != 0 || blobStorage.SasUrl != "" {
httpLog.AzureBlobStorage = []AzureBlobStorageHttp{blobStorage}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,8 @@ func FlattenSiteConfigWindowsFunctionAppSlot(functionAppSlotSiteConfig *web.Site

result.ApplicationStack = []ApplicationStackWindowsFunctionApp{{
DotNetVersion: pointer.From(functionAppSlotSiteConfig.NetFrameworkVersion),
DotNetIsolated: false, // set this later from app_settings
NodeVersion: "", // Need to get this from app_settings later
DotNetIsolated: false, // Note: this is set later from app_settings.FUNCTIONS_WORKER_RUNTIME in unpackWindowsFunctionAppSettings
NodeVersion: "", // Note: this will be set from app_settings later in unpackWindowsFunctionAppSettings
JavaVersion: pointer.From(functionAppSlotSiteConfig.JavaVersion),
PowerShellCoreVersion: powershellVersion,
CustomHandler: false, // set this later from app_settings
Expand Down
71 changes: 0 additions & 71 deletions internal/services/appservice/helpers/fx_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,77 +193,6 @@ func DecodeFunctionAppDockerFxString(input string, partial ApplicationStackDocke

return []ApplicationStackDocker{partial}, nil
}

func EncodeFunctionAppWindowsFxVersion(input []ApplicationStackWindowsFunctionApp) *string {
if len(input) == 0 {
return utils.String("")
}

appStack := input[0]
var appType, appString string
switch {
case appStack.NodeVersion != "":
appType = "Node"
appString = appStack.NodeVersion

case appStack.DotNetVersion != "":
if appStack.DotNetIsolated {
appType = "DotNet-Isolated"
} else {
appType = "DotNet"
}
appString = appStack.DotNetVersion

case appStack.JavaVersion != "":
appType = "Java"
appString = appStack.JavaVersion

case appStack.PowerShellCoreVersion != "":
appType = "PowerShell"
appString = appStack.PowerShellCoreVersion
}

return utils.String(fmt.Sprintf("%s|%s", appType, appString))
}

func DecodeFunctionAppWindowsFxVersion(input string) ([]ApplicationStackWindowsFunctionApp, error) {
if input == "" {
// This is a valid string for "Custom" stack which we picked up earlier, so we can skip here
return nil, nil
}

parts := strings.Split(input, "|")
if len(parts) != 2 {
return nil, fmt.Errorf("unrecognised WindowsFxVersion format received, got %s", input)
}

result := make([]ApplicationStackWindowsFunctionApp, 0)

switch strings.ToLower(parts[0]) {
case "dotnet":
appStack := ApplicationStackWindowsFunctionApp{DotNetVersion: parts[1]}
result = append(result, appStack)

case "dotnet-isolated":
appStack := ApplicationStackWindowsFunctionApp{DotNetVersion: parts[1], DotNetIsolated: true}
result = append(result, appStack)

case "node":
appStack := ApplicationStackWindowsFunctionApp{NodeVersion: parts[1]}
result = append(result, appStack)

case "java":
appStack := ApplicationStackWindowsFunctionApp{JavaVersion: parts[1]}
result = append(result, appStack)

case "powershell":
appStack := ApplicationStackWindowsFunctionApp{PowerShellCoreVersion: parts[1]}
result = append(result, appStack)
}

return result, nil
}

func JavaLinuxFxStringBuilder(javaMajorVersion, javaServer, javaServerVersion string) (*string, error) {
switch javaMajorVersion {
case "8":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,6 @@ func FlattenSiteConfigWindowsAppSlot(appSiteSlotConfig *web.SiteConfig, currentS
if winAppStack.PhpVersion == "" {
winAppStack.PhpVersion = PhpVersionOff
}
winAppStack.NodeVersion = pointer.From(appSiteSlotConfig.NodeVersion) // TODO - Get from app_settings
winAppStack.PythonVersion = pointer.From(appSiteSlotConfig.PythonVersion) // This _should_ always be `""`
winAppStack.Python = currentStack == CurrentStackPython
winAppStack.JavaVersion = pointer.From(appSiteSlotConfig.JavaVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ func FlattenSiteConfigWindows(appSiteConfig *web.SiteConfig, currentStack string
if winAppStack.PhpVersion == "" {
winAppStack.PhpVersion = PhpVersionOff
}
winAppStack.NodeVersion = pointer.From(appSiteConfig.NodeVersion) // TODO - Get from app_settings
winAppStack.PythonVersion = pointer.From(appSiteConfig.PythonVersion) // This _should_ always be `""`
winAppStack.Python = currentStack == CurrentStackPython
winAppStack.JavaVersion = pointer.From(appSiteConfig.JavaVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,6 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web
m.SiteConfig[0].ApplicationStack[0].DotNetIsolated = true
case "custom":
m.SiteConfig[0].ApplicationStack[0].CustomHandler = true

}
case "DOCKER_REGISTRY_SERVER_URL":
dockerSettings.RegistryURL = utils.NormalizeNilableString(v)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package appservice_test
import (
"context"
"fmt"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"regexp"
"testing"

Expand Down Expand Up @@ -841,7 +842,9 @@ func TestAccWindowsWebApp_basicDockerContainer(t *testing.T) {
// TODO: More Java matrix tests...

func TestAccWindowsWebApp_withNode12(t *testing.T) {
// TODO Deprecated - remove in 4.0
if features.FourPointOh() {
t.Fatalf("Node 12 is no longer supported in v4.0")
}
data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test")
r := WindowsWebAppResource{}

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/windows_web_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ ASP.NET V4.8 | v4.0

~> **NOTE:** The value `Off` is used to signify latest supported by the service.

* `python` - (Optional) The app is a Python app. Defaults to `false`.
* `python` - (Optional) Specifies whether this is a Python app. Defaults to `false`.

---

Expand Down

0 comments on commit b382598

Please sign in to comment.