Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 6dad7fc0 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Add option to start at a specified number for alias creation

parent 0e81b8d7
......@@ -17,8 +17,14 @@ class Account():
self.logger = logging.getLogger(__name__)
self.localpart = self.account.split('@')[0]
# Create a formatted list, starting at 001.
self.count = ("{0:03}".format(i) for i in range(1, self.total+1))
if self.start_at == 1:
self.total += 1
self.count = ("{0:03}".format(i) for i in range(
self.start_at,
self.start_at + self.total
)
)
# Verify that the subject user exists.
try:
......@@ -70,8 +76,9 @@ class Account():
def main():
helptext = '''examples:
google-build-fitbitstudy -a awesomestudy -t 20 -p study1
google-build-fitbitstudy --account awesomestudy --toal 20 --prefix study1
google-build-fitbitstudy -a awesomestudy -t 20 -p study1 --start-at 10
google-build-fitbitstudy --account awesomestudy --total 20 --prefix study1
--start-at 10
'''
# Kick up an argument parser and assign values into the env object.
......@@ -92,6 +99,13 @@ def main():
default=50,
type=int
)
parser.add_argument(
'--start-at',
help='The alias number to start creation at.',
dest='start_at',
default=1,
type=int
)
parser.add_argument(
'--prefix',
'-p',
......@@ -115,6 +129,11 @@ def main():
default=50
)
args.total = int(args.total)
args.start_at = arg_prompt(
'Start creation at (1):',
default=1
)
args.start_at = int(args.start_at)
args.prefix = arg_prompt(
'(optional) Prefix to assign to labels',
default=None
......
......@@ -11,6 +11,7 @@ def test_build():
args = {
'account': 'testsharedaccount',
'total': 10,
'start_at': 1,
'prefix': None
}
account = fitbit.Account(
......@@ -24,6 +25,7 @@ def test_build_with_prefix():
args = {
'account': 'testsharedaccount',
'total': 10,
'start_at': 10,
'prefix': 'prefix'
}
account = fitbit.Account(
......@@ -39,6 +41,7 @@ def test_sift_with_bad_subject():
args = {
'account': 'notauser',
'total': 10,
'start_at': 1,
'prefix': 'prefix'
}
account = fitbit.Account(
......
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