Skip to content

Commit

Permalink
[Linux] Function still triggers despite being disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
alrod committed Dec 21, 2018
1 parent ace27b2 commit 1bfb2c3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 1bfb2c3

Please sign in to comment.