aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-01-07 21:49:13 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-01-07 21:49:13 +0300
commitcdddf52e87b0b7a84b9b664df29004340f99ec20 (patch)
treef9669cff4831b9fdae6e9bf9f2a6391faf5bbc1c
parentc981e1e82e94084bccbad194780434a5864e8f6d (diff)
downloadldapply-cdddf52e87b0b7a84b9b664df29004340f99ec20.tar.gz
Allow "delete" non-existent entries
-rw-r--r--README.md5
-rw-r--r--src/Main.hs2
2 files changed, 7 insertions, 0 deletions
diff --git a/README.md b/README.md
index a31f94d..985b5f4 100644
--- a/README.md
+++ b/README.md
@@ -73,5 +73,10 @@ dn: cn=reader,dc=nodomain
changetype: modify
replace: description
description: foo
+
+# This will be deleted if exists:
+dn: cn=reader,dc=nodomain
+changetype: delete
+
```
diff --git a/src/Main.hs b/src/Main.hs
index c989956..d497fe3 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -81,6 +81,8 @@ apply ldap rec = do
update :: LDAP -> Maybe LDAPEntry -> LDIFRecord -> IO ()
+update _ Nothing (ChangeRecord _ ChangeDelete) = return ()
+
update _ Nothing rec@(ChangeRecord _ _) =
die $ "cannot update non-existing entry " ++ show (dn rec)