ENH log errors when getting managed objects
This commit is contained in:
parent
5912e70526
commit
6848fbe01f
|
@ -278,14 +278,21 @@ omInterfacesRemoved :: MemberName
|
|||
omInterfacesRemoved = memberName_ "InterfacesRemoved"
|
||||
|
||||
callGetManagedObjects
|
||||
:: (MonadUnliftIO m, SafeClient c)
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, SafeClient c)
|
||||
=> c
|
||||
-> BusName
|
||||
-> ObjectPath
|
||||
-> m ObjectTree
|
||||
callGetManagedObjects cl bus path =
|
||||
either (const M.empty) (fromMaybe M.empty . fromSingletonVariant)
|
||||
<$> callMethod cl bus path omInterface getManagedObjects
|
||||
callGetManagedObjects cl bus path = do
|
||||
res <- callMethod cl bus path omInterface getManagedObjects
|
||||
case res of
|
||||
Left err -> do
|
||||
logError $ Utf8Builder $ encodeUtf8Builder err
|
||||
return M.empty
|
||||
Right v -> return $ fromMaybe M.empty $ fromSingletonVariant v
|
||||
|
||||
-- either (const M.empty) (fromMaybe M.empty . fromSingletonVariant)
|
||||
-- <$>
|
||||
|
||||
addInterfaceChangedListener
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, SafeClient c)
|
||||
|
|
|
@ -164,7 +164,10 @@ adaptorHasDevice adaptor device = case splitPathNoRoot device of
|
|||
splitPathNoRoot :: ObjectPath -> [FilePath]
|
||||
splitPathNoRoot = dropWhile (== "/") . splitDirectories . formatObjectPath
|
||||
|
||||
getBtObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree
|
||||
getBtObjectTree
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> SysClient
|
||||
-> m ObjectTree
|
||||
getBtObjectTree sys = callGetManagedObjects sys btBus btOMPath
|
||||
|
||||
btOMPath :: ObjectPath
|
||||
|
|
|
@ -52,7 +52,10 @@ type VPNState = S.Set ObjectPath
|
|||
|
||||
type MutableVPNState = MVar VPNState
|
||||
|
||||
initState :: MonadUnliftIO m => SysClient -> m MutableVPNState
|
||||
initState
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> SysClient
|
||||
-> m MutableVPNState
|
||||
initState client = do
|
||||
ot <- getVPNObjectTree client
|
||||
newMVar $ findTunnels ot
|
||||
|
@ -71,7 +74,10 @@ updateState f state op = modifyMVar_ state $ return . f op
|
|||
--------------------------------------------------------------------------------
|
||||
-- Tunnel Device Detection
|
||||
|
||||
getVPNObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree
|
||||
getVPNObjectTree
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> SysClient
|
||||
-> m ObjectTree
|
||||
getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath
|
||||
|
||||
findTunnels :: ObjectTree -> VPNState
|
||||
|
|
Loading…
Reference in New Issue