Skip to content
Snippets Groups Projects
Commit 02a3752a authored by Conrad Holmberg's avatar Conrad Holmberg
Browse files

Trying to fix bug with the scrub option to do only once in members loop.

parent a6b50995
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ def restore_members( members_file, ml_fqdn, scrub ):
"""Creates Code to Restore Members of a source/target email list."""
"""The scrub option determines if the current target scriptions are wiped."""
tgt_list = None
if members_file == '-':
json_file = sys.stdin
else:
......@@ -60,7 +61,7 @@ def restore_members( members_file, ml_fqdn, scrub ):
# get target the email list
if (ml_fqdn == src_member['list_fqdn']):
#deletes all members in the list
if ( scrub ):
if ( scrub and tgt_list is None):
scrub_members( ml_fqdn )
tgt_list = client.get_list(ml_fqdn)
# Get members from the current email list
......@@ -128,7 +129,7 @@ if __name__ == '__main__':
parser.add_argument('-l','--list-fqdn', required=True, help='Required Mailing List')
parser.add_argument('-d','--dump',action='store_true',
help='Dumps a mailing list to stout in json format.')
parser.add_argument('-r','--restore',action='store_true',
parser.add_argument('-r','--restore',
help='Subscribes users from a source email list into a tareget email list if not already added.')
parser.add_argument('-s','--scrub',action='store_true',
help='Removes all users from a target email list and suscribes the current.')
......@@ -167,3 +168,6 @@ if __name__ == '__main__':
restore_members( args.restore, ml_fqdn,True)
else:
restore_members( args.restore, ml_fqdn,False)
else:
print("Error: Need to perform a dump (-d) or restore (-r) of the email list "
+ml_fqdn)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment