Commit 70475634 authored by Thomas Capricelli's avatar Thomas Capricelli
Browse files

enhance: pretend mode, and make the number an argument

parent 664577dd5035
......@@ -19,16 +19,22 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('pattern', type=str, help="A generic hostname, using one (and only one) %%d")
parser.add_argument('--number', type=int, help="Will bulk add from 0 to this value.", default=300)
parser.add_argument('--pretend', '-p', action='store_true', help="Only display candidates, do not create reports.")
def handle(self, *args, **options):
pattern = options['pattern']
pretend = options['pretend']
if pattern%1 == pattern%2:
self.stdout.write("Please provide a pattern with exactly one '%%d'."))
self.server, self.reason = Server.objects.get(name="verdi"), Reason.objects.get(name="Spam sender")
for i in range(300):
for i in range(options['number']):
hostname = pattern % i
if pretend:
self.stdout.write("(pretend): creating reports for %s" % hostname)
def addonehost(self, hostname):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment