sensu-run 0.5.0 → 0.5.0.1
raw patch · 3 files changed
+21/−10 lines, 3 filesdep ~network
Dependency ranges changed: network
Files
- CHANGELOG.md +4/−0
- sensu-run.cabal +2/−2
- sensu-run.hs +15/−8
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for sensu-run +## 0.5.0.1 -- 2018-04-30++* Relax upper version bound for network and fix a warning+ ## 0.5.0 -- 2018-04-20 * Add support for HTTPS (#18)
sensu-run.cabal view
@@ -1,5 +1,5 @@ name: sensu-run-version: 0.5.0+version: 0.5.0.1 synopsis: A tool to send command execution results to Sensu description: @sensu-run@ is a command line tool to send command execution results to Sensu@@ -34,7 +34,7 @@ , http-client-tls < 0.4 , http-types >= 0.9.1 && < 0.13 , lens >= 4.15 && < 4.17- , network >= 2.2.3 && < 2.7+ , network >= 2.2.3 && < 2.8 , optparse-applicative >= 0.12 && < 0.15 , process >= 1.4 && < 1.7 , temporary >= 1.1 && < 1.4
sensu-run.hs view
@@ -123,16 +123,23 @@ -> BL8.ByteString -- ^ Payload -> IO () sendToClientSocketInput port payload = bracket open close $ \sock -> do- localhost <- inet_addr "127.0.0.1"- connect sock $ SockAddrInet port localhost- Socket.sendAll sock payload- `catch` \(ioe :: IOException) -> do- hPutStrLn stderr $- "Failed to write results to localhost:" ++ show port- ++ " (" ++ show ioe ++ ")"- exitFailure+ info <- getAddrInfo (Just hints) (Just "127.0.0.1") (Just $ show port)+ case info of+ [] -> ioError $ userError "sendToClientSocketInput: failed to get AddrInfo"+ localhost:_ -> do+ connect sock $ addrAddress localhost+ Socket.sendAll sock payload+ `catch` \(ioe :: IOException) -> do+ hPutStrLn stderr $+ "Failed to write results to localhost:" ++ show port+ ++ " (" ++ show ioe ++ ")"+ exitFailure where open = socket AF_INET Stream defaultProtocol+ hints = defaultHints+ { addrFamily = AF_INET+ , addrSocketType = Stream+ } sendToSensuServer :: NonEmpty String -- ^ Sensu server base URLs