diff options
author | Hank McCord <Henry.McCord@ewudn.robins.af.mil> | 2020-07-06 12:57:53 -0400 |
---|---|---|
committer | Hank McCord <Henry.McCord@ewudn.robins.af.mil> | 2020-07-06 13:05:08 -0400 |
commit | 789cda2aa2cf2343c7ac7d3923ec12fe2ba1889d (patch) | |
tree | d34e99666f655790f95268b593ba995b13c23662 /src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs | |
parent | 7f3c13e454eff5a3c39d4b20ae662e924baec35a (diff) | |
parent | 25e4ebdadf35a0050eeeacf3cf607fad8ab8a641 (diff) | |
download | letsencrypt-win-simple-789cda2aa2cf2343c7ac7d3923ec12fe2ba1889d.zip letsencrypt-win-simple-789cda2aa2cf2343c7ac7d3923ec12fe2ba1889d.tar.gz letsencrypt-win-simple-789cda2aa2cf2343c7ac7d3923ec12fe2ba1889d.tar.bz2 |
Merge branch 2.1.9 into azure-environment-agnostic
Diffstat (limited to 'src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs')
-rw-r--r-- | src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs index f8d5b0b..8dfccb4 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs @@ -1,7 +1,9 @@ using PKISharp.WACS.Clients.IIS; +using PKISharp.WACS.DomainObjects; using System; using System.IO; using System.Linq; +using System.Threading.Tasks; namespace PKISharp.WACS.Plugins.ValidationPlugins.Http { @@ -11,7 +13,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http public FileSystem(FileSystemOptions options, IIISClient iisClient, RunLevel runLevel, HttpValidationParameters pars) : base(options, runLevel, pars) => _iisClient = iisClient; - protected override void DeleteFile(string path) + protected override Task DeleteFile(string path) { var fi = new FileInfo(path); if (fi.Exists) @@ -23,9 +25,10 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http { _log.Warning("File {path} already deleted", path); } + return Task.CompletedTask; } - protected override void DeleteFolder(string path) + protected override Task DeleteFolder(string path) { var di = new DirectoryInfo(path); if (di.Exists) @@ -37,11 +40,12 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http { _log.Warning("Folder {path} already deleted", path); } + return Task.CompletedTask; } - protected override bool IsEmpty(string path) => !new DirectoryInfo(path).EnumerateFileSystemInfos().Any(); + protected override Task<bool> IsEmpty(string path) => Task.FromResult(!new DirectoryInfo(path).EnumerateFileSystemInfos().Any()); - protected override void WriteFile(string path, string content) + protected override async Task WriteFile(string path, string content) { var fi = new FileInfo(path); if (!fi.Directory.Exists) @@ -49,19 +53,19 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http fi.Directory.Create(); } _log.Verbose("Writing file to {path}", path); - File.WriteAllText(path, content); + await File.WriteAllTextAsync(path, content); } /// <summary> /// Update webroot /// </summary> /// <param name="scheduled"></param> - protected override void Refresh() + protected override void Refresh(TargetPart targetPart) { if (string.IsNullOrEmpty(_options.Path)) { // Update web root path - var siteId = _options.SiteId ?? _targetPart.SiteId; + var siteId = _options.SiteId ?? targetPart.SiteId; if (siteId > 0) { _path = _iisClient.GetWebSite(siteId.Value).Path; |