25
25
using Microsoft . Azure . WebJobs . Script . WebHost . Security ;
26
26
using Microsoft . Azure . WebJobs . Script . WebHost . Security . Authorization ;
27
27
using Microsoft . Azure . WebJobs . Script . WebHost . Security . Authorization . Policies ;
28
+ using Microsoft . Extensions . DependencyInjection ;
28
29
using Microsoft . Extensions . Logging ;
29
30
using Microsoft . Extensions . Options ;
30
31
using Newtonsoft . Json ;
@@ -47,7 +48,6 @@ public class HostController : Controller
47
48
private readonly IEnvironment _environment ;
48
49
private readonly IScriptHostManager _scriptHostManager ;
49
50
private readonly IFunctionsSyncManager _functionsSyncManager ;
50
- private readonly IExtensionBundleManager _extensionBundleManager ;
51
51
52
52
public HostController ( IOptions < ScriptApplicationHostOptions > applicationHostOptions ,
53
53
IOptions < JobHostOptions > hostOptions ,
@@ -56,8 +56,7 @@ public HostController(IOptions<ScriptApplicationHostOptions> applicationHostOpti
56
56
IWebFunctionsManager functionsManager ,
57
57
IEnvironment environment ,
58
58
IScriptHostManager scriptHostManager ,
59
- IFunctionsSyncManager functionsSyncManager ,
60
- IExtensionBundleManager extensionBundleManager )
59
+ IFunctionsSyncManager functionsSyncManager )
61
60
{
62
61
_applicationHostOptions = applicationHostOptions ;
63
62
_hostOptions = hostOptions ;
@@ -67,14 +66,13 @@ public HostController(IOptions<ScriptApplicationHostOptions> applicationHostOpti
67
66
_environment = environment ;
68
67
_scriptHostManager = scriptHostManager ;
69
68
_functionsSyncManager = functionsSyncManager ;
70
- _extensionBundleManager = extensionBundleManager ;
71
69
}
72
70
73
71
[ HttpGet ]
74
72
[ Route ( "admin/host/status" ) ]
75
73
[ Authorize ( Policy = PolicyNames . AdminAuthLevelOrInternal ) ]
76
74
[ TypeFilter ( typeof ( EnableDebugModeFilter ) ) ]
77
- public async Task < IActionResult > GetHostStatus ( [ FromServices ] IScriptHostManager scriptHostManager , [ FromServices ] IHostIdProvider hostIdProvider )
75
+ public async Task < IActionResult > GetHostStatus ( [ FromServices ] IScriptHostManager scriptHostManager , [ FromServices ] IHostIdProvider hostIdProvider , [ FromServices ] IServiceProvider serviceProvider = null )
78
76
{
79
77
var status = new HostStatus
80
78
{
@@ -85,14 +83,18 @@ public async Task<IActionResult> GetHostStatus([FromServices] IScriptHostManager
85
83
ProcessUptime = ( long ) ( DateTime . UtcNow - Process . GetCurrentProcess ( ) . StartTime ) . TotalMilliseconds
86
84
} ;
87
85
88
- var bundleInfo = await _extensionBundleManager . GetExtensionBundleDetails ( ) ;
89
- if ( bundleInfo != null )
86
+ var bundleManager = serviceProvider . GetService < IExtensionBundleManager > ( ) ;
87
+ if ( bundleManager != null )
90
88
{
91
- status . ExtensionBundle = new Models . ExtensionBundle ( )
89
+ var bundleInfo = await bundleManager . GetExtensionBundleDetails ( ) ;
90
+ if ( bundleInfo != null )
92
91
{
93
- Id = bundleInfo . Id ,
94
- Version = bundleInfo . Version
95
- } ;
92
+ status . ExtensionBundle = new Models . ExtensionBundle ( )
93
+ {
94
+ Id = bundleInfo . Id ,
95
+ Version = bundleInfo . Version
96
+ } ;
97
+ }
96
98
}
97
99
98
100
var lastError = scriptHostManager . LastError ;
0 commit comments