Example #1
0
 def run(self,
         appVersion,
         productName,
         version,
         buildNumber,
         updateChannels,
         ftpServer,
         bouncerServer,
         enUSPlatforms,
         hashFunction,
         schemaVersion,
         openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels, ftpServer,
                               bouncerServer, enUSPlatforms, schemaVersion,
                               openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     try:
         current_data, data_version = api.get_data()
     except HTTPError, e:
         if e.response.status_code == 404:
             log.warning("Release blob doesn't exist, using empty data...")
             current_data, data_version = {}, None
         else:
             raise
Example #2
0
 def run(self,
         appVersion,
         productName,
         version,
         buildNumber,
         updateChannels,
         stagingServer,
         bouncerServer,
         enUSPlatforms,
         hashFunction,
         schemaVersion,
         openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels, stagingServer,
                               bouncerServer, enUSPlatforms, schemaVersion,
                               openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Example #3
0
 def run(self, name, data):
     api = Release(auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data(name)
     data = recursive_update(current_data, data)
     api.update_release(name, data['appVersion'], name.split('-')[0],
                        data['hashFunction'], json.dumps(data), data_version,
                        schemaVersion=current_data['schema_version'])
Example #4
0
 def run(self, name, data):
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(product=name.split('-')[0],
                        hashFunction=data['hashFunction'],
                        releaseData=json.dumps(data),
                        data_version=data_version,
                        schemaVersion=current_data['schema_version'])
Example #5
0
 def run(self, appVersion, productName, version, buildNumber,
         partialUpdates, updateChannels, stagingServer, bouncerServer,
         enUSPlatforms, hashFunction):
     api = Release(auth=self.auth, api_root=self.api_root)
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, partialUpdates, updateChannels,
                               stagingServer, bouncerServer, enUSPlatforms)
     current_data, data_version = api.get_data(self.name)
     data = recursive_update(current_data, data)
     api = Release(auth=self.auth, api_root=self.api_root)
     api.update_release(name=self.name,
                        version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Example #6
0
 def run(self, appVersion, productName, version, buildNumber,
         updateChannels, ftpServer, bouncerServer,
         enUSPlatforms, hashFunction, schemaVersion, openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels,
                               ftpServer, bouncerServer, enUSPlatforms,
                               schemaVersion, openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Example #7
0
 def run(self, appVersion, productName, version, buildNumber,
         updateChannels, ftpServer, bouncerServer,
         enUSPlatforms, hashFunction, schemaVersion, openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels,
                               ftpServer, bouncerServer, enUSPlatforms,
                               schemaVersion, openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     try:
         current_data, data_version = api.get_data()
     except HTTPError, e:
         if e.response.status_code == 404:
             log.warning("Release blob doesn't exist, using empty data...")
             current_data, data_version = {}, None
         else:
             raise
            parser.error("Unsupported number of args for the lock command.")

        for rule_id in args.rule_ids:
            release_name = None
            if len(my_args) == 1:
                release_name = args[0]

            if not release_name:
                rule_data, _ = Rule(api_root=args.api_root,
                                    auth=auth,
                                    rule_id=rule_id).get_data()
                latest_blob_name = rule_data["mapping"]
                release = Release(api_root=args.api_root,
                                  auth=auth,
                                  name=latest_blob_name)
                release_data, _ = release.get_data()
                buildid = None
                for p in release_data["platforms"].values():
                    enUS = p.get("locales", {}).get("en-US", {})
                    next_buildid = enUS.get("buildID")
                    if next_buildid > buildid:
                        buildid = next_buildid
                if not buildid:
                    logging.error("Couldn't find latest buildid for rule %s",
                                  rule_id)
                    sys.exit(1)

                root_name = "-".join(latest_blob_name.split("-")[:-1])
                release_name = "%s-%s" % (root_name, buildid)

            if not args.dry_run:
    if args.action == ["lock"]:
        my_args = args.action_args
        if len(my_args) > 1:
            parser.error("Unsupported number of args for the lock command.")

        for rule_id in args.rule_ids:
            release_name = None
            if len(my_args) == 1:
                release_name = args[0]

            if not release_name:
                rule_data, _ = rule_api.get_data(rule_id)
                latest_blob_name = rule_data["mapping"]
                release_api = Release(args.api_root, auth)
                release_data, _ = release_api.get_data(latest_blob_name)
                buildid = None
                for p in release_data["platforms"].values():
                    enUS = p.get("locales", {}).get("en-US", {})
                    next_buildid = enUS.get("buildID")
                    if next_buildid > buildid:
                        buildid = next_buildid
                if not buildid:
                    logging.error("Couldn't find latest buildid for rule %s", rule_id)
                    sys.exit(1)

                root_name = "-".join(latest_blob_name.split("-")[:-1])
                release_name = "%s-%s" % (root_name, buildid)

            if not args.dry_run:
                logging.info("Locking rule %s to %s", rule_id, release_name)
    if args.action == ["lock"]:
        my_args = args.action_args
        if len(my_args) > 1:
            parser.error("Unsupported number of args for the lock command.")

        for rule_id in args.rule_ids:
            release_name = None
            if len(my_args) == 1:
                release_name = args[0]

            if not release_name:
                rule_data, _ = Rule(api_root=args.api_root, auth=auth, rule_id=rule_id).get_data()
                latest_blob_name = rule_data["mapping"]
                release = Release(api_root=args.api_root, auth=auth, name=latest_blob_name)
                release_data, _ = release.get_data()
                buildid = None
                for p in release_data["platforms"].values():
                    enUS = p.get("locales", {}).get("en-US", {})
                    next_buildid = enUS.get("buildID")
                    if next_buildid > buildid:
                        buildid = next_buildid
                if not buildid:
                    logging.error("Couldn't find latest buildid for rule %s", rule_id)
                    sys.exit(1)

                root_name = "-".join(latest_blob_name.split("-")[:-1])
                release_name = "%s-%s" % (root_name, buildid)

            if not args.dry_run:
                logging.info("Locking rule %s to %s", rule_id, release_name)