use config.get('upload', 'option') instead of config['upload'].get('option')

* the former does not give internal server error when 'upload' is missing
This commit is contained in:
clime 2018-02-26 09:42:23 +01:00
parent 5a673a43e7
commit ba8fd50109
5 changed files with 17 additions and 9 deletions

View file

@ -7,8 +7,10 @@ gitroot_dir = /var/lib/dist-git/git
gitolite = True
grok = True
default_namespace = rpms
[upload]
fedmsgs = True
old_paths = True
nomd5 = True
default_namespace = rpms

View file

@ -7,6 +7,8 @@ gitroot_dir = /var/lib/dist-git/git
gitolite = True
grok = True
[upload]
fedmsgs = True
old_paths = True
nomd5 = True

View file

@ -7,8 +7,10 @@ gitroot_dir = /var/lib/dist-git/git
gitolite = True
grok = True
default_namespace = rpms
[upload]
fedmsgs = True
old_paths = True
nomd5 = True
default_namespace = rpms

View file

@ -7,8 +7,10 @@ gitroot_dir = /var/lib/dist-git/git
gitolite = True
grok = True
default_namespace = rpms
[upload]
fedmsgs = True
old_paths = True
nomd5 = True
default_namespace = rpms

View file

@ -209,7 +209,7 @@ def main():
print 'Missing'
sys.exit(0)
elif hash_type == "md5" and config['upload'].getboolean('nomd5', fallback=True):
elif hash_type == "md5" and config.getboolean('upload', 'nomd5', fallback=True):
send_error('Uploads with md5 are no longer allowed.',
status='406 Not Acceptable')
@ -253,11 +253,11 @@ def main():
hash_type.upper(), checksum)
# Add the file to the old path, where fedpkg is currently looking for it
if hash_type == "md5" and config['upload'].getboolean('old_paths', fallback=True):
if hash_type == "md5" and config.getboolean('upload', 'old_paths', fallback=True):
hardlink(dest_file, old_path, username)
# Emit a fedmsg message. Load the config to talk to the fedmsg-relay.
if config['upload'].getboolean('fedmsgs', fallback=True):
if config.getboolean('upload', 'fedmsgs', fallback=True):
try:
config = fedmsg.config.load_config([], None)
config['active'] = True