z-push-admin remove days-old not working



  • in z-push admin, remove old states not working as expected in manual:

    working:
    z-push-admin -a lastsync --days-old 100

    not working:
    z-push-admin -a remove --days-old 100
    error message:
    Not possible to remove data. Device, user or both must be specified.

    but manual says:
    [–days-old] n show or remove profiles older than n days with lastsync or remove. n must be a positive integer.

    if someone needs a workaround do:
    z-push-admin -a lastsync --days-old 100 | sed 1,5d | cut -d" " -f1 | sed ‘/^$/d’ | while read line; do z-push-admin -a remove -d $line; done

    regards,
    daniel


  • Kopano

    Hi @goldingerit,

    please alway specify the (exact) version(s) you are currently using, this makes it easier to try to reproduce the issue. The os can in some cases also be interesting, but for this one it probably does not matter.

    That being said…

    calling z-push-admin -a remove --days-old 100 does indeed give the message Not possible to remove data [..] This is since the remove action always need either the username or a device id passed (as the error states). But the help text of z-push-admin could indeed be interpreted in a way that z-push-admin -a remove --days-old 100 should work, while actually it needs to be z-push-admin -a remove -u some-user --days-old 100

    Not sure if the behaviour of remove should be changed. Ticket that introduced --days-old was https://jira.z-hub.io/browse/ZP-1165



  • hi @fbartels
    thanks for your reply.
    i tried z-push-admin -a remove -u some-user --days-old 100 before, but that removed all states of that user.

    OS: Debian Stretch 4.9.168-1+deb9u5
    Latest Z-Push Version from here (there is no version tag in z-push-admin?):
    http://repo.z-hub.io/z-push:/final/Debian_9.0/

    regards,
    daniel


  • Kopano

    @goldingerit said in z-push-admin remove days-old not working:

    i tried z-push-admin -a remove -u some-user --days-old 100 before, but that removed all states of that user.

    hm… that is not the case on my system. for me it removes only items that are listed with -a lastsync -u some-user and additionally also gives Some devices might not have been removed because of --days-old parameter. Check Z-Push log file for more details.


  • Kopano

    Hi Daniel,

    @goldingerit said in z-push-admin remove days-old not working:

    i tried z-push-admin -a remove -u some-user --days-old 100 before, but that removed all states of that user.

    Had the user states not older than 100 days?

    Manfred


  • Kopano

    Hi Daniel,

    @goldingerit said in z-push-admin remove days-old not working:

    in z-push admin, remove old states not working as expected in manual:

    working:
    z-push-admin -a lastsync --days-old 100

    not working:
    z-push-admin -a remove --days-old 100
    error message:
    Not possible to remove data. Device, user or both must be specified.

    but manual says:
    [–days-old] n show or remove profiles older than n days with lastsync or remove. n must be a positive integer.

    if someone needs a workaround do:
    z-push-admin -a lastsync --days-old 100 | sed 1,5d | cut -d" " -f1 | sed ‘/^$/d’ | while read line; do z-push-admin -a remove -d $line; done

    regards,
    daniel

    @fbartels said in z-push-admin remove days-old not working:

    calling z-push-admin -a remove --days-old 100 does indeed give the message Not possible to remove data [..] This is since the remove action always need either the username or a device id passed (as the error states). But the help text of z-push-admin could indeed be interpreted in a way that z-push-admin -a remove --days-old 100 should work, while actually it needs to be z-push-admin -a remove -u some-user --days-old 100

    Not sure if the behaviour of remove should be changed. Ticket that introduced --days-old was https://jira.z-hub.io/browse/ZP-1165

    The manual entry for --days-old doesn’t state explicitly that using it with remove username or device id or both are required, but in the actions’ part of the manual all remove entries contain at least one parameter whereas actions without a parameter like list or lastsync don’t.

    Manfred


  • Kopano

    @Manfred said in z-push-admin remove days-old not working:

    but in the actions’ part of the manual all remove entries contain at least one parameter

    Yes, that is clear to me as well.

    Maybe a solutions for @goldingerit would be a special parameter z-push-admin -a remove -d all --days-old 100?

    I do understand the use case that you may want to have a one off command that deletes old stuff.



  • @Manfred :
    yes, the user had an active mobilephone client, 0 days old and it deleted that too.

    @fbartels
    yes, that usecase is correct. we have a server with around 25 users working on it. whenever a user get’s a new mobile, the old one is still available in z-push states but not used anymore. so it’s just a “cleanup of unused devices”.
    but it can be done with the workaround:
    z-push-admin -a lastsync --days-old 100 | sed 1,5d | cut -d" " -f1 | sed ‘/^$/d’ | while read line; do z-push-admin -a remove -d $line; done

    so this isn’t really an urgent thing for me, maybe you can add it in a future release.

    regards,
    daniel


  • Kopano

    @goldingerit said in z-push-admin remove days-old not working:

    the user had an active mobilephone client, 0 days old and it deleted that too.

    like already said before, this is something I cannot reproduce locally.


Log in to reply