Thank you Abilash Raj for your help which made me step ahead.
With your help, I have written a for loop as below which makes all the lists on my Mailman 3 box set the configuration of max_days_to_hold as 1 and of course I am successful in setting so.
And the for loop is as below:
*for listid in curl -u restadmin:restpass -X GET http://localhost:8001/3.1/lists <http://localhost:8001/3.1/lists> | python -mjson.tool| grep "list_id" | awk -F"\"" '{print $4}'
*
*do *
- curl -u restadmin:restpass -X PATCH http://localhost:8001/3.1/lists/$listid/config <http://localhost:8001/3.1/lists/$listid/config> -d max_days_to_hold='1'* *done*
With the above script I am able to set the value of max_days_to_hold as required but how to check manually and make my held messages discarded automatically which are after the specified period configured for max_days_to_hold.
If I am able to do it manually I can be confident to take in to production so that the held messages after a specific period would not be appeared under "held messages" tab.
On Sat, Feb 1, 2020 at 11:14 PM Abhilash Raj <maxking@asynchronous.in> wrote:
On Sat, Feb 1, 2020, at 5:27 AM, Shashikanth Komandoor wrote:
Hello Mark,
Thanks for helping me for moving ahead in my project. Troubling you again, I would like to put another request at you. As per your suggestion, I am trying to configure my list
configuration through REST API for specially the parameter like max_days_to_hold as it is not available through interface and I am following the official links of mailman 3 i.e
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/listconf.html
But I am getting "name is not defined" sort of errors as below:
*>>> dump_json('http://localhost:9001/3.0/lists/ <http://localhost:9001/3.0/lists/>','ant@example.com/config <http://ant@example.com/config>',dict(display_name='My List'),'PATCH')Traceback (most recent call last): File "<stdin>", line
in <module>NameError: name 'dump_json' is not defined>>>*
Actually I am new to REST API but hope this is the only issue
is preventing me to go ahead.
Could you please help me by saying how should I handle this so
1, that that
I should be able to configure *max_days_to_hold* of a list or multiple ?
dump_json is basically a Python function which sends the request to the URL you add as the first parameter (GET, if any data isn't specified and uses POST if data is specified or explicitly define the PATCH or method like you have above) and prints the json response.
You can easily do the same using curl with the right authorization headers, with something like:
$ curl -u restadmin:restpass -X PATCH
http://localhost:8001/3.1/lists/somelist.example.com/config -d display_name='Patched Name'Note that "restadmin:restpass" is the username password that you have set in your mailman.cfg.
If you do want to use Python, you can just use a regular PATCH request using requests or standard library urllib3.
Finally, dump_json is documented here: https://mailman.readthedocs.io/en/latest/src/mailman/docs/documentation.html...
On Wed, Jan 29, 2020 at 11:20 PM Mark Sapiro <mark@msapiro.net> wrote:
On 1/28/20 8:42 PM, Shashikanth Komandoor wrote:
But I could see that parameter value configurable on MM2 GUI
interface in General Options but I don't see the same on the MM3 GUI interface.
There are many core settings not (yet) exposed in Postorius. max_days_to_hold. is one of them. It can be set via
mailman shell
or via the REST API <https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html#res...
.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- Thanks & Regards, Shashi Kanth.K 9052671936
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- Thanks & Regards, Shashi Kanth.K 9052671936