Bug 1028030 - Add placeholders for email and password in TPS config file. r=hskupin a=test-only DONTBUILD
authorCosmin Malutan <cosmin.malutan@softvision.ro>
Wed, 25 Jun 2014 15:11:42 +0200
changeset 228410 f91a98e164ea9b9e3e32e284bc2fa577f183e26e
parent 228409 82ef9bf64d87804a457f815db22c586d29820fe7
child 228411 7e72b4659f51504113f88e50bb6357644f4f0e1b
push id6
push userryanvm@gmail.com
push dateMon, 12 Jan 2015 22:04:06 +0000
treeherdermozilla-b2g37_v2_2@895c8fc7b734 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershskupin, test-only
bugs1028030
milestone32.0a2
Bug 1028030 - Add placeholders for email and password in TPS config file. r=hskupin a=test-only DONTBUILD
testing/tps/config/config.json.in
testing/tps/create_venv.py
--- a/testing/tps/config/config.json.in
+++ b/testing/tps/config/config.json.in
@@ -1,17 +1,17 @@
 {
   "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",
     "password": "",
     "passednotificationlist": ["crossweave@mozilla.com"],
     "notificationlist": ["crossweave@mozilla.com"]
   },
   "auth_type": "fx_account",
--- a/testing/tps/create_venv.py
+++ b/testing/tps/create_venv.py
@@ -41,22 +41,53 @@ if sys.platform == 'win32':
     python_env = os.path.join('Scripts', 'python.exe')
 else:
     bin_name = os.path.join('bin', 'activate')
     activate_env = os.path.join('bin', 'activate_this.py')
     python_env = os.path.join('bin', 'python')
 
 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:
          parser.error('Path to the environment has to be specified')
     target = args[0]
     assert(target)
 
     # Create a virtual environment
@@ -86,16 +117,33 @@ def main():
         extdir = os.path.join(here, 'extensions')
 
     assert(os.path.exists(testdir))
     assert(os.path.exists(extdir))
 
     # 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:
             for source_string, target_string in replacements.iteritems():
                 line = line.replace(source_string, target_string)
             lines.append(line)
 
     with open(os.path.join(target, 'config.json'), 'w') as config: