Sign inSign up

chibenwa/dav-migrator

By chibenwa

Updated over 2 years ago

Image
0

448

chibenwa/dav-migrator repository overview

DAV migration helper

Sample request:

 curl -XPOST 127.0.0.1:8000/migrate -v -d '{"sourceLogin":"poc-btellier", "sourcePassword":"xxxxxxxxxxx", "destinationMailAddress": "[email protected]"}' -v

Will:

    1. Get the OpenPaaS identifier associated with the provided "destinationMailAddress"
    1. Create an applicative account for "destinationMailAddress" onto LEMON_URL
    1. Fill a vdirsync configuration file for migrating data betwwen SOURCE_DAV_URL, sourceLogin and DESTRINATION_DAV_URL destinationMailAddress
    1. Run (System.exec) vdirsync
    1. Clear the applicative account for "destinationMailAddress" onto LEMON_URL
    1. Return 200 OK once done.

Environment variables:

And return as a body:

{
  "calDavErrorCount":0,
  "calDavSuccessCount":0,
  "cardDavErrorCount":0,
  "cardDavSuccessCount":0,
  "caldavExitCode":0,
  "carddavExitCode":1,
  "description": "CardDAV failed with exit code 1",
  "success":true
}

Status codes:

  • 200 OK execution report in the payload
  • 207 partially ok, report in the payload
  • 500 NOT OK, report in the payload

By default the LemonLDAP user (ie LDAP uid) is inferred as the localpart of the destinationMailAddress parameter. It is possible to override this by adding a uid as a body parameter:

 curl -XPOST 127.0.0.1:8000/migrate -v -d '{"sourceLogin":"poc-btellier", "sourcePassword":"MoindreRégulièrement", "destinationMailAddress": "[email protected]", "uid":"c3po"}' -v

Sample failure:

{
    "calDavErrorCount": 0,
    "calDavSuccessCount": 0,
    "cardDavErrorCount": 0,
    "cardDavSuccessCount": 0,
    "caldavExitCode": -1,
    "carddavExitCode": -1,
    "stackTrace": "java.lang.RuntimeException: Failure to Create account on lemon. Code 400 {\"error\":\"Too many accounts\"}\n\tat com.linagora.dav.migrator.Main.lambda$createLemonAccess$14(Main.java:258)\n\tat reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)\n\tat reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:129)\n\tat reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:224)\n\tat reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113)\n\tat reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194)\n\tat reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)\n\tat reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)\n\tat reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118)\n\tat reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)\n\tat reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)\n\tat reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)\n\tat reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)\n\tat reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)\n\tat reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:768)\n\tat reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n\tat io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)\n\tat io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n\tat io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)\n\tat io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)\n\tat io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)\n\tat io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)\n\tat io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)\n\tat io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)\n\tat io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\n",
    "success": false,
    "description": "Failure to Create account on lemon. Code 400 {\"error\":\"Too many accounts\"}"
}

Tag summary

Content type

Image

Digest

sha256:9d415e019

Size

399 MB

Last updated

over 2 years ago

docker pull chibenwa/dav-migrator:1.0.8