summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-06-11 16:50:59 -0400
committerAndrew Cady <d@jerkface.net>2017-06-11 16:50:59 -0400
commit41e8df4f47bb1f27ea6d3d7843fcec31362a9b98 (patch)
tree6d94f3a19af267f15f8567dc7cb7272e9ef9452b
parent24636431e7eb0d32bc6a1b155a10e7f873a6d8c2 (diff)
avoid unneeded provision checks
-rw-r--r--acme-certify.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/acme-certify.hs b/acme-certify.hs
index 677a291..a9bf3fa 100644
--- a/acme-certify.hs
+++ b/acme-certify.hs
@@ -134,9 +134,10 @@ updateOpts = fmap Update $
134 [ "Do not fetch any certificates; only tests" 134 [ "Do not fetch any certificates; only tests"
135 , "configuration file and http provisioning" 135 , "configuration file and http provisioning"
136 ])) 136 ]))
137 <*> switch (long "provision-check" <> help 137 <*> fmap not (switch
138 (unwords ["Locally check HTTP provisioning", 138 (long "no-provision-check" <> help
139 "before requesting certificates"])) 139 (unwords ["Locally check HTTP provisioning",
140 "before requesting certificates"])))
140 <*> many 141 <*> many
141 (strOption 142 (strOption
142 (long "try" <> 143 (long "try" <>
@@ -286,13 +287,6 @@ runUpdate UpdateOpts { .. } = do
286 287
287 let wantedCertSpecs = filter (wantUpdate . view _1) validCertSpecs 288 let wantedCertSpecs = filter (wantUpdate . view _1) validCertSpecs
288 289
289 when updateDoPrivisionCheck $
290 forM_ (view _3 <$> wantedCertSpecs) $ \spec ->
291 forM_ (filter (wantProvisionCheck . fst) $ csDomains spec) $ \csd -> do
292 putStrLn $ "Provision check: " ++ (domainToString . fst $ csd)
293 can <- uncurry canProvision csd
294 unless can $ error "Error: cannot provision files to web server"
295
296 when (null updateTryVHosts) $ forM_ wantedCertSpecs $ \(_, domain, spec) -> do 290 when (null updateTryVHosts) $ forM_ wantedCertSpecs $ \(_, domain, spec) -> do
297 291
298 let terms = defaultTerms 292 let terms = defaultTerms
@@ -301,6 +295,11 @@ runUpdate UpdateOpts { .. } = do
301 295
302 (needToFetch spec >>=) $ leftMapM_ $ \reason -> do 296 (needToFetch spec >>=) $ leftMapM_ $ \reason -> do
303 putStrLn $ concat ["New certificate needed (for domain ", domainToString domain, "): ", show reason] 297 putStrLn $ concat ["New certificate needed (for domain ", domainToString domain, "): ", show reason]
298 when updateDoPrivisionCheck $
299 forM_ (filter (wantProvisionCheck . fst) $ csDomains spec) $ \csd -> do
300 putStrLn $ "Provision check: " ++ (domainToString . fst $ csd)
301 can <- uncurry canProvision csd
302 unless can $ error "Error: cannot provision files to web server"
304 if updateDryRun 303 if updateDryRun
305 then putStrLn "Dry run: nothing fetched, nothing saved." 304 then putStrLn "Dry run: nothing fetched, nothing saved."
306 else print =<< fetchCertificate directoryUrl terms email issuerCert spec 305 else print =<< fetchCertificate directoryUrl terms email issuerCert spec