Backout broken patch.
authorBen Hearsum <bhearsum@mozilla.com>
Fri, 31 Mar 2017 10:27:09 -0400
changeset 7414 0167a5d06a920adcb60b97486fa660ea5a7cb35d
parent 7413 0a0b27078a1856d43a068f4fabd12a536c533f78
child 7415 68fd4127c10464e0814ceb9994222da721a92321
push id5519
push userbhearsum@mozilla.com
push dateFri, 31 Mar 2017 14:27:17 +0000
Backout broken patch.
lib/python/balrog/submitter/api.py
lib/python/balrog/submitter/cli.py
lib/python/vendor/balrogclient-0.0.1/balrogclient/__init__.py
lib/python/vendor/balrogclient-0.0.1/balrogclient/api.py
lib/python/vendorlibs.pth
scripts/build-promotion/balrog-release-shipper.py
--- a/lib/python/balrog/submitter/api.py
+++ b/lib/python/balrog/submitter/api.py
@@ -1,8 +1,8 @@
 import os
 import site
 
 site.addsitedir(os.path.join(os.path.dirname(__file__), "../.."))
 
-from balrogclient import is_csrf_token_expired, SingleLocale, Release, Rule, ScheduledRuleChange
+from balrogclient import is_csrf_token_expired, SingleLocale, Release, Rule
 
-__all__ = [ 'is_csrf_token_expired', 'SingleLocale', 'Release', 'Rule', 'ScheduledRuleChange' ]
+__all__ = [ 'is_csrf_token_expired', 'SingleLocale', 'Release', 'Rule' ]
--- a/lib/python/balrog/submitter/cli.py
+++ b/lib/python/balrog/submitter/cli.py
@@ -1,20 +1,19 @@
-import arrow
 try:
     import simplejson as json
 except ImportError:
     import json
 
 from release.info import getProductDetails
 from release.paths import makeCandidatesDir
 from release.platforms import buildbot2updatePlatforms, buildbot2bouncer, \
   buildbot2ftp
 from release.versions import getPrettyVersion
-from balrog.submitter.api import Release, SingleLocale, Rule, ScheduledRuleChange
+from balrog.submitter.api import Release, SingleLocale, Rule
 from balrog.submitter.updates import merge_partial_updates
 from util.algorithms import recursive_update
 from util.retry import retry
 import logging
 from requests.exceptions import HTTPError
 
 log = logging.getLogger(__name__)
 
@@ -470,50 +469,22 @@ class ReleaseSubmitterV4(ReleaseSubmitte
 
 
 class ReleasePusher(object):
     def __init__(self, api_root, auth, dummy=False):
         self.api_root = api_root
         self.auth = auth
         self.dummy = dummy
 
-    def run(self, productName, version, build_number, rule_ids, backgroundRate=None):
+    def run(self, productName, version, build_number, rule_ids):
         name = get_release_blob_name(productName, version, build_number,
                                      self.dummy)
         for rule_id in rule_ids:
-            data = {"mapping": name}
-            if backgroundRate:
-                data["backgroundRate"] = backgroundRate
             Rule(api_root=self.api_root, auth=self.auth, rule_id=rule_id
-                 ).update_rule(**data)
-
-
-class ReleaseScheduler(object):
-    def __init__(self, api_root, auth, dummy=False):
-        self.api_root = api_root
-        self.auth = auth
-        self.dummy = dummy
-
-    def run(self, productName, version, build_number, rule_ids, when, backgroundRate=None):
-        name = get_release_blob_name(productName, version, build_number,
-                                     self.dummy)
-        for rule_id in rule_ids:
-            data, data_version = Rule(api_root=self.api_root, auth=self.auth, rule_id=rule_id).get_data()
-            data["fallbackMapping"] = data["mapping"]
-            data["mapping"] = name
-            data["data_verison"] = data_version
-            data["rule_id"] = rule_id
-            data["change_type"] = "update"
-            # We receive an iso8601 datetime, but what Balrog needs is a to-the-millisecond epoch timestamp
-            data["when"] = arrow.get(when).timestamp * 1000
-            if backgroundRate:
-                data["backgroundRate"] = backgroundRate
-
-            ScheduledRuleChange(api_root=self.api_root, auth=self.auth, rule_id=rule_id
-                               ).add_scheduled_rule_change(**data)
+                 ).update_rule(mapping=name)
 
 
 class BlobTweaker(object):
     def __init__(self, api_root, auth):
         self.api_root = api_root
         self.auth = auth
 
     def run(self, name, data):
--- a/lib/python/vendor/balrogclient-0.0.1/balrogclient/__init__.py
+++ b/lib/python/vendor/balrogclient-0.0.1/balrogclient/__init__.py
@@ -1,3 +1,3 @@
-from balrogclient.api import is_csrf_token_expired, SingleLocale, Release, Rule, ScheduledRuleChange
+from balrogclient.api import is_csrf_token_expired, SingleLocale, Release, Rule
 
-__all__ = [ 'is_csrf_token_expired', 'SingleLocale', 'Release', 'Rule', 'ScheduledRuleChange' ]
+__all__ = [ 'is_csrf_token_expired', 'SingleLocale', 'Release', 'Rule' ]
\ No newline at end of file
--- a/lib/python/vendor/balrogclient-0.0.1/balrogclient/api.py
+++ b/lib/python/vendor/balrogclient-0.0.1/balrogclient/api.py
@@ -231,23 +231,8 @@ class Rule(API):
     def __init__(self, rule_id, **kwargs):
         super(Rule, self).__init__(**kwargs)
         self.rule_id = rule_id
         self.url_template_vars = dict(rule_id=rule_id)
 
     def update_rule(self, **rule_data):
         """wrapper for self.request"""
         return self.request(method='POST', data=rule_data)
-
-
-class ScheduledRuleChange(API):
-    """Update Balrog rules"""
-    url_template = '/scheduled_changes/rules'
-    prerequest_url_template = '/rules/%(rule_id)s'
-
-    def __init__(self, rule_id, **kwargs):
-        super(ScheduledRuleChange, self).__init__(**kwargs)
-        self.rule_id = rule_id
-        self.url_template_vars = dict(rule_id=rule_id)
-
-    def add_scheduled_rule_change(self, **rule_data):
-        """wrapper for self.request"""
-        return self.request(method='POST', data=rule_data)
--- a/lib/python/vendorlibs.pth
+++ b/lib/python/vendorlibs.pth
@@ -7,9 +7,8 @@ vendor/Jinja2-2.7.3/
 vendor/MarkupSafe-0.23/
 vendor/redo-1.4.1/
 vendor/jsonmerge-1.1.0/
 vendor/jsonschema-2.5.1/
 vendor/functools32-3.2.3-2/
 vendor/repoze.lru-ef418de/
 vendor/balrogclient-0.0.1/
 vendor/certifi-2016.9.26/
-vendor/arrow-0.10.0/
--- a/scripts/build-promotion/balrog-release-shipper.py
+++ b/scripts/build-promotion/balrog-release-shipper.py
@@ -2,52 +2,39 @@
 
 from os import path
 import logging
 import sys
 
 # Use explicit version of python-requests
 sys.path.insert(0, path.join(path.dirname(__file__),
                              "../../lib/python/vendor/requests-2.7.0"))
-sys.path.insert(0, path.join(path.dirname(__file__),
-                             "../../lib/python/vendor/arrow-0.10.0"))
 sys.path.insert(0, path.join(path.dirname(__file__), "../../lib/python"))
 
-from balrog.submitter.cli import ReleasePusher, ReleaseScheduler
+from balrog.submitter.cli import ReleasePusher
 
 if __name__ == '__main__':
 
     from argparse import ArgumentParser
     parser = ArgumentParser()
     parser.add_argument("-a", "--api-root", dest="api_root",required=True)
     parser.add_argument("-c", "--credentials-file", dest="credentials_file", required=True)
     parser.add_argument("-u", "--username", dest="username", required=True)
     parser.add_argument("-V", "--version", dest="version", required=True)
     parser.add_argument("-p", "--product", dest="product_name", required=True)
     parser.add_argument("-b", "--build-number", dest="build_number", required=True)
     parser.add_argument("-R", "--rules", dest="rule_ids", action="append", required=True)
-    parser.add_argument("-s", "--schedule-at", dest="schedule_at", default=None)
-    parser.add_argument("-B", "--background-rate", dest="backgroundRate", default=None)
     parser.add_argument("-v", "--verbose", dest="verbose", action="store_true")
     args = parser.parse_args()
 
     logging_level = logging.INFO
     if args.verbose:
         logging_level = logging.DEBUG
     logging.basicConfig(stream=sys.stdout, level=logging_level,
                         format="%(message)s")
 
     credentials = {}
     execfile(args.credentials_file, credentials)
     auth = (args.username, credentials['balrog_credentials'][args.username])
 
-    if args.schedule_at:
-        scheduler = ReleaseScheduler(args.api_root, auth)
-        if args.backgroundRate:
-            scheduler.run(args.product_name.capitalize(), args.version,
-                          args.build_number, args.rule_ids, args.schedule_at, args.backgroundRate)
-        else:
-            scheduler.run(args.product_name.capitalize(), args.version,
-                          args.build_number, args.rule_ids, args.schedule_at)
-    else:
-        pusher = ReleasePusher(args.api_root, auth)
-        pusher.run(args.product_name.capitalize(), args.version,
-                args.build_number, args.rule_ids, args.backgroundRate)
+    pusher = ReleasePusher(args.api_root, auth)
+    pusher.run(args.product_name.capitalize(), args.version,
+               args.build_number, args.rule_ids)