Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mailman-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
irt-public
mailman-tools
Commits
bd7ff7fc
Commit
bd7ff7fc
authored
7 years ago
by
Mr. Dmitry Makovey
Browse files
Options
Downloads
Patches
Plain Diff
add initial release of tools
parents
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
remove_user.py
+17
-0
17 additions, 0 deletions
remove_user.py
sync_users.py
+30
-0
30 additions, 0 deletions
sync_users.py
with
47 additions
and
0 deletions
remove_user.py
0 → 100755
+
17
−
0
View file @
bd7ff7fc
#!/usr/local/bin python
from
mailmanclient
import
Client
import
os
import
sys
CORE_URI
=
os
.
environ
.
get
(
'
MAILMAN_CORE_URI
'
,
'
http://mailman-core:8001/3.1
'
)
CORE_USER
=
os
.
environ
.
get
(
'
MAILMAN_REST_USER
'
,
'
restadmin
'
)
CORE_PASS
=
os
.
environ
.
get
(
'
MAILMAN_REST_PASSWORD
'
,
'
restpass
'
)
client
=
Client
(
CORE_URI
,
CORE_USER
,
CORE_PASS
)
ml_fqdn
=
sys
.
argv
[
1
]
member_email
=
sys
.
argv
[
2
]
ml
=
client
.
get_list
(
ml_fqdn
)
ml
.
unsubscribe
(
member_email
)
This diff is collapsed.
Click to expand it.
sync_users.py
0 → 100755
+
30
−
0
View file @
bd7ff7fc
#!/usr/local/bin/python
from
mailmanclient
import
Client
import
os
import
sys
CORE_URI
=
os
.
environ
.
get
(
'
MAILMAN_CORE_URI
'
,
'
http://mailman-core:8001/3.1
'
)
CORE_USER
=
os
.
environ
.
get
(
'
MAILMAN_REST_USER
'
,
'
restadmin
'
)
CORE_PASS
=
os
.
environ
.
get
(
'
MAILMAN_REST_PASSWORD
'
,
'
restpass
'
)
client
=
Client
(
CORE_URI
,
CORE_USER
,
CORE_PASS
)
ml_fqdn
=
sys
.
argv
[
1
]
ml
=
client
.
get_list
(
ml_fqdn
)
current_members
=
ml
.
members
new_member_list
=
[]
for
member_email
in
sys
.
stdin
:
print
(
"
Received {}
"
.
format
(
member_email
))
new_member_list
.
append
(
member_email
)
for
member_email
in
current_members
:
if
member_email
not
in
new_member_list
:
print
(
"
Intend to unsubscribe {}
"
.
format
(
member_email
))
# ml.unsubscribe(member_email)
for
member_email
in
new_member_list
:
if
member_email
not
in
current_members
:
print
(
"
Intend to subscribe {}
"
.
format
(
member_email
))
# ml.subscribe(member_email, pre_verified=True, pre_confirmed=True, pre_approved=True)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment