Bug 1028030 - Add placeholders for email and password in TPS config file. r=hskupin a=test-only DONTBUILD

This commit is contained in:
Cosmin Malutan 2014-06-25 15:11:42 +02:00
parent 60d5bc4f5e
commit 3992ca374b
2 changed files with 53 additions and 5 deletions

View File

@ -1,12 +1,12 @@
{
"sync_account": {
"username": "",
"password": "",
"passphrase": ""
"username": "__SYNC_ACCOUNT_USERNAME__",
"password": "__SYNC_ACCOUNT_PASSWORD__",
"passphrase": "__SYNC_ACCOUNT_PASSPHRASE__"
},
"fx_account": {
"username": "",
"password": ""
"username": "__FX_ACCOUNT_USERNAME__",
"password": "__FX_ACCOUNT_PASSWORD__"
},
"email": {
"username": "crossweave@mozilla.com",

View File

@ -46,12 +46,43 @@ else:
def main():
parser = optparse.OptionParser('Usage: %prog [options] path_to_venv')
parser.add_option('--password',
type='string',
dest='password',
metavar='FX_ACCOUNT_PASSWORD',
default=None,
help='The Firefox Account password.')
parser.add_option('-p', '--python',
type='string',
dest='python',
metavar='PYTHON_BIN',
default=None,
help='The Python interpreter to use.')
parser.add_option('--sync-passphrase',
type='string',
dest='sync_passphrase',
metavar='SYNC_ACCOUNT_PASSPHRASE',
default=None,
help='The old Firefox Sync account passphrase.')
parser.add_option('--sync-password',
type='string',
dest='sync_password',
metavar='SYNC_ACCOUNT_PASSWORD',
default=None,
help='The old Firefox Sync account password.')
parser.add_option('--sync-username',
type='string',
dest='sync_username',
metavar='SYNC_ACCOUNT_USERNAME',
default=None,
help='The old Firefox Sync account username.')
parser.add_option('--username',
type='string',
dest='username',
metavar='FX_ACCOUNT_USERNAME',
default=None,
help='The Firefox Account username.')
(options, args) = parser.parse_args(args=None, values=None)
if len(args) != 1:
@ -91,6 +122,23 @@ def main():
# Update config file
config_in_path = os.path.join(here, 'config', 'config.json.in')
replacements = {'__TESTDIR__': testdir, '__EXTENSIONDIR__': extdir}
if options.username and options.password:
replacements.update({
'__FX_ACCOUNT_USERNAME__': options.username,
'__FX_ACCOUNT_PASSWORD__': options.password})
else:
print 'Firefox Account credentials not specified. Please update the ' \
'config file manually.'
if options.sync_username and options.sync_password and options.passphrase:
replacements.update({
'__SYNC_ACCOUNT_USERNAME__': options.sync_username,
'__SYNC_ACCOUNT_PASSWORD__': options.sync_password,
'__SYNC_ACCOUNT_PASSPHRASE__': options.sync_passphrase})
else:
print "Firefox Sync account credentials not specified. Please " \
"update the config file manually."
lines = []
with open(config_in_path) as config:
for line in config: