1
0
mirror of https://github.com/quay/quay.git synced 2025-10-26 20:51:43 +03:00

'make black' results

This commit is contained in:
Tom McKay
2019-12-02 12:23:08 -05:00
parent 5d83b82b56
commit e6ae94db8b
781 changed files with 105190 additions and 85578 deletions

View File

@@ -11,40 +11,46 @@ configure(app.config)
logger = logging.getLogger(__name__)
def run_branchregex_migration():
encountered = set()
while True:
found = list(RepositoryBuildTrigger.select().where(RepositoryBuildTrigger.config ** "%branch_regex%",
~(RepositoryBuildTrigger.config ** "%branchtag_regex%")))
found = [f for f in found if not f.uuid in encountered]
encountered = set()
while True:
found = list(
RepositoryBuildTrigger.select().where(
RepositoryBuildTrigger.config ** "%branch_regex%",
~(RepositoryBuildTrigger.config ** "%branchtag_regex%"),
)
)
found = [f for f in found if not f.uuid in encountered]
if not found:
logger.debug('No additional records found')
return
if not found:
logger.debug("No additional records found")
return
logger.debug('Found %s records to be changed', len(found))
for trigger in found:
encountered.add(trigger.uuid)
logger.debug("Found %s records to be changed", len(found))
for trigger in found:
encountered.add(trigger.uuid)
try:
config = json.loads(trigger.config)
except:
logging.error("Cannot parse config for trigger %s", trigger.uuid)
continue
try:
config = json.loads(trigger.config)
except:
logging.error("Cannot parse config for trigger %s", trigger.uuid)
continue
logger.debug("Checking trigger %s", trigger.uuid)
existing_regex = config['branch_regex']
logger.debug("Found branch regex '%s'", existing_regex)
logger.debug("Checking trigger %s", trigger.uuid)
existing_regex = config["branch_regex"]
logger.debug("Found branch regex '%s'", existing_regex)
sub_regex = existing_regex.split('|')
new_regex = '|'.join(['heads/' + sub for sub in sub_regex])
config['branchtag_regex'] = new_regex
sub_regex = existing_regex.split("|")
new_regex = "|".join(["heads/" + sub for sub in sub_regex])
config["branchtag_regex"] = new_regex
logger.debug("Updating to branchtag regex '%s'", new_regex)
update_build_trigger(trigger, config)
logger.debug("Updating to branchtag regex '%s'", new_regex)
update_build_trigger(trigger, config)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('boto').setLevel(logging.CRITICAL)
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("boto").setLevel(logging.CRITICAL)
run_branchregex_migration()
run_branchregex_migration()