diff --git a/src/Microsoft.Azure.WebJobs.Host/Listeners/HostListenerFactory.cs b/src/Microsoft.Azure.WebJobs.Host/Listeners/HostListenerFactory.cs index 34ea0ac93..9e0ccb228 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Listeners/HostListenerFactory.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Listeners/HostListenerFactory.cs @@ -80,7 +80,9 @@ internal static bool IsDisabled(MethodInfo method, INameResolver nameResolver, I { // First try to resolve disabled state by setting string settingName = string.Format(CultureInfo.InvariantCulture, "AzureWebJobs.{0}.Disabled", Utility.GetFunctionName(method)); - if (ConfigurationUtility.IsSettingEnabled(settingName)) + // Linux does not support dots in env variable name. So we replace dots with underscores. + string settingNameLinux = string.Format(CultureInfo.InvariantCulture, "AzureWebJobs_{0}_Disabled", Utility.GetFunctionName(method)); + if (ConfigurationUtility.IsSettingEnabled(settingName) || ConfigurationUtility.IsSettingEnabled(settingNameLinux)) { return true; } diff --git a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/HostListenerFactoryTests.cs b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/HostListenerFactoryTests.cs index 84f4469c7..2bf5f7989 100644 --- a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/HostListenerFactoryTests.cs +++ b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/HostListenerFactoryTests.cs @@ -43,6 +43,8 @@ public HostListenerFactoryTests() [InlineData(typeof(Functions1), "DisabledByEnvironmentSetting")] [InlineData(typeof(Functions1), "DisabledByAppSetting_Method")] [InlineData(typeof(Functions1), "DisabledByAppSetting_FunctionNameAttributeTest")] + [InlineData(typeof(Functions1), "DisabledByAppSetting_Method_Linux")] + [InlineData(typeof(Functions1), "DisabledByAppSetting_FunctionNameAttributeTest_Linux")] [InlineData(typeof(Functions2), "DisabledAtClassLevel")] public async Task CreateAsync_SkipsDisabledFunctions(Type jobType, string methodName) { @@ -180,12 +182,24 @@ public static void DisabledByAppSetting_Method( { } + + public static void DisabledByAppSetting_Method_Linux( + [QueueTrigger("test")] string message) + { + } + [FunctionName("DisabledByAppSetting_FunctionNameAttribute")] public static void DisabledByAppSetting_FunctionNameAttributeTest( [QueueTrigger("test")] string message) { } + [FunctionName("DisabledByAppSetting_FunctionNameAttribute")] + public static void DisabledByAppSetting_FunctionNameAttributeTest_Linux( + [QueueTrigger("test")] string message) + { + } + public static void TestJob( [QueueTrigger("test")] string message) { diff --git a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/appsettings.json b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/appsettings.json index 1a7fd265a..df2169508 100644 --- a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/appsettings.json +++ b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/appsettings.json @@ -4,5 +4,7 @@ "DisableSettingTrue": "true", "DisableSettingFalse": "false", "AzureWebJobs.DisabledByAppSetting_Method.Disabled": "true", - "AzureWebJobs.DisabledByAppSetting_FunctionNameAttribute.Disabled": "true" + "AzureWebJobs.DisabledByAppSetting_FunctionNameAttribute.Disabled": "true", + "AzureWebJobs_DisabledByAppSetting_Method_Linux_Disabled": "true", + "AzureWebJobs_DisabledByAppSetting_FunctionNameAttribute_Linux_Disabled": "true" }