def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = dbo.releases.getReleaseNames() form.mapping.choices = [(item['name'], item['name']) for item in releaseNames] form.mapping.choices.insert(0, ('', 'NULL')) if not form.validate(): self.log.warning("Bad input: %s", form.errors) return Response(status=400, response=json.dumps(form.errors)) what = dict(backgroundRate=form.backgroundRate.data, mapping=form.mapping.data, fallbackMapping=form.fallbackMapping.data, priority=form.priority.data, alias=form.alias.data, product=form.product.data, version=form.version.data, buildID=form.buildID.data, channel=form.channel.data, locale=form.locale.data, distribution=form.distribution.data, buildTarget=form.buildTarget.data, osVersion=form.osVersion.data, systemCapabilities=form.systemCapabilities.data, distVersion=form.distVersion.data, whitelist=form.whitelist.data, comment=form.comment.data, update_type=form.update_type.data, headerArchitecture=form.headerArchitecture.data) rule_id = dbo.rules.insert(changed_by=changed_by, transaction=transaction, **what) return Response(status=200, response=str(rule_id))
def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = db.releases.getReleaseNames() form.mapping.choices = [(item['name'],item['name']) for item in releaseNames] form.mapping.choices.insert(0, ('', 'NULL' ) ) if not form.validate(): self.log.debug(form.errors) return Response(status=400, response=form.errors) what = dict(backgroundRate=form.backgroundRate.data, mapping=form.mapping.data, priority=form.priority.data, product = form.product.data, version = form.version.data, buildID = form.build_id.data, channel = form.channel.data, locale = form.locale.data, distribution = form.distribution.data, buildTarget = form.build_target.data, osVersion = form.os_version.data, distVersion = form.dist_version.data, comment = form.comment.data, update_type = form.update_type.data, headerArchitecturerch = form.header_arch.data) rule_id = db.rules.addRule(changed_by=changed_by, what=what, transaction=transaction) return Response(status=200, response=rule_id)
def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = dbo.releases.getReleaseNames() form.mapping.choices = [(item['name'], item['name']) for item in releaseNames] form.mapping.choices.insert(0, ('', 'NULL')) if not form.validate(): self.log.warning("Bad input: %s", form.errors) return Response(status=400, response=json.dumps(form.errors)) what = dict( backgroundRate=form.backgroundRate.data, mapping=form.mapping.data, fallbackMapping=form.fallbackMapping.data, priority=form.priority.data, alias=form.alias.data, product=form.product.data, version=form.version.data, buildID=form.buildID.data, channel=form.channel.data, locale=form.locale.data, distribution=form.distribution.data, buildTarget=form.buildTarget.data, osVersion=form.osVersion.data, systemCapabilities=form.systemCapabilities.data, distVersion=form.distVersion.data, whitelist=form.whitelist.data, comment=form.comment.data, update_type=form.update_type.data, headerArchitecture=form.headerArchitecture.data) rule_id = dbo.rules.insert( changed_by=changed_by, transaction=transaction, **what) return Response(status=200, response=str(rule_id))
def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = retry(db.releases.getReleaseNames, sleeptime=5, retry_exceptions=(SQLAlchemyError,)) form.mapping.choices = [(item['name'],item['name']) for item in releaseNames] form.mapping.choices.insert(0, ('', 'NULL' ) ) if not form.validate(): self.log.debug(form.errors) return Response(status=400, response=form.errors) what = dict(throttle=form.throttle.data, mapping=form.mapping.data, priority=form.priority.data, product = form.product.data, version = form.version.data, build_id = form.build_id.data, channel = form.channel.data, locale = form.locale.data, distribution = form.distribution.data, build_target = form.build_target.data, os_version = form.os_version.data, dist_version = form.dist_version.data, comment = form.comment.data, update_type = form.update_type.data, header_arch = form.header_arch.data) rule_id = retry(db.rules.addRule, sleeptime=5, retry_exceptions=(SQLAlchemyError,), kwargs=dict(changed_by=changed_by, what=what, transaction=transaction)) return Response(status=200, response=rule_id)
def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = dbo.releases.getReleaseNames() form.mapping.choices = [(item['name'], item['name']) for item in releaseNames] form.mapping.choices.insert(0, ('', 'NULL')) if not form.validate(): cef_event("Bad input", CEF_WARN, errors=form.errors) return Response(status=400, response=json.dumps(form.errors)) what = dict(backgroundRate=form.backgroundRate.data, mapping=form.mapping.data, priority=form.priority.data, product=form.product.data, version=form.version.data, buildID=form.buildID.data, channel=form.channel.data, locale=form.locale.data, distribution=form.distribution.data, buildTarget=form.buildTarget.data, osVersion=form.osVersion.data, distVersion=form.distVersion.data, comment=form.comment.data, update_type=form.update_type.data, headerArchitecture=form.headerArchitecture.data) rule_id = dbo.rules.addRule(changed_by=changed_by, what=what, transaction=transaction) return Response(status=200, response=str(rule_id))
def _post(self, transaction, changed_by): # a Post here creates a new rule form = RuleForm() releaseNames = dbo.releases.getReleaseNames() form.mapping.choices = [(item["name"], item["name"]) for item in releaseNames] form.mapping.choices.insert(0, ("", "NULL")) if not form.validate(): cef_event("Bad input", CEF_WARN, errors=form.errors) return Response(status=400, response=json.dumps(form.errors)) what = dict( backgroundRate=form.backgroundRate.data, mapping=form.mapping.data, priority=form.priority.data, product=form.product.data, version=form.version.data, buildID=form.buildID.data, channel=form.channel.data, locale=form.locale.data, distribution=form.distribution.data, buildTarget=form.buildTarget.data, osVersion=form.osVersion.data, distVersion=form.distVersion.data, comment=form.comment.data, update_type=form.update_type.data, headerArchitecture=form.headerArchitecture.data, ) rule_id = dbo.rules.addRule(changed_by=changed_by, what=what, transaction=transaction) return Response(status=200, response=str(rule_id))